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

correction

parent e39c1565
Branches
Tags
No related merge requests found
...@@ -105,6 +105,8 @@ def process(entry, arguments, species_list): ...@@ -105,6 +105,8 @@ def process(entry, arguments, species_list):
for specie_num in species_list[species_list.columns[0]]: for specie_num in species_list[species_list.columns[0]]:
utils.create_directory(os.path.join( utils.create_directory(os.path.join(
arguments.directory, 'images', str(specie_num))) arguments.directory, 'images', str(specie_num)))
utils.create_directory(os.path.join(
arguments.directory, 'annotated_images', str(specie_num)))
# Save the images and annotation # Save the images and annotation
plt.savefig(os.path.join(arguments.directory, plt.savefig(os.path.join(arguments.directory,
'images', 'images',
...@@ -233,7 +235,7 @@ if __name__ == '__main__': ...@@ -233,7 +235,7 @@ if __name__ == '__main__':
# Get the current path to find the split script # Get the current path to find the split script
script = os.path.join(path, 'get_train_val.py') script = os.path.join(path, 'get_train_val.py')
data_path = os.path.join(path, args.directory, 'labels') data_path = os.path.join(path, args.directory, 'labels')
directory_path = os.path.join(path, args.directory, 'set') directory_path = os.path.join(path, args.directory)
# Create the directory path if not exists # Create the directory path if not exists
utils.create_directory(directory_path) utils.create_directory(directory_path)
try: try:
......
...@@ -60,8 +60,7 @@ def export_split(argument, entry, path, directory): ...@@ -60,8 +60,7 @@ def export_split(argument, entry, path, directory):
f.write(f'train: {os.path.join(directory, "images/train")}\n') f.write(f'train: {os.path.join(directory, "images/train")}\n')
f.write(f'val: {os.path.join(directory, "images/val")}\n') f.write(f'val: {os.path.join(directory, "images/val")}\n')
f.write(f'nc: {len(species_list)}\n') f.write(f'nc: {len(species_list)}\n')
f.write(f'names: {species_list.species.tolist()}') f.write(f'names: {[str(x) for x in species_list.species.tolist()]}')
def prepare_data(arguments): def prepare_data(arguments):
""" """
...@@ -115,7 +114,6 @@ if __name__ == '__main__': ...@@ -115,7 +114,6 @@ if __name__ == '__main__':
current_path = os.getcwd() current_path = os.getcwd()
directory_path = os.path.join(current_path, args.directory, 'set') directory_path = os.path.join(current_path, args.directory, 'set')
yolo_path = os.path.join(current_path, 'yolov5/train.py') yolo_path = os.path.join(current_path, 'yolov5/train.py')
data_path = os.path.join(directory_path, 'custom_data.yaml') data_path = os.path.join(directory_path, 'custom_data.yaml')
weights_path = os.path.join(current_path, 'yolov5/weights/yolov5l.pt') weights_path = os.path.join(current_path, 'yolov5/weights/yolov5l.pt')
......
...@@ -343,6 +343,7 @@ def prepare_dataframe(df, args): ...@@ -343,6 +343,7 @@ def prepare_dataframe(df, args):
species_list = df.groupby('species').size().sort_values( species_list = df.groupby('species').size().sort_values(
ascending=False).reset_index() ascending=False).reset_index()
species_list.columns = ['specie', 'number']
df['d_annot'] = df.stop - df.start df['d_annot'] = df.stop - df.start
df['midl'] = (df.stop + df.start) / 2 df['midl'] = (df.stop + df.start) / 2
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment