-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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: Maxim Zhiltsov <[email protected]>
- Loading branch information
1 parent
9fd4c03
commit 9f7d181
Showing
7 changed files
with
124 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# 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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters