Skip to content

Commit

Permalink
[PY-605][external]Added support for folder structures when importing …
Browse files Browse the repository at this point in the history
…CSV video tags (#724)

* Added support for foldre structures when importing CSV tags

* Tolerance for user-entered filepaths beginning with a forwardslash

* Change to use Pathlib

* Formatting

* Update darwin/importer/formats/csv_tags_video.py

Co-authored-by: saurbhc <[email protected]>

---------

Co-authored-by: saurbhc <[email protected]>
  • Loading branch information
JBWilkie and saurbhc authored Dec 6, 2023
1 parent de76996 commit 9967a56
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions darwin/importer/formats/csv_tags_video.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,22 @@ def parse_path(path: Path) -> Optional[List[dt.AnnotationFile]]:
file_annotation_map[filename].append(annotation)
for filename in file_annotation_map:
annotations = file_annotation_map[filename]
annotation_classes = {annotation.annotation_class for annotation in annotations}
annotation_classes = set(
annotation.annotation_class for annotation in annotations
)
filename_path = Path(filename)
remote_path = str(filename_path.parent)
if not remote_path.startswith("/"):
remote_path = "/" + remote_path
filename = filename_path.name
files.append(
dt.AnnotationFile(
path,
filename,
annotation_classes,
annotations,
is_video=True,
remote_path="/",
remote_path=remote_path,
)
)
return files

0 comments on commit 9967a56

Please sign in to comment.