@@ -112,11 +112,11 @@ def _map_annotations_to_images_1to1(images, annotations):
112112
113113def _map_annotations_to_images_1tomany (images , annotationFiles ):
114114 imgRefMap , annotationMap = _build_image_and_annotation_maps (annotationFiles )
115-
115+
116116 # Build a map from image file paths to annotation files that reference them
117117 # This avoids checking every annotation file for every image (O(n*m) -> O(n+m))
118118 image_path_to_annotation_files = _build_image_to_annotationfile_index (annotationFiles )
119-
119+
120120 for image in tqdm (images ):
121121 # Get candidate annotation files for this image
122122 rel_path = image ["file" ].lstrip ("/" )
@@ -126,12 +126,10 @@ def _map_annotations_to_images_1tomany(images, annotationFiles):
126126 or image_path_to_annotation_files .get (image ["key" ], [])
127127 or annotationFiles # Fallback to all files for non-COCO formats
128128 )
129-
129+
130130 for annotationFile in candidate_annotations :
131131 format = annotationFile ["parsedType" ]
132- filtered_annotations = _filterIndividualAnnotations (
133- image , annotationFile , format , imgRefMap , annotationMap
134- )
132+ filtered_annotations = _filterIndividualAnnotations (image , annotationFile , format , imgRefMap , annotationMap )
135133 if filtered_annotations :
136134 image ["annotationfile" ] = filtered_annotations
137135 break
0 commit comments