Skip to content

Fix incorrect bounding box variables in yawn detection scripts#38

Open
Deepthanush1337 wants to merge 1 commit intohumanai-foundation:mainfrom
Deepthanush1337:fix/noYawn-bounding-box-bugs
Open

Fix incorrect bounding box variables in yawn detection scripts#38
Deepthanush1337 wants to merge 1 commit intohumanai-foundation:mainfrom
Deepthanush1337:fix/noYawn-bounding-box-bugs

Conversation

@Deepthanush1337
Copy link

Found a couple of bounding box bugs in the fatigue detection scripts:

noYawn.py:

  • result.boxes.xywhn.cpu().numpy()[0] always grabs the first detection regardless of which box the loop is iterating over. Changed to box.xywhn so each face gets its own coordinates in the label file.
  • In the eyes loop, box.xyxy was used instead of box_eyes.xyxy, so the rectangle was drawn on the face bounding box rather than the eye bounding box. Fixed to box_eyes.xyxy.
  • Removed a redundant f.close() after a with block (file is already closed by the context manager).

yawn_SPIGA_single.py and yawn_SPIGA_folder.py:

  • Same result.boxes.xywhn -> box.xywhn fix.
  • Same redundant f.close() cleanup.

In noYawn.py:
- result.boxes.xywhn always returned the first detection's coords
  regardless of which box the loop was on. Changed to box.xywhn so
  each face gets its own bounding box written to the label file.
- The eyes loop used the face-loop variable (box) instead of box_eyes
  to extract xyxy coords, so eye rectangles were drawn over faces
  instead of eyes. Changed to box_eyes.xyxy.
- Removed redundant f.close() after a with-block.

In yawn_SPIGA_single.py and yawn_SPIGA_folder.py:
- Same result.boxes.xywhn issue fixed to box.xywhn.
- Removed redundant f.close() calls.
@Deepthanush1337 Deepthanush1337 force-pushed the fix/noYawn-bounding-box-bugs branch 2 times, most recently from 5f6adf4 to 48ada02 Compare March 11, 2026 06:12
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.

1 participant