qqwweee / keras-yolo3

A Keras implementation of YOLOv3 (Tensorflow backend)
MIT License
7.14k stars 3.45k forks source link

OSError: Couldn't open webcam or video #404

Open radcheb opened 5 years ago

radcheb commented 5 years ago

When I test keras-yolo3 on MacOs while setting 0 for using cam:

python yolo_video.py --input 0 --output cam.mp4

I got this error stack:

Using TensorFlow backend.
model_data/yolo.h5 model, anchors, and classes loaded.
OpenCV: Couldn't read video stream from file "0"
Traceback (most recent call last):
  File "yolo_video.py", line 75, in <module>
    detect_video(YOLO(**vars(FLAGS)), FLAGS.input, FLAGS.output)
  File "/XXXXXXXXXXXXXXXXX/keras-yolo3/yolo.py", line 176, in detect_video
    raise IOError("Couldn't open webcam or video")
OSError: Couldn't open webcam or video
radcheb commented 5 years ago

Actually I think this because cv2.VideoCapture needs an integer if it's a device (cam) and not a String. Otherwise he will look for file "0".

LiEAEX commented 5 years ago

parser.add_argument( "--input", nargs='?', type=str,required=False,default='./path2your_video', help = "Video input path" )

find this part in "yolo_video.py" and change "str" to "int"

pratikkorat26 commented 4 years ago

i tried that too 'str' tp 'int' error: argument --input: invalid int value: './path2your_video' showing this error thank you!