Skip to content

Conversation

@ojayballer
Copy link

Motivation

Currently, the Palm Detection demo script crashes when providing a webcam index (e.g., --input 0) because it attempts to load "0" as an image file.

Modification

This PR adds input validation to demo.py:

  • Checks if args.input is a digit using .isdigit().
  • If it is a digit, it initializes the webcam (cv.VideoCapture) and runs inference in a loop.
  • If it is not, it proceeds with the existing single-image loading logic.

Verification

  • Tested with webcam: python demo.py --input 0 (Successful inference)
  • Tested with image: python demo.py --input test_image.jpg (Backwards compatibility preserved)

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