From ceb0b97468432ca973609f51f55ab8b2db1cf0a0 Mon Sep 17 00:00:00 2001 From: "Kim, Vinnam" Date: Wed, 5 Apr 2023 10:23:58 +0900 Subject: [PATCH 1/2] Add tfds:uc_merced and tfds:eurosat download Signed-off-by: Kim, Vinnam --- datumaro/components/extractor_tfds.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/datumaro/components/extractor_tfds.py b/datumaro/components/extractor_tfds.py index a7fa163ce0..73c2fd4560 100644 --- a/datumaro/components/extractor_tfds.py +++ b/datumaro/components/extractor_tfds.py @@ -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, @@ -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. From 4d0dcba99f27e2effc37694166e4fe57b651aea6 Mon Sep 17 00:00:00 2001 From: "Kim, Vinnam" Date: Wed, 5 Apr 2023 10:27:22 +0900 Subject: [PATCH 2/2] Update CHANGELOG.md Signed-off-by: Kim, Vinnam --- CHANGELOG.md | 2 ++ datumaro/components/extractor_tfds.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index eb716dd2d4..b4f3b52fe7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 () - Refactor merge code (, ) +- Add tfds:uc_merced and tfds:eurosat download + () ### Bug fixes - Add UserWarning if an invalid media_type comes to image statistics computation diff --git a/datumaro/components/extractor_tfds.py b/datumaro/components/extractor_tfds.py index 73c2fd4560..deeb2103d9 100644 --- a/datumaro/components/extractor_tfds.py +++ b/datumaro/components/extractor_tfds.py @@ -1,4 +1,4 @@ -# Copyright (C) 2021-2022 Intel Corporation +# Copyright (C) 2021-2023 Intel Corporation # # SPDX-License-Identifier: MIT