-
Notifications
You must be signed in to change notification settings - Fork 101
Flexible annotation/image filename matches #417
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
or image_path_to_annotation_files.get(image["name"], []) | ||
or image_path_to_annotation_files.get(image["key"], []) | ||
or annotationFiles # Fallback to all files for non-COCO formats | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Fallback Annotation Mapping Causes Inefficiency
The _map_annotations_to_images_1tomany
function includes a fallback to annotationFiles
that causes images to be checked against all annotation files if the index yields no specific matches. This can lead to inefficient processing and potentially incorrect annotation assignments, as images might be matched to unrelated files.
|
Description
Fix annotation imports with inconsistent image file names or with images in subfolders.
Type of change
How has this change been tested, please provide a testcase or example of how you tested the change?
Added a test to validate the scenario.
Note
Improves folder parsing to reliably match annotations to images (including COCO with subdirectory file_names), and adds tests for these cases.
roboflow/util/folderparser.py
_build_image_to_annotationfile_index
supportingcoco
,createml
,csv
,multilabel_csv
, andjsonl
._filterIndividualAnnotations
to try multiple keys (rel path → basename → stem) and corrects annotation map lookup keys.tests/util/test_folderparser.py
file_name
match root-level images.__version__
to1.2.11
.Written by Cursor Bugbot for commit 76ae33f. This will update automatically on new commits. Configure here.