-
Notifications
You must be signed in to change notification settings - Fork 29
Add MOT and CVAT video annotation import/export support #678
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
4b1bbaa
Add COCO annotation import/export support
deanp70 14350c4
Add MOT and CVAT video annotation import/export support
deanp70 a5f6644
Merge branch 'main' into mot_cvat_video_converter
deanp70 79f15b0
Merge branch 'main' into coco_converter
deanp70 4b08cb2
rename classes according to dagshub-annotation-converter refactor
deanp70 3096e28
update client to refactor of dagshub-annotation-converter for video c…
deanp70 6c68a98
deslopped code slightly
deanp70 e68048a
Test: use the coco_converter branch of the annotation converter while…
kbolashev 4f830e4
Fix review comments
deanp70 6a5a201
initial update to latest converter version
deanp70 30ac943
update client to latest converter version
deanp70 924c718
fix linting
deanp70 ad1c465
temporarily pin converter version for tests to pass
deanp70 7a76372
fix review comments
deanp70 eb2c643
Update setup.py
deanp70 f3eb3a7
Update setup.py
deanp70 9fc5cd4
fix build_video_sequence_from_annotations
deanp70 5be1f0f
fixing review comments
deanp70 3ddb0ea
finish fixing importer comments
deanp70 9935720
fix metadata review comment
deanp70 51c6d21
finish queryresult review comment
deanp70 fbd1cb1
finalize review comments
deanp70 fd9a103
fix tests
deanp70 bb75f40
remove redundant function
deanp70 38f76fa
fix last comment and bump converter
deanp70 15289ed
bump converter version
deanp70 f46169c
Merge branch 'coco_converter' into mot_cvat_video_converter
deanp70 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| from collections import defaultdict | ||
| from typing import Optional, Sequence | ||
|
|
||
| from dagshub_annotation_converter.ir.video import ( | ||
| IRVideoFrameAnnotationBase, | ||
| IRVideoAnnotationTrack, | ||
| IRVideoSequence, | ||
| ) | ||
|
|
||
|
|
||
| def build_video_sequence_from_annotations( | ||
| annotations: Sequence[IRVideoFrameAnnotationBase], | ||
| filename: Optional[str] = None, | ||
| ) -> IRVideoSequence: | ||
| # Pre-group annotations into tracks (required by new from_annotations API) | ||
| by_track: dict[str, list[IRVideoFrameAnnotationBase]] = defaultdict(list) | ||
| for ann in annotations: | ||
| object_id = ann.imported_id | ||
| if object_id is None: | ||
| raise ValueError("Video annotation is missing an object identifier") | ||
| by_track[object_id].append(ann) | ||
|
|
||
| tracks = [ | ||
| IRVideoAnnotationTrack.from_annotations(anns, object_id=str(tid)) | ||
| for tid, anns in by_track.items() | ||
| ] | ||
|
|
||
| sequence = IRVideoSequence.from_annotations(tracks=tracks, filename=filename) | ||
|
|
||
| if filename is not None: | ||
| for track in sequence.tracks: | ||
| for ann in track.annotations: | ||
| if ann.filename is None: | ||
| ann.filename = filename | ||
|
|
||
| # resolved_* methods now cache results automatically | ||
| sequence.resolved_video_width() | ||
| sequence.resolved_video_height() | ||
| sequence.resolved_sequence_length() | ||
|
|
||
| return sequence |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.