@@ -107,10 +107,10 @@ def _map_annotations_to_images_1tomany(images, annotations):
107107
108108 for directory , annotation_files in annotationsByDirname .items ():
109109 parsed_data = annotation_files [0 ]["parsed" ]
110- parsed_type = annotation_files [0 ][' parsedType' ]
110+ parsed_type = annotation_files [0 ][" parsedType" ]
111111
112112 # Process only if the format is COCO
113- if parsed_type == ' coco' :
113+ if parsed_type == " coco" :
114114 for image_info in parsed_data ["images" ]:
115115 imageByFilename [image_info ["file_name" ]] = image_info
116116
@@ -119,7 +119,6 @@ def _map_annotations_to_images_1tomany(images, annotations):
119119 key = f"{ directory } /{ annotation ['image_id' ]} "
120120 annotationByDirectoryImageId [key ].append (annotation )
121121
122-
123122 for image in tqdm (images , unit = "percentage" ):
124123 dirname = image ["dirname" ]
125124 annotationsInSameDir = annotationsByDirname .get (dirname , [])
@@ -128,7 +127,9 @@ def _map_annotations_to_images_1tomany(images, annotations):
128127 print (f"warning: found multiple annotation files on dir { dirname } " )
129128 annotation = annotationsInSameDir [0 ]
130129 format = annotation ["parsedType" ]
131- image ["annotationfile" ] = _filterIndividualAnnotations (image , annotation , format , imageByFilename , annotationByDirectoryImageId )
130+ image ["annotationfile" ] = _filterIndividualAnnotations (
131+ image , annotation , format , imageByFilename , annotationByDirectoryImageId
132+ )
132133
133134
134135def _filterIndividualAnnotations (image , annotation , format , img_dict , anno_dict ):
@@ -260,8 +261,8 @@ def _decide_split(images):
260261 i ["split" ] = "train"
261262
262263
263- def _list_map (l , key ):
264+ def _list_map (my_list , key ):
264265 d = {}
265- for i in l :
266+ for i in my_list :
266267 d .setdefault (i [key ], []).append (i )
267268 return d
0 commit comments