This commit is contained in:
chongyangbai 2024-08-20 21:53:03 +00:00
Родитель fce17ce68a
Коммит eb91478a5e
2 изменённых файлов: 3 добавлений и 3 удалений

Просмотреть файл

@ -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)

Просмотреть файл

@ -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: