Darknet: Demo needs OpenCV for webcam images

Created on 19 Jun 2018  Â·  15Comments  Â·  Source: pjreddie/darknet

./darknet detector train cfg/obj.data cfg/yolo-tiny-obj.cfg darknet19_448.conv.23
./darknet detector test cfg/obj.data cfg/yolo-tiny-obj.cfg backup/yolo-tiny-obj_40000.weights data/test.jpg

-> It works very well!

./darknet detector demo cfg/obj.data cfg/yolo-tiny-obj.cfg backup/yolo-tiny-obj_40000.weights data/test.jpg
./darknet detector demo cfg/obj.data cfg/yolo-tiny-obj.cfg backup/yolo-tiny-obj_40000.weights data/test.mp4

-> It does not work.

Demo needs OpenCV for webcam images.

Opencv = 2.4.8
I use GPU.
Makefile is changed .
GPU=1
Opencv=1
I connected webcam.

./darknet detector test cfg/obj.data cfg/yolo-tiny-obj.cfg backup/yolo-tiny-obj_40000.weights data/test.mp4
-> Cannot load image "data/test.mp4"
STB Reason:unknown image type

Most helpful comment

I solved the problem. But I faced new problems...

give the stupidity a sense and share your results

All 15 comments

if you want to test on a video then type

./darknet detector demo cfg/obj.data cfg/yolo-tiny-obj.cfg
backup/yolo-tiny-obj_40000.weights data/test.mp4

./darknet detector test is used to test images

Regards
Ahsan

On Tue, Jun 19, 2018 at 11:46 AM hyoeun27 notifications@github.com wrote:

./darknet detector train cfg/obj.data cfg/yolo-tiny-obj.cfg
darknet19_448.conv.23
./darknet detector test cfg/obj.data cfg/yolo-tiny-obj.cfg
backup/yolo-tiny-obj_40000.weights data/test.jpg

-> It works very well!

./darknet detector demo cfg/obj.data cfg/yolo-tiny-obj.cfg
backup/yolo-tiny-obj_40000.weights data/test.jpg
./darknet detector demo cfg/obj.data cfg/yolo-tiny-obj.cfg
backup/yolo-tiny-obj_40000.weights data/test.mp4

-> It does not work.

Demo needs OpenCV for webcam images.

Opencv = 2.4.8
I use GPU.
Makefile is changed .
GPU=1
Opencv=1
I connected webcam.

./darknet detector test cfg/obj.data cfg/yolo-tiny-obj.cfg
backup/yolo-tiny-obj_40000.weights data/test.mp4
-> Cannot load image "data/test.mp4"
STB Reason:unknown image type

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/pjreddie/darknet/issues/892, or mute the thread
https://github.com/notifications/unsubscribe-auth/AK9zjnLkPUcrP2Gnk7Z61T4itUnJ8Kjkks5t-J4_gaJpZM4Us7nG
.

./darknet detector demo cfg/obj.data cfg/yolo-tiny-obj.cfg
backup/yolo-tiny-obj_40000.weights data/test.mp4

-> Demo needs OpenCV for webcam images.

which version of opencv do you have ?
pkg-config --modversion opencv -> version ?
python -c import cv2;cv2.__version__ --> version ?

Regards
Ahsan

On Tue, Jun 19, 2018 at 12:03 PM hyoeun27 notifications@github.com wrote:

./darknet detector demo cfg/obj.data cfg/yolo-tiny-obj.cfg
backup/yolo-tiny-obj_40000.weights data/test.mp4

-> Demo needs OpenCV for webcam images.

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/pjreddie/darknet/issues/892#issuecomment-398296066,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AK9zjrrY0DwrqWIVEVggINCpw2Rr8WwKks5t-KJVgaJpZM4Us7nG
.

pkg-config --modversion opencv
2.4.8

OpenCV version = 2 . 4. 8

can you upgrade your opencv to 3.4.0 . I have opencv 3.4.0 and everything
is working fine
Regards
Ahsan

On Tue, Jun 19, 2018 at 12:24 PM hyoeun27 notifications@github.com wrote:

pkg-config --modversion opencv
2.4.8

OpenCV version = 2 . 4. 8

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/pjreddie/darknet/issues/892#issuecomment-398301121,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AK9zjtrxLnFKzrIqyEtQ_ChwYA5Wkm6Vks5t-KdIgaJpZM4Us7nG
.

Thankyou!
I solved the problem. But I faced new problems...

103 conv 128 1 x 1 / 1 52 x 52 x 256 -> 52 x 52 x 128 0.177 BFLOPs
104 conv 256 3 x 3 / 1 52 x 52 x 128 -> 52 x 52 x 256 1.595 BFLOPs
105 conv 255 1 x 1 / 1 52 x 52 x 256 -> 52 x 52 x 255 0.353 BFLOPs
106 yolo
Loading weights from yolov3.weights...Done!
Couldn't connect to webcam.
: No such file or directory
darknet: ./src/utils.c:256: error: Assertion `0' failed.
Aborted (core dumped)

Webcam is Rogitech 4k brio.
Webcam is worked !

@hyoeun27, is your setup working for video file. i am getting error for video;

Loading weights from yolov3.weights...Done!
video file: /data/Yo.mp4
Couldn't connect to webcam.
: No such file or directory
darknet: ./src/utils.c:256: error: Assertion `0' failed.
Aborted (core dumped)

My problem was remote acceess.
I used to connect with putty.
So, I connected directly to the local and it worked fine.
If you are using remote access, opencv will not work well..

@hyoeun27 did it work for webcam after upgrading opencv. I'm still stuck at this error "Demo needs OpenCV for webcam images."! Please help!

im stuck as well. I had in running a while ago and now i get the same error message:( Someone help!

Me too. I already changed the Makefile to have OPENCV=1, set the OpenCV_DIR variable in CMakeCache.txt to {path to local user}\.conda\envs\tf_gpu\Library\lib where the conda OpenCV lib is, which leads to a successful cmake configuration:
image

Since my conda environment's OpenCV has been found, I expected it to work now, STILL I receive the same error message Demo needs OpenCV for webcam images. :(

Side question: How do you enable CUDA too for Darknet?

I solved the problem. But I faced new problems...

give the stupidity a sense and share your results

Hi,
I'm working on JetsonTX2 and I wonder if the .bashrc is the equivalent of the CMakeCache.txt (I don't have any file name CMakeCache.txt only CMakeList but not in darknet repo) ?

I have the same issue with Demo needs OpenCV and I can't "make" darknet even with opencv=1. I checked CUDA,Opencv(3.4.0) and cudnn but nothing seems to work.
For information I also work with a virtual environment (virtualenvs and virtualwrapper)

I am having the same issue !
This is the text on terminal-------------->
@LAPTOP-QBDOA8AA:/mnt/e/Darknet/2/darknet$ ./darknet detector train custom/trainer.data custom/yolov3-tiny.cfg darknet53.conv.74
yolov3-tiny
First section must be [net] or [network]: Success
darknet: ./src/utils.c:256: error: Assertion `0' failed.
Aborted (core dumped)


i have followed all the steps!

I am having the same issue !
but I install more than one opencv

could any one help

Was this page helpful?
0 / 5 - 0 ratings

Related issues

AaronYKing picture AaronYKing  Â·  3Comments

ivomarvan picture ivomarvan  Â·  3Comments

cadip92 picture cadip92  Â·  3Comments

sujithm picture sujithm  Â·  3Comments

job2003 picture job2003  Â·  3Comments