@@ -1795,7 +1795,6 @@ def execute(self):
17951795
17961796
17971797class AssignImagesUseCase (BaseUseCase ):
1798-
17991798 CHUNK_SIZE = 500
18001799
18011800 def __init__ (
@@ -1840,7 +1839,6 @@ def execute(self):
18401839
18411840
18421841class UnAssignImagesUseCase (BaseUseCase ):
1843-
18441842 CHUNK_SIZE = 500
18451843
18461844 def __init__ (
@@ -1867,7 +1865,7 @@ def execute(self):
18671865 )
18681866 if not is_un_assigned :
18691867 self ._response .errors = AppException (
1870- f"Cant un assign { ', ' .join (self ._image_names [i : i + self .CHUNK_SIZE ])} "
1868+ f"Cant un assign { ', ' .join (self ._image_names [i : i + self .CHUNK_SIZE ])} "
18711869 )
18721870
18731871 return self ._response
@@ -2834,7 +2832,6 @@ def execute(self):
28342832
28352833
28362834class CreateAnnotationClassesUseCase (BaseUseCase ):
2837-
28382835 CHUNK_SIZE = 500
28392836
28402837 def __init__ (
@@ -3120,6 +3117,8 @@ def execute(self):
31203117 weight , height = image .get_size ()
31213118 empty_image_arr = np .full ((height , weight , 4 ), [0 , 0 , 0 , 255 ], np .uint8 )
31223119 for annotation in self .annotations ["instances" ]:
3120+ if not class_color_map .get (annotation ["className" ]):
3121+ continue
31233122 fill_color = * class_color_map [annotation ["className" ]], 255
31243123 for part in annotation ["parts" ]:
31253124 part_color = * self .generate_color (part ["color" ]), 255
@@ -3308,13 +3307,32 @@ def annotation_classes_name_map(self) -> dict:
33083307 for attribute_group in annotation_class .attribute_groups :
33093308 attribute_group_data = defaultdict (dict )
33103309 for attribute in attribute_group ["attributes" ]:
3310+ if attribute ["name" ] in attribute_group_data .keys ():
3311+ logger .warning (
3312+ f"Duplicate annotation class attribute name { attribute ['name' ]} "
3313+ f" in attribute group { attribute_group ['name' ]} . "
3314+ "Only one of the annotation class attributes will be used. "
3315+ "This will result in errors in annotation upload."
3316+ )
33113317 attribute_group_data [attribute ["name" ]] = attribute ["id" ]
3318+ if attribute_group ["name" ] in class_info .keys ():
3319+ logger .warning (
3320+ f"Duplicate annotation class attribute group name { attribute_group ['name' ]} ."
3321+ " Only one of the annotation class attribute groups will be used."
3322+ " This will result in errors in annotation upload."
3323+ )
33123324 class_info ["attribute_groups" ] = {
33133325 attribute_group ["name" ]: {
33143326 "id" : attribute_group ["id" ],
33153327 "attributes" : attribute_group_data ,
33163328 }
33173329 }
3330+ if annotation_class .name in classes_data .keys ():
3331+ logger .warning (
3332+ f"Duplicate annotation class name { annotation_class .name } ."
3333+ f" Only one of the annotation classes will be used."
3334+ " This will result in errors in annotation upload." ,
3335+ )
33183336 classes_data [annotation_class .name ] = class_info
33193337 return classes_data
33203338
0 commit comments