From eb91478a5e0ecc1c860b5ff3979b7911d1bed5eb Mon Sep 17 00:00:00 2001 From: chongyangbai Date: Tue, 20 Aug 2024 21:53:03 +0000 Subject: [PATCH] fix format --- vision_datasets/image_classification/coco_manifest_adaptor.py | 2 +- vision_datasets/key_value_pair/manifest.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/vision_datasets/image_classification/coco_manifest_adaptor.py b/vision_datasets/image_classification/coco_manifest_adaptor.py index 55e80ae..d8f4632 100644 --- a/vision_datasets/image_classification/coco_manifest_adaptor.py +++ b/vision_datasets/image_classification/coco_manifest_adaptor.py @@ -12,7 +12,7 @@ class MultiClassClassificationCocoManifestAdaptor(CocoManifestWithCategoriesAdap def process_label(self, image: ImageDataManifest, annotation, coco_manifest, label_id_to_pos): if len(image.labels) != 0: - raise ValueError(f"image with id {annotation['image_id']} will possess unexpected number of annotations {len(image.labels) + 1} for {DatasetTypes.IMAGE_CLASSIFICATION_MULTICLASS} dataset") + raise ValueError(f"image with id {annotation['image_id']} will possess unexpected number of annotations {len(image.labels) + 1} for {DatasetTypes.IMAGE_CLASSIFICATION_MULTICLASS} dataset.") label = ImageClassificationLabelManifest(label_id_to_pos[annotation['category_id']], additional_info=self._get_additional_info(annotation, {'id', 'image_id', 'category_id'})) image.labels.append(label) diff --git a/vision_datasets/key_value_pair/manifest.py b/vision_datasets/key_value_pair/manifest.py index 44c40aa..460e74a 100644 --- a/vision_datasets/key_value_pair/manifest.py +++ b/vision_datasets/key_value_pair/manifest.py @@ -1,4 +1,4 @@ -from typing import Dict, List, Optional +from typing import Dict, List, Optional, Union from enum import Enum from ..common import MultiImageLabelManifest, DatasetManifestWithMultiImageLabel, DatasetTypes @@ -44,7 +44,7 @@ class KeyValuePairFieldSchema: def __init__(self, type: str, description: str = None, examples: List[str] = None, - classes: Dict[str | int | float, KeyValuePairClassSchema] = None, + classes: Dict[Union[str, int, float], KeyValuePairClassSchema] = None, items: 'KeyValuePairFieldSchema' = None, properties: Dict[str, 'KeyValuePairFieldSchema'] = None, includeGrounding: bool = False) -> None: