Skip to content

Commit 7185709

Browse files
zhiltsov-maxNikita Manovich
authored and
Nikita Manovich
committed
[Datumaro] Fix frame matching in video annotations import (#1274)
* Add extra frame matching way for videos * Add line to changelog
1 parent d9fc48f commit 7185709

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

CHANGELOG.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1111
clashing ([#1275](https://github.com/opencv/cvat/issues/1275))
1212

1313
### Fixed
14-
-
14+
- Frame name matching for video annotations import -
15+
allowed `frame_XXXXXX[.ext]` format ([#1274](https://github.com/opencv/cvat/pull/1274))
1516

1617
### Security
1718
- 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

+4
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

+3-1
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)