Skip to content

Commit 9dae78f

Browse files
Fix reading, writing anno file and saving name of the subset for test subset (open-edge-platform#447)
* fix widerface for test subset * update Changelog
1 parent 698a82b commit 9dae78f

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7171
- Calling `ProjectDataset.transform()` with a string argument (<https://github.com/openvinotoolkit/datumaro/issues/402>)
7272
- Attributes casting for CVAT format (<https://github.com/openvinotoolkit/datumaro/pull/403>)
7373
- Loading of custom project plugins (<https://github.com/openvinotoolkit/datumaro/issues/404>)
74+
- Reading, writing anno file and saving name of the subset for test subset
75+
(<https://github.com/openvinotoolkit/datumaro/pull/447>)
7476

7577
### Security
7678
- Fixed unsafe unpickling in CIFAR import (<https://github.com/openvinotoolkit/datumaro/pull/362>)

datumaro/plugins/widerface_format.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def __init__(self, path, subset=None):
3434

3535
if not subset:
3636
subset = osp.splitext(osp.basename(path))[0]
37-
if re.fullmatch(r'wider_face_\S+_bbx_gt', subset):
37+
if re.fullmatch(r'wider_face_\S+((_bbx_gt)|(_filelist))', subset):
3838
subset = subset.split('_')[2]
3939
super().__init__(subset=subset)
4040

@@ -100,8 +100,10 @@ def _load_items(self, path):
100100
image=image_path, annotations=annotations)
101101

102102
try:
103-
bbox_count = int(lines[line_idx + 1]) # can be the next image
104-
except ValueError:
103+
bbox_count = int(lines[line_idx + 1])
104+
except ValueError: # can be the next image
105+
continue
106+
except IndexError: # the file can only contain names of images
105107
continue
106108

107109
bbox_lines = lines[line_idx + 2 : line_idx + bbox_count + 2]
@@ -176,7 +178,8 @@ def apply(self):
176178

177179
bboxes = [a for a in item.annotations
178180
if a.type == AnnotationType.bbox]
179-
wider_annotation += '%s\n' % len(bboxes)
181+
if 0 < len(bboxes):
182+
wider_annotation += '%s\n' % len(bboxes)
180183
for bbox in bboxes:
181184
wider_bb = ' '.join('%s' % p for p in bbox.get_bbox())
182185
wider_annotation += '%s ' % wider_bb

0 commit comments

Comments
 (0)