From 8c7bbc52852373ee96f858a537fd75fd0f915ada Mon Sep 17 00:00:00 2001 From: Anastasia Yasakova Date: Mon, 17 May 2021 11:59:34 +0300 Subject: [PATCH] Fixes in CIFAR dataset format (#243) * Add folder creation * Update changelog --- CHANGELOG.md | 2 +- datumaro/plugins/cifar_format.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3e189f7b7294..6a6900aa8e5f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,7 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - Support for escaping in attribiute values in LabelMe format () - Support for Segmentation Splitting () -- Support for CIFAR-10/100 dataset format () +- Support for CIFAR-10/100 dataset format (, ) - Support COCO panoptic and stuff format () - Documentation file and integration tests for Pascal VOC format () - Support for MNIST and MNIST in CSV dataset formats () diff --git a/datumaro/plugins/cifar_format.py b/datumaro/plugins/cifar_format.py index 2a74ba99c2d2..287f00de8e0f 100644 --- a/datumaro/plugins/cifar_format.py +++ b/datumaro/plugins/cifar_format.py @@ -2,6 +2,7 @@ # # SPDX-License-Identifier: MIT +import os import os.path as osp import pickle @@ -117,8 +118,9 @@ class CifarConverter(Converter): DEFAULT_IMAGE_EXT = '.png' def apply(self): - label_categories = self._extractor.categories()[AnnotationType.label] + os.makedirs(self._save_dir, exist_ok=True) + label_categories = self._extractor.categories()[AnnotationType.label] label_names = [] for label in label_categories: label_names.append(label.name)