Skip to content

Conversation

@ojayballer
Copy link

Motivation

Currently, the NanoDet 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).
  • If it is not, it proceeds with the existing image file loading logic.

Verification

  • Tested with webcam: python demo.py --input 0 (Successful inference)
  • Tested with image: python demo.py --input dog.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