I am using https://github.com/theAIGuysCode/yolov4-custom-functions this repository. I want to crop and save pictures while running on webcam. But when I run the following code:
python detect_video.py --weights ./checkpoints/yolov4-416 --size 416 --model yolov4 --video ./data/video/bobinmi.mp4 --output ./detections/results.avi --crop
I can just detect the first frame of the video. Then it gives error and not detect. What should I do?
I'm using CUDA 10.1, Python 3.7 and Tensorflow 2.3. The error is same in CPU and GPU working environments.
The error message is:
FPS: 1.50
qt.qpa.xcb: could not connect to display
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "/usr/local/lib/python3.7/dist-packages/cv2/qt/plugins" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
Available platform plugins are: xcb.
Fatal Python error: Aborted
Current thread 0x00007fbeed09b780 (most recent call first):
File "detect_video.py", line 165 in main
File "/usr/local/lib/python3.7/dist-packages/absl/app.py", line 254 in _run_main
File "/usr/local/lib/python3.7/dist-packages/absl/app.py", line 308 in run
File "detect_video.py", line 178 in <module>
Second problem is when I use this command:
!python detect_video.py --weights ./checkpoints/yolov4-416 --size 416 --model yolov4 --video 0 --output ./detections/results2.avi --crop
then it says:
[ WARN:0@5.489] global /io/opencv/modules/videoio/src/cap_v4l.cpp (902) open VIDEOIO(V4L2:/dev/video0): can't open camera by index
Video has ended or failed, try a different video format!
I know the problem is with opening the camera in Colab. But I couldn't find how to solve it.