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

Issue in Tutorial 8, Running the preparation script for ML training #301

Closed Bergylta closed 8 months ago

Bergylta commented 8 months ago

🐛 Bug

Running the preparation script for the marine allotment workflow (frames) seems to be not working as intended and comes up with an error message

To Reproduce (REQUIRED)

Project: KSO Workflow: KSO_Tagging_species_COOLBLUE (#25332) Test proportion: 0,2 Input:

# Run the preparation script
mlp.prepare_dataset(
    agg_df=pp.aggregated_zoo_classifications,
    out_path=output_folder.selected,
    img_size=(720, 540),
    perc_test=percentage_test.value,
)

Output:

ImportError                               Traceback (most recent call last)
File /usr/src/app/kso-dev/kso_utils/project.py:1137, in MLProjectProcessor.prepare_dataset.<locals>.on_button_clicked(b)
   1135 self.species_of_interest = species_list.value
   1136 # code for prepare dataset for machine learning
-> 1137 self.modules["yolo_utils"].frame_aggregation(
   1138     project=self.project,
   1139     server_connection=self.server_connection,
   1140     db_connection=self.db_connection,
   1141     out_path=out_path,
   1142     perc_test=perc_test,
   1143     class_list=self.species_of_interest,
   1144     img_size=img_size,
   1145     remove_nulls=remove_nulls,
   1146     track_frames=track_frames,
   1147     n_tracked_frames=n_tracked_frames,
   1148     agg_df=agg_df,
   1149 )

File /usr/src/app/kso-dev/kso_utils/yolo_utils.py:549, 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)
    547 for i in tqdm(train_rows["movie_path"].unique()):
    548     try:
--> 549         video_dict[i] = pims.MoviePyReader(i)
    550     except FileNotFoundError:
    551         try:

File /usr/local/lib/python3.8/dist-packages/pims/api.py:24, in not_available.<locals>.raiser(*args, **kwargs)
     23 def raiser(*args, **kwargs):
---> 24     raise ImportError(
     25         "This reader requires {0}.".format(requirement))

ImportError: This reader requires MoviePy.

Expected behavior

Script was working well yesterday with another workflow in the same project

Additional context

Could it be a thing with the fpath of the movies? i also get this when running image