Skip to content

Commit 936d305

Browse files
authored
[Datumaro] Fix frame matching in video annotations import (#1274)
* Add extra frame matching way for videos * Add line to changelog
1 parent 55677e0 commit 936d305

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2020
-
2121

2222
### Fixed
23-
-
23+
- Frame name matching for video annotations import -
24+
allowed `frame_XXXXXX[.ext]` format ([#1274](https://github.com/opencv/cvat/pull/1274))
2425

2526
### Security
2627
- Bump acorn from 6.3.0 to 6.4.1 in /cvat-ui ([#1270](https://github.com/opencv/cvat/pull/1270))

cvat/apps/dataset_manager/bindings.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,8 @@ def __init__(self, url, db_task, user):
177177

178178

179179
def match_frame(item, cvat_task_anno):
180+
is_video = cvat_task_anno.meta['task']['mode'] == 'interpolation'
181+
180182
frame_number = None
181183
if frame_number is None:
182184
try:
@@ -193,6 +195,8 @@ def match_frame(item, cvat_task_anno):
193195
frame_number = int(item.id)
194196
except Exception:
195197
pass
198+
if frame_number is None and is_video and item.id.startswith('frame_'):
199+
frame_number = int(item.id[len('frame_'):])
196200
if not frame_number in cvat_task_anno.frame_info:
197201
raise Exception("Could not match item id: '%s' with any task frame" %
198202
item.id)

datumaro/datumaro/plugins/yolo_format/extractor.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,9 @@ def __init__(self, config_path, image_info=None):
9090
subset = YoloExtractor.Subset(subset_name, self)
9191
with open(list_path, 'r') as f:
9292
subset.items = OrderedDict(
93-
(osp.splitext(osp.basename(p))[0], p.strip()) for p in f)
93+
(osp.splitext(osp.basename(p.strip()))[0], p.strip())
94+
for p in f
95+
)
9496

9597
for item_id, image_path in subset.items.items():
9698
image_path = self._make_local_path(image_path)

0 commit comments

Comments
 (0)