AlexeyAB / darknet

YOLOv4 / Scaled-YOLOv4 / YOLO - Neural Networks for Object Detection (Windows and Linux version of Darknet )
http://pjreddie.com/darknet/
Other
21.65k stars 7.96k forks source link

webcamera only shows blank screen and 0 fps #223

Open elnasdgreat opened 6 years ago

elnasdgreat commented 6 years ago

I have a problem with webcamera Whenever I enter this command darknet.exe detector demo data/voc.data yolo-voc.cfg yolo-voc.weights -c 0 It just shows me a blank screen, and the fps is 0. image,video file, netcamera works fine.

CUDA 8.0 with cudnn OpenCV 3.2.0 gtx 750 ti

AlexeyAB commented 6 years ago

@elnasdgreat Can you see video from your web-camera using any of your own OpenCV application?

vinjn commented 6 years ago

Might be a bug of C API of cvRetrieveFrame(). I also met this issue, and work around it by switching to C++ interface.

rickchen147258 commented 6 years ago

@vinjn I have a same problem ,too. Do you mean I need to change the filename "image.c" to "image.cpp" to solve this problem?

vinjn commented 6 years ago

No, it requires change of API, not just filename extensions. Check my local hack https://github.com/jing-vision/darknet/blob/master/my_src/my_demo.cpp#L63-L70

rickchen147258 commented 6 years ago

@vinjn Do you use opencv249 or opencv320? I use opencv320 with your code and result like this 123

the code can run but it seems that it didn't catch the picture.

rickchen147258 commented 6 years ago

@vinjn I know how to solve my problem. I found that opencv only supports usb3.0 webcam Thank you!

elnasdgreat commented 6 years ago

i have opencv v3.2.0 installed. tried it also on a laptop webcam and usb webcam. same result.

rickchen147258 commented 6 years ago

@elnasdgreat Do you use the codes which @vinjn offer? You need to copy all files from @vinjn's darknet. both opencv320 and open249 are ok.

kbitr commented 6 years ago

@NTNUelec @AlexeyAB

only supports usb3.0 webcam

Does the following explicitly mean that no USB 2.0 webcams are not supported in any way? When I start darknet detector demo [data] [cfg] [weight] (-c 0) it will open the following window:

device

When accepting it will go to Couldn't connect to webcam. :No error

rickchen147258 commented 6 years ago

@kbitr Do you use the codes which @vinjn offer? And you need to use the usb3.0 jack on computer although your camera is usb 2.0

kbitr commented 6 years ago

@NTNUelec No, I did not at the point of the above post. But now that I did, it doesn't work.

First, the include is wrong somehow, probably due to evolution of the algorithm (comparing the files), having fixed that, core.hpp header must be compiled as C++ appears at building. USB 3.0 Port at Mainboard doesn't change anything.

Maybe this issue is not related to mine.

kbitr commented 6 years ago

UPDATE: Actually now using -c 0 will result in opening a black output window, FPS is at normal speed for my hardware, no objects detected. After a few iterations it will freeze.

rickchen147258 commented 6 years ago

@kbitr Yes, I had the same problem if I used AlexeyAB's darknet and vinjn siad that it may be a bug of opencv. You need to use @vinjn darknet https://github.com/jing-vision/darknet and replace src/demo.c with my_src/my_demo.cpp in @vinjn darknet

kbitr commented 6 years ago

@NTNUelec Sure, I tried. You can see my problem with this in my above comment.

C1189 - core.hpp header must be compiled as C++ - core.hpp - Line 49

What am I missing?

rickchen147258 commented 6 years ago

kbitr You need to change your compilier. Goto C/C++ -> Advanced, and change Compile as to Compile as C++ Code (/TP)

kbitr commented 6 years ago

@NTNUelec Okay, that did the trick for that problem, thank you.

But now it kicks out 624 Errors, mainly: C2440 - 'initializing': cannot convert from 'void *' to 'float *' or C2440 - 'initializing': cannot convert from 'void *' to 'image *' etc.

I am trying to replace the _mydemo.cpp in the latest master of this repo. The same will happen, when I also try to compile jing-vision/darknet.

timonsku commented 6 years ago

Having the same issue here. Just a grey non responding window and 0 FPS in the command prompt.

Can @vinjn patch be used with the latest version of @AlexeyAB repo? The other one is rather old. Also replace in what way, copy over the my_demo.cpp or copy it over and rename it to demo.c?