BUG: YOLO incorrectly labels Toothbrush (Class ID 79) detections as Unknown

Open Beginner friendly
#1,700 3 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 6 days

Nobody has claimed this yet.

Assessment

Difficulty
1/5
Estimated time
Under an hour
Newbie friendliness
86/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
python

Research direction

The issue identifies backend/app/utils/YOLO.py and YOLO_util_draw_detections(). Read that function and run the failing unit test described in the issue with class ID 79 and confidence 0.90. Done means the visualization labels this detection toothbrush 90% instead of unknown 90%.

Written by the indexing model from the issue text.

Description

bug possible-duplicate
Is there an existing issue for this?
  • I have searched the existing issues
What happened?
Bug Description

The YOLO detection visualization incorrectly labels the last COCO class,
"toothbrush" (class ID 79), as "unknown".

The issue is in backend/app/utils/YOLO.py, inside the
YOLO_util_draw_detections() function.

Root Cause

The current condition is:

if score < confidence_threshold or class_id >= len(class_names) - 1:

Since class_names contains 80 classes (indices 0–79), this condition
incorrectly treats class ID 79 as invalid.

Expected Behavior

Class ID 79 should be recognized as "toothbrush".

Actual Behavior

Class ID 79 is displayed as "unknown".

Impact

The issue causes incorrect object labels in the detection visualization for the last category in the COCO class list.

Testing

I reproduced the issue using a unit test with:

  • Class ID: 79
  • Confidence score: 0.90

Expected output: toothbrush 90%

Actual output: unknown 90%

The test fails with the current implementation.

Record
  • I agree to follow this project's Code of Conduct
Dominant language
Python
Stars
313
Forks
755
Avg merge
6d 36m
Merged PRs (30d)
8

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 AOSSIE-Org/PictoPy

All issues in AOSSIE-Org/PictoPy

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.