Skip to content

Commit

Permalink
Add tfds:uc_merced and tfds:eurosat download (#914)
Browse files Browse the repository at this point in the history
- Ticket no. 107273
- Add tfds:uc_merced and tfds:eurosat download
- These datasets will be used for the merge tutorial

Signed-off-by: Kim, Vinnam <vinnam.kim@intel.com>
  • Loading branch information
vinnamkim authored Apr 7, 2023
1 parent edfd106 commit 8cf70ba
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
(<https://github.com/openvinotoolkit/datumaro/pull/909>)
- Refactor CLI commands w/ and w/o project
(<https://github.com/openvinotoolkit/datumaro/pull/910>)
- Add tfds:uc_merced and tfds:eurosat download
(<https://github.com/openvinotoolkit/datumaro/pull/914>)

### Bug fixes
- Add UserWarning if an invalid media_type comes to image statistics computation
Expand Down
29 changes: 28 additions & 1 deletion datumaro/components/extractor_tfds.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2021-2022 Intel Corporation
# Copyright (C) 2021-2023 Intel Corporation
#
# SPDX-License-Identifier: MIT

Expand Down Expand Up @@ -313,6 +313,31 @@ def __call__(self, tfds_example: Any) -> str:
),
)

_EUROSAT_ADAPTER = _TfdsAdapter(
category_transformers=[_SetLabelCategoriesFromClassLabelFeature("label")],
data_transformers=[
_SetImageFromImageFeature("image"),
_AddLabelFromClassLabelFeature("label"),
],
id_generator=_GenerateIdFromFilenameFeature("filename"),
metadata=TfdsDatasetMetadata(
human_name="EuroSAT", default_output_format="imagenet_txt", media_type=Image
),
)


_UC_MERCED_ADAPTER = _TfdsAdapter(
category_transformers=[_SetLabelCategoriesFromClassLabelFeature("label")],
data_transformers=[
_SetImageFromImageFeature("image"),
_AddLabelFromClassLabelFeature("label"),
],
id_generator=_GenerateIdFromFilenameFeature("filename"),
metadata=TfdsDatasetMetadata(
human_name="UCMerced", default_output_format="imagenet_txt", media_type=Image
),
)


def _voc_save_pose_names(
tfds_builder: tfds.core.DatasetBuilder,
Expand Down Expand Up @@ -369,6 +394,8 @@ def _evolve_adapter_meta(adapter: _TfdsAdapter, **kwargs):
"imagenet_v2": _evolve_adapter_meta(_IMAGENET_ADAPTER, human_name="ImageNetV2"),
"mnist": _MNIST_ADAPTER,
"voc/2012": _evolve_adapter_meta(_VOC_ADAPTER, human_name="PASCAL VOC 2012"),
"eurosat": _evolve_adapter_meta(_EUROSAT_ADAPTER, human_name="EuroSAT"),
"uc_merced": _evolve_adapter_meta(_UC_MERCED_ADAPTER, human_name="UCMerced"),
}

# Assign the TFDS catalog page as the documentation URL for all datasets.
Expand Down

0 comments on commit 8cf70ba

Please sign in to comment.