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 Notebook 9 issue: TypeError when trying to process detections of a longer movie #391
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
Cell In[20], line 1
----> 1 dets_df = pp.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 model_registry=mlp.registry,
7 model=model.value,
8 team_name=mlp.team_name,
9 project_name=mlp.project_name,
10 )
File ~/kso/kso_utils/project.py:1122, in ProjectProcessor.process_detections(self, project, db_connection, csv_paths, annotations_csv_path, model_registry, model, project_name, team_name)
1119 out_list = []
1120 for movie_path in self.selected_movies_paths:
1121 out_list.append(
-> 1122 yolo_utils.process_detections(
1123 project=project,
1124 db_connection=db_connection,
1125 csv_paths=csv_paths,
1126 annotations_csv_path=annotations_csv_path,
1127 model_registry=model_registry,
1128 selected_movies_id=self.selected_movies_ids,
1129 model=model,
1130 project_name=project_name,
1131 team_name=team_name,
1132 source_movies=movie_path,
1133 )
1134 )
1135 df_concat = pd.concat(out_list, axis=1)
1136 return df_concat
File ~/kso/kso_utils/yolo_utils.py:2009, in process_detections(project, db_connection, csv_paths, annotations_csv_path, model_registry, selected_movies_id, model, project_name, team_name, source_movies)
1992 """
1993 > This function computes the given statistics over the detections obtained by a model on different footages for the species of interest,
1994 and saves the results in different csv files.
(...)
2005 :param source_movies: A string with the path to the movies where the model ran inferences from
2006 """
2008 # Read the annotations.csv file
-> 2009 df = pd.read_csv(Path(annotations_csv_path, "annotations.csv"))
2011 # Check if the DataFrame is not empty
2012 if df.empty:
File /opt/tljh/user/lib/python3.10/pathlib.py:960, in Path.__new__(cls, *args, **kwargs)
958 if cls is Path:
959 cls = WindowsPath if os.name == 'nt' else PosixPath
--> 960 self = cls._from_parts(args)
961 if not self._flavour.is_supported:
962 raise NotImplementedError("cannot instantiate %r on your system"
963 % (cls.__name__,))
File /opt/tljh/user/lib/python3.10/pathlib.py:594, in PurePath._from_parts(cls, args)
589 @classmethod
590 def _from_parts(cls, args):
591 # We need to call _parse_args on the instance, so as to get the
592 # right flavour.
593 self = object.__new__(cls)
--> 594 drv, root, parts = self._parse_args(args)
595 self._drv = drv
596 self._root = root
File /opt/tljh/user/lib/python3.10/pathlib.py:578, in PurePath._parse_args(cls, args)
576 parts += a._parts
577 else:
--> 578 a = os.fspath(a)
579 if isinstance(a, str):
580 # Force-cast str subclasses to str (issue #21127)
581 parts.append(str(a))
TypeError: expected str, bytes or os.PathLike object, not FileChooser
Expected behavior
A clear and concise description of what you expected to happen.
Environment
If applicable, add screenshots to help explain your problem.
🐛 Bug
A clear and concise description of what the bug is.
To Reproduce (REQUIRED)
Input: Path:/data/album/kso/More_testing/Testing_GU_ross01_v4/annotations.csv
Output:
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.