From 355309d83ef783c9cfb4f50e87b67d5b8b1a5cdc Mon Sep 17 00:00:00 2001 From: Zhiltsov Max Date: Mon, 16 Mar 2020 17:29:23 +0300 Subject: [PATCH 1/2] Add extra frame matching way for videos --- cvat/apps/dataset_manager/bindings.py | 4 ++++ datumaro/datumaro/plugins/yolo_format/extractor.py | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/cvat/apps/dataset_manager/bindings.py b/cvat/apps/dataset_manager/bindings.py index da37a3048e65..6b531545c384 100644 --- a/cvat/apps/dataset_manager/bindings.py +++ b/cvat/apps/dataset_manager/bindings.py @@ -177,6 +177,8 @@ def __init__(self, url, db_task, user): def match_frame(item, cvat_task_anno): + is_video = cvat_task_anno.meta['task']['mode'] == 'interpolation' + frame_number = None if frame_number is None: try: @@ -193,6 +195,8 @@ def match_frame(item, cvat_task_anno): frame_number = int(item.id) except Exception: pass + if frame_number is None and is_video and item.id.startswith('frame_'): + frame_number = int(item.id[len('frame_'):]) if not frame_number in cvat_task_anno.frame_info: raise Exception("Could not match item id: '%s' with any task frame" % item.id) diff --git a/datumaro/datumaro/plugins/yolo_format/extractor.py b/datumaro/datumaro/plugins/yolo_format/extractor.py index 7840b26c5ca1..11e829d4a5bd 100644 --- a/datumaro/datumaro/plugins/yolo_format/extractor.py +++ b/datumaro/datumaro/plugins/yolo_format/extractor.py @@ -90,7 +90,9 @@ def __init__(self, config_path, image_info=None): subset = YoloExtractor.Subset(subset_name, self) with open(list_path, 'r') as f: subset.items = OrderedDict( - (osp.splitext(osp.basename(p))[0], p.strip()) for p in f) + (osp.splitext(osp.basename(p.strip()))[0], p.strip()) + for p in f + ) for item_id, image_path in subset.items.items(): image_path = self._make_local_path(image_path) From dc1f923854f4e4b78c591943b3eebcf64946a796 Mon Sep 17 00:00:00 2001 From: Maxim Zhiltsov Date: Tue, 17 Mar 2020 14:40:40 +0300 Subject: [PATCH 2/2] Add line to changelog --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5067f6df5fa4..54ea3fec7a0b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,7 +18,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - ### Fixed -- +- Frame name matching for video annotations import - + allowed `frame_XXXXXX[.ext]` format ([#1274](https://github.com/opencv/cvat/pull/1274)) ### Security -