Skip to content
Snippets Groups Projects
Commit 1befcdf0 authored by Stephane Chavin's avatar Stephane Chavin
Browse files

Updates

parent c885b845
Branches
No related tags found
No related merge requests found
...@@ -13,7 +13,7 @@ warnings.filterwarnings('ignore') ...@@ -13,7 +13,7 @@ warnings.filterwarnings('ignore')
parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter, description='TODO') parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter, description='TODO')
parser.add_argument('-f','--file', type=str,required=True,help = 'Name of the file that contain the recording to print') parser.add_argument('-f','--file', type=str,required=True,help = 'Name of the file that contain the recording to print')
parser.add_argument('-p','--path_to_data', type=str, help = 'Path of the folder that contain the recodings',required=True) parser.add_argument('-p','--path_to_data', type=str, help = 'Path of the folder that contain the recodings',required=True)
parser.add_argument('-d','--direction', type=str, help = 'Direction of the saved spectrogram',required=True) parser.add_argument('-d','--direction', type=str, help = 'Directory to wich spectrogram will be stored',required=True)
parser.add_argument('-m','--mode', type=str,choose={'unique','multiple'} help = 'Direction of the saved spectrogram',required=True) parser.add_argument('-m','--mode', type=str,choose={'unique','multiple'} help = 'Direction of the saved spectrogram',required=True)
args = parser.parse_args() args = parser.parse_args()
......
...@@ -18,7 +18,7 @@ today = date.today() ...@@ -18,7 +18,7 @@ today = date.today()
parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter, description='TODO') parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter, description='TODO')
parser.add_argument('-f','--filename_path', type=str, help = 'Path and name of the file containing the annotations',required=True) parser.add_argument('-f','--filename_path', type=str, help = 'Path and name of the file containing the annotations',required=True)
parser.add_argument('-p','--path_to_data', type=str, help = 'Path of the folder that contain the recodings',required=True) parser.add_argument('-p','--path_to_data', type=str, help = 'Path of the folder that contain the recodings',required=True)
parser.add_argument('-d','--direction', type=str, help = 'Direction to export the spectrogram and the .txt files',required=True) parser.add_argument('-d','--direction', type=str, help = 'Directory to wich spectrograms and .txt files will be stored',required=True)
parser.add_argument('-m','--mode',type=str,choices=['uniform','personalized'],help = 'Choose the mode to calculate the y and height value',required=True) parser.add_argument('-m','--mode',type=str,choices=['uniform','personalized'],help = 'Choose the mode to calculate the y and height value',required=True)
parser.add_argument('--export',type=str, default=None, help='To export the position of the bounding box on the spectrogram',required=False) parser.add_argument('--export',type=str, default=None, help='To export the position of the bounding box on the spectrogram',required=False)
args = parser.parse_args() args = parser.parse_args()
......
...@@ -7,18 +7,17 @@ import shutil ...@@ -7,18 +7,17 @@ import shutil
import argparse import argparse
import ipdb import ipdb
parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter, description='RATIO') parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter, description='TODO')
parser.add_argument('-r','--ratio', type=float, default=0.7,help = 'Train Ratio (val = 1 - ratio)') parser.add_argument('-r','--ratio', type=float, default=0.7,help = 'Train Ratio (val = 1 - ratio)')
parser.add_argument('-p','--path_to_data', type=str, help = 'Path of the folder that contain the .txt (ending with labels/)',required=True) parser.add_argument('-p','--path_to_data', type=str, help = 'Path of the folder that contain the .txt (ending with labels/)',required=True)
parser.add_argument('-d','--direction', type=str, help = 'Direction of the folder to export the spectrogram and the .txt files (different from -p)',required=True) parser.add_argument('-d','--direction', type=str, help = 'Directory to wich spectrogram and the .txt files will be stored (different from -p)',required=True)
args = parser.parse_args() args = parser.parse_args()
path = str(args.path_to_data) path = str(args.path_to_data)
direction = str(args.direction) direction = str(args.direction)
files = os.listdir(path)
files = pd.DataFrame(files, columns = ['file']) files = pd.DataFrame(os.listdir(path), columns = ['file'])
df = pd.DataFrame(columns = ['file','espece','x','y','w','h',]) df = pd.DataFrame(columns = ['file','espece','x','y','w','h',])
for i in tqdm(os.listdir(path)): for i in tqdm(os.listdir(path)):
...@@ -97,12 +96,12 @@ if not isExist: ...@@ -97,12 +96,12 @@ if not isExist:
os.mkdir(str(direction+'labels/val')) os.mkdir(str(direction+'labels/val'))
for i,row in tqdm(val.iterrows(), total=val.shape[0]): for i,row in tqdm(val.iterrows(), total=val.shape[0]):
# if len(row.file)>15:
shutil.copy2(str(path+row.file+'.txt'),str(direction+'labels/val/'+row.file+'.txt')) shutil.copy2(str(path+row.file+'.txt'),str(direction+'labels/val/'+row.file+'.txt'))
shutil.copy2(str(path+'../images/all/'+row.file+'.jpg'),str(direction+'images/val/'+row.file+'.jpg')) shutil.copy2(str(path+'../images/all/'+row.file+'.jpg'),str(direction+'images/val/'+row.file+'.jpg'))
for i,row in tqdm(train.iterrows(), total=train.shape[0]): for i,row in tqdm(train.iterrows(), total=train.shape[0]):
# if len(row.file)>15:
shutil.copy2(str(path+row.file+'.txt'),str(direction+'labels/train/'+row.file+'.txt')) shutil.copy2(str(path+row.file+'.txt'),str(direction+'labels/train/'+row.file+'.txt'))
shutil.copy2(str(path+'../images/all/'+row.file+'.jpg'),str(direction+'images/train/'+row.file+'.jpg')) shutil.copy2(str(path+'../images/all/'+row.file+'.jpg'),str(direction+'images/train/'+row.file+'.jpg'))
......
...@@ -7,7 +7,7 @@ from datetime import date ...@@ -7,7 +7,7 @@ from datetime import date
parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter, description='TODO') parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter, description='TODO')
parser.add_argument('-p','--path_to_data', type=str, help = 'Path of the folder that contain the recodings',required=True) parser.add_argument('-p','--path_to_data', type=str, help = 'Path of the folder that contain the recodings',required=True)
parser.add_argument('-d','--direction', type=str, help = 'Direction to export the spectrogram and the .txt files',required=True) parser.add_argument('-d','--direction', type=str, help = 'Directory to wich spectrogram and .txt files will be stored',required=True)
args = parser.parse_args() args = parser.parse_args()
annots = str(args.path_to_detection) annots = str(args.path_to_detection)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment