ocean-data-factory-sweden / kso

Notebooks to upload/download marine footage, connect to a citizen science project, train machine learning models and publish marine biological observations.
GNU General Public License v3.0
4 stars 12 forks source link

Exporting frames with notebook 8 runs into an Error #406

Closed donkyjohn closed 2 weeks ago

donkyjohn commented 1 month ago

To recreate

extract and aggregate frames from Zooniverse - Saga-frames Under OPTIONAL 1: select output folder /data/album/kso/Benjamin_testing/ Set test proportion to 1 Set out_format to "yolo-seg" set track frames to False Select classes 9 6 2 5 4 1 and click aggregate frames

Output

UnboundLocalError                         Traceback (most recent call last)
File ~/kso/kso_utils/project.py:1418, in MLProjectProcessor.prepare_dataset.<locals>.on_button_clicked(b)
   1416 self.species_of_interest = species_list.value
   1417 # code for prepare dataset for machine learning
-> 1418 self.modules["yolo_utils"].frame_aggregation(
   1419     project=self.project,
   1420     server_connection=self.server_connection,
   1421     db_connection=self.db_connection,
   1422     out_path=out_path,
   1423     perc_test=perc_test,
   1424     class_list=self.species_of_interest,
   1425     img_size=img_size,
   1426     remove_nulls=remove_nulls,
   1427     track_frames=track_frames,
   1428     n_tracked_frames=n_tracked_frames,
   1429     agg_df=agg_df,
   1430     out_format=out_format,
   1431 )

File ~/kso/kso_utils/yolo_utils.py:842, in frame_aggregation(project, server_connection, db_connection, out_path, perc_test, class_list, img_size, out_format, remove_nulls, track_frames, n_tracked_frames, agg_df)
    839             f_group_fields = ["filename"]
    841 if out_format in ["yolo", "yolo-seg"]:
--> 842     col_list = list(full_rows.columns)
    843     fw_pos, fh_pos, speciesid_pos = (
    844         col_list.index("f_w"),
    845         col_list.index("f_h"),
    846         col_list.index("species_id"),
    847     )
    849     if out_format == "yolo":

UnboundLocalError: local variable 'full_rows' referenced before assignment