未验证 提交 9f7d1815 编写于 作者: A Anastasia Yasakova 提交者: GitHub

Support for WiderFace dataset format (#2864)

* Add support for WiderFace dataset format

* Add WiderFace to documentation

* update format docs

* Fix format descriptions

* Update Changelog

* Update Datumaro version

* Update Datumaro version to 0.1.6.1

* fix linter

* fix base.txt

* fix Changelog

* fix README
Co-authored-by: NMaxim Zhiltsov <maxim.zhiltsov@intel.com>
上级 9fd4c035
......@@ -20,6 +20,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Pre-built [cvat_server](https://hub.docker.com/r/openvino/cvat_server) and
[cvat_ui](https://hub.docker.com/r/openvino/cvat_ui) images were published on DockerHub (<https://github.com/openvinotoolkit/cvat/pull/2766>)
- Project task subsets (<https://github.com/openvinotoolkit/cvat/pull/2774>)
- [WiderFace](http://shuoyang1213.me/WIDERFACE/) format support (<https://github.com/openvinotoolkit/cvat/pull/2864>)
- [VGGFace2](https://github.com/ox-vgg/vgg_face2) format support (<https://github.com/openvinotoolkit/cvat/pull/2865>)
### Changed
......
......@@ -62,6 +62,7 @@ For more information about supported formats look at the
| [LabelMe 3.0](http://labelme.csail.mit.edu/Release3.0) | X | X |
| [ImageNet](http://www.image-net.org) | X | X |
| [CamVid](http://mi.eng.cam.ac.uk/research/projects/VideoRec/CamVid/) | X | X |
| [WIDER Face](http://shuoyang1213.me/WIDERFACE/) | X | X |
| [VGGFace2](https://github.com/ox-vgg/vgg_face2) | X | X |
## Deep learning serverless functions for automatic labeling
......
......@@ -20,6 +20,7 @@
- [TF detection API](#tfrecord)
- [ImageNet](#imagenet)
- [CamVid](#camvid)
- [WIDER Face](#widerface)
- [VGGFace2](#vggface2)
## How to add a new annotation format support<a id="how-to-add"></a>
......@@ -876,6 +877,36 @@ Uploaded file: a zip archive of the structure above
- supported annotations: Polygons
### [WIDER Face](http://shuoyang1213.me/WIDERFACE/)<a id="widerface" />
#### WIDER Face Dumper
Downloaded file: a zip archive of the following structure:
```bash
taskname.zip/
├── labels.txt # optional
├── wider_face_split/
│ └── wider_face_<any_subset_name>_bbx_gt.txt
└── WIDER_<any_subset_name>/
└── images/
├── 0--label0/
│ └── 0_label0_image1.jpg
└── 1--label1/
└── 1_label1_image2.jpg
```
- supported annotations: Rectangles (with attributes), Labels
- supported attributes: `blur`, `expression`, `illumination`,
`occluded` (both the annotation property & an attribute), `pose`, `invalid`
#### WIDER Face Loader
Uploaded file: a zip archive of the structure above
- supported annotations: Rectangles (with attributes), Labels
- supported attributes: `blur`, `expression`, `illumination`, `occluded`, `pose`, `invalid`
### [VGGFace2](https://github.com/ox-vgg/vgg_face2)<a id="vggface2" />
#### VGGFace2 Dumper
......
......@@ -95,4 +95,5 @@ import cvat.apps.dataset_manager.formats.tfrecord
import cvat.apps.dataset_manager.formats.yolo
import cvat.apps.dataset_manager.formats.imagenet
import cvat.apps.dataset_manager.formats.camvid
import cvat.apps.dataset_manager.formats.widerface
import cvat.apps.dataset_manager.formats.vggface2
# Copyright (C) 2021 Intel Corporation
#
# SPDX-License-Identifier: MIT
import zipfile
from tempfile import TemporaryDirectory
from datumaro.components.dataset import Dataset
from cvat.apps.dataset_manager.bindings import CvatTaskDataExtractor, \
import_dm_annotations
from cvat.apps.dataset_manager.util import make_zip_archive
from .registry import dm_env, exporter, importer
@exporter(name='WiderFace', ext='ZIP', version='1.0')
def _export(dst_file, task_data, save_images=False):
dataset = Dataset.from_extractors(CvatTaskDataExtractor(
task_data, include_images=save_images), env=dm_env)
with TemporaryDirectory() as temp_dir:
dataset.export(temp_dir, 'wider_face', save_images=save_images)
make_zip_archive(temp_dir, dst_file)
@importer(name='WiderFace', ext='ZIP', version='1.0')
def _import(src_file, task_data):
with TemporaryDirectory() as tmp_dir:
zipfile.ZipFile(src_file).extractall(tmp_dir)
dataset = Dataset.import_from(tmp_dir, 'wider_face', env=dm_env)
import_dm_annotations(dataset, task_data)
......@@ -282,6 +282,7 @@ class TaskExportTest(_DbTestBase):
'YOLO 1.1',
'ImageNet 1.0',
'CamVid 1.0',
'WiderFace 1.0',
'VGGFace2 1.0',
})
......@@ -301,6 +302,7 @@ class TaskExportTest(_DbTestBase):
'YOLO 1.1',
'ImageNet 1.0',
'CamVid 1.0',
'WiderFace 1.0',
'VGGFace2 1.0',
})
......@@ -342,6 +344,7 @@ class TaskExportTest(_DbTestBase):
('YOLO 1.1', 'yolo'),
('ImageNet 1.0', 'imagenet_txt'),
('CamVid 1.0', 'camvid'),
('WiderFace 1.0', 'wider_face'),
('VGGFace2 1.0', 'vgg_face2'),
]:
with self.subTest(format=format_name):
......
......@@ -2595,6 +2595,32 @@ class JobAnnotationAPITestCase(APITestCase):
]
},
{"name": "person"},
{
"name": "widerface",
"attributes": [
{
"name": "blur",
"mutable": False,
"input_type": "select",
"default_value": "0",
"values": ["0", "1", "2"]
},
{
"name": "expression",
"mutable": False,
"input_type": "select",
"default_value": "0",
"values": ["0", "1"]
},
{
"name": "illumination",
"mutable": False,
"input_type": "select",
"default_value": "0",
"values": ["0", "1"]
},
]
},
]
}
......@@ -3716,6 +3742,30 @@ class TaskAnnotationAPITestCase(JobAnnotationAPITestCase):
"occluded": False,
}]
rectangle_shapes_with_wider_attrs = [{
"frame": 0,
"label_id": task["labels"][2]["id"],
"group": 0,
"source": "manual",
"attributes": [
{
"spec_id": task["labels"][2]["attributes"][0]["id"],
"value": task["labels"][2]["attributes"][0]["default_value"]
},
{
"spec_id": task["labels"][2]["attributes"][1]["id"],
"value": task["labels"][2]["attributes"][1]["values"][1]
},
{
"spec_id": task["labels"][2]["attributes"][2]["id"],
"value": task["labels"][2]["attributes"][2]["default_value"]
}
],
"points": [1.0, 2.1, 10.6, 53.22],
"type": "rectangle",
"occluded": False,
}]
rectangle_shapes_wo_attrs = [{
"frame": 1,
"label_id": task["labels"][1]["id"],
......@@ -3864,6 +3914,10 @@ class TaskAnnotationAPITestCase(JobAnnotationAPITestCase):
annotations["shapes"] = rectangle_shapes_wo_attrs \
+ polygon_shapes_wo_attrs
elif annotation_format == "WiderFace 1.0":
annotations["tags"] = tags_wo_attrs
annotations["shapes"] = rectangle_shapes_with_wider_attrs
elif annotation_format == "VGGFace2 1.0":
annotations["tags"] = tags_wo_attrs
annotations["shapes"] = points_wo_attrs \
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册