-
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 VGGFace2 dataset format (#2865)
* Add support for VGGFace2 dataset format * Add VGGFace2 to documentation * fix format description * Update Datumaro version * fix linter * fix test * fix base.txt Co-authored-by: Zhiltsov Max <[email protected]>
- Loading branch information
1 parent
62cc956
commit 7a2dcff
Showing
6 changed files
with
89 additions
and
3 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
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='VGGFace2', 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, 'vgg_face2', save_images=save_images) | ||
|
||
make_zip_archive(temp_dir, dst_file) | ||
|
||
@importer(name='VGGFace2', 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, 'vgg_face2', 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