Skip to content
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

Fix import annotations for frames with dots in name #3091

Merged
merged 10 commits into from
Apr 20, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions cvat/apps/dataset_manager/bindings.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from cvat.apps.engine.models import AttributeType, ShapeType
from datumaro.util import cast
from datumaro.util.image import ByteImage, Image
from datumaro.components.extractor import DatasetItem

from .annotation import AnnotationManager, TrackManager

Expand Down Expand Up @@ -611,7 +612,7 @@ def match_dm_item(item, task_data, root_hint=None):
if frame_number is None and item.has_image:
frame_number = task_data.match_frame(item.id + item.image.ext, root_hint)
if frame_number is None:
frame_number = task_data.match_frame(item.id + '.', root_hint)
frame_number = task_data.match_frame(item.id, root_hint)
if frame_number is None:
frame_number = cast(item.attributes.get('frame', item.id), int)
if frame_number is None and is_video:
Expand Down Expand Up @@ -651,7 +652,7 @@ def import_dm_annotations(dm_dataset, task_data):

for item in dm_dataset:
frame_number = task_data.abs_frame_id(
match_dm_item(item, task_data, root_hint=root_hint))
match_dm_item(DatasetItem(id=item.id + '.'), task_data, root_hint=root_hint))
zhiltsov-max marked this conversation as resolved.
Show resolved Hide resolved

# do not store one-item groups
group_map = {0: 0}
Expand Down
4 changes: 2 additions & 2 deletions cvat/apps/dataset_manager/formats/mots.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from tempfile import TemporaryDirectory

from datumaro.components.dataset import Dataset
from datumaro.components.extractor import AnnotationType, Transform
from datumaro.components.extractor import AnnotationType, Transform, DatasetItem
from pyunpack import Archive

from cvat.apps.dataset_manager.bindings import (CvatTaskDataExtractor,
Expand Down Expand Up @@ -48,7 +48,7 @@ def _import(src_file, task_data):

for item in dataset:
frame_number = task_data.abs_frame_id(
match_dm_item(item, task_data, root_hint=root_hint))
match_dm_item(DatasetItem(id=item.id + '.'), task_data, root_hint=root_hint))

for ann in item.annotations:
if ann.type != AnnotationType.polygon:
Expand Down
2 changes: 1 addition & 1 deletion cvat/apps/dataset_manager/formats/yolo.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def _import(src_file, task_data):
for frame in frames:
frame_info = None
try:
frame_id = match_dm_item(DatasetItem(id=frame), task_data,
frame_id = match_dm_item(DatasetItem(id=frame + '.'), task_data,
root_hint=root_hint)
frame_info = task_data.frame_info[frame_id]
except Exception: # nosec
Expand Down