Skip to content

fix a bug when using base name of image_name to access annotation during recording confidence. #190

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

waterdeepmage
Copy link

Line 116 of autodistill/detection/detection_base_model.py file

if record_confidence:
            #image_names = [os.path.basename(f_path) for f_path in image_paths]
            image_names = image_paths
            self._record_confidence_in_files(
                output_folder + "/annotations", image_names, detections_map
            )

Here the image_names should be full path instead of base name, because the keys in annotations and images in dataset are full path.

Line 51 of autodistill/detection/detection_base_model.py file

 yolo_annotations_name, _ = os.path.splitext(os.path.basename(image_name))

Here os.path.splittext should work with base name instead of full path due to my previous fix.

Original code would have bug when you try to run line 50 of this file. The image_name was base name of the file instead of full path, but the keys for annotations are full path.

This bug won't show up until you set record_confidence = True for the label method of DetectionBaseModel class.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants