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

Cloudina tut 9 issue with processing detections: #372

Closed Bergylta closed 3 months ago

Bergylta commented 4 months ago

πŸ› Bug

Seems to be something going on with the processing of detections

To Reproduce (REQUIRED)

Project: KSO Model: KSO_alotment_model2 Movie: 01747002 Thresh: 0.2 Input:

dets_df = t_utils.process_detections(
    project=pp.project,
    db_connection=pp.db_connection,
    csv_paths=pp.csv_paths,
    annotations_csv_path=mlp.eval_dir,
    movies_selected_id=pp.movies_selected_id,
    model_registry=mlp.registry,
    model=model.value,
    team_name=mlp.team_name,
    project_name=mlp.project_name,
    source_movies=pp.movies_paths,
)

Output:

---------------------------------------------------------------------------
error                                     Traceback (most recent call last)
Cell In[17], line 1
----> 1 dets_df = t_utils.process_detections(
      2     project=pp.project,
      3     db_connection=pp.db_connection,
      4     csv_paths=pp.csv_paths,
      5     annotations_csv_path=mlp.eval_dir,
      6     movies_selected_id=pp.movies_selected_id,
      7     model_registry=mlp.registry,
      8     model=model.value,
      9     team_name=mlp.team_name,
     10     project_name=mlp.project_name,
     11     source_movies=pp.movies_paths,
     12 )

File ~/kso/kso_utils/tutorials_utils.py:1652, in process_detections(project, db_connection, csv_paths, annotations_csv_path, model_registry, movies_selected_id, model, project_name, team_name, source_movies)
   1649 # Set the fps information for movies without info in the sql db
   1650 if "fps" not in df.columns:
   1651     # Get the fps of the movie
-> 1652     df["fps"], _ = movie_utils.get_fps_duration(movie_path=source_movies)
   1654     # Set the movie id to 0
   1655     df["movie_id"] = 0

File ~/kso/kso_utils/movie_utils.py:45, in get_fps_duration(movie_path)
     38 def get_fps_duration(movie_path: str):
     39     """
     40     This function takes the path (or url) of a movie and returns its fps and duration information
     41 
     42     :param movie_path: a string containing the path (or url) where the movie of interest can be access from
     43     :return: Two integers, the fps and duration of the movie
     44     """
---> 45     cap = cv2.VideoCapture(movie_path)
     46     fps = cap.get(cv2.CAP_PROP_FPS)
     47     frame_count = int(cap.get(cv2.CAP_PROP_FRAME_COUNT))

error: OpenCV(4.7.0) :-1: error: (-5:Bad argument) in function 'VideoCapture'
> Overload resolution failed:
>  - Can't convert object of type 'list' to 'str' for 'filename'
>  - VideoCapture() missing required argument 'apiPreference' (pos 2)
>  - Argument 'index' is required to be an integer
>  - VideoCapture() missing required argument 'apiPreference' (pos 2)

Expected behavior

A clear and concise description of what you expected to happen.

Environment

If applicable, add screenshots to help explain your problem.

Additional context

Add any other context about the problem here.

victor-wildlife commented 3 months ago

I tried to replicate the error but couldn't download the artifact

Image

jannesgg commented 3 months ago

@Bergylta @victor-wildlife This seems to be a larger issue related to the MLFlow API. We are currently investigating this to find a potential solution.

jannesgg commented 3 months ago

@victor-wildlife @Bergylta Please retry this as the MLFlow API issue should now be fixed.

jannesgg commented 3 months ago

Closing this as issues have been separated.