YOLO loader drops images that have no label file

Open Beginner friendly
#680 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@guptakaran20 is already working on this.

Since Nov 11, 2026.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
72/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
python, pytorch

Research direction

Start by reading _add_to_dataset in yolo.py and compare how the COCO loader handles images without annotations. Check the loader tests for a way to cover a background image with no label file. Done means all four images are loaded and the unlabeled image contributes no boxes, so false positives can be counted.

Written by the indexing model from the issue text.

Description

Images that have no label file (YOLO background images) are skipped without any warning. In a test folder with 4 images in val, only 3 were loaded.

COCO keeps images without annotations, so the two loaders do not match.

I think it is because _add_to_dataset in yolo.py only adds a sample if both the image and the label file exist.

Possible fix: if the label file is missing, treat it as no boxes.

This matters because false positives on those images are not counted, so precision looks better than it is.

Dominant language
Python
Stars
115
Forks
117
Avg merge
1d 14h
Merged PRs (30d)
12

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from JdeRobot/PerceptionMetrics

All issues in JdeRobot/PerceptionMetrics

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.