AlexeyAB / darknet

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

Not Responding Using PC Webcam or IPCam #364

Open alfamousts opened 6 years ago

alfamousts commented 6 years ago

Hello im using YOLO with version darknet_no_gpu. I have already compiled the program. I have tried object detection using image that already in folder data. But when i try to run using webcam, the demo dialog box it pops up and show the green colour. Later on, the dialog box gone not responding. Also when i am trying using IP cam from my phone camera. I have already put the true my IP camera on the command line, but it shows the same thing. Anyone understand this problem and can give me some solutions to fix this problem ?

AlexeyAB commented 6 years ago
alfamousts commented 6 years ago

I am using opencv 3.0.0. I tried to run a simple program was showing IP Cam and it run perfectly without error. use opencv 3.0.0 also. The program like this : `#include "opencv2\opencv.hpp"

include

using namespace cv; using namespace std;

const int fps = 20;

int main(int argv, char** argc)

{ Mat frame; VideoCapture vid(1);

if (!vid.isOpened())
{
    return -1;
}

while (vid.read(frame))
{
    imshow("webcam", frame);
    if (waitKey(1000 / fps) >= 0)
        break;
}

}`

I follow your instruction to put command : darknet_no_gpu.exe detector demo data/coco.data yolo.cfg yolo.weights http://192.168.0.3:8080/video?dummy=param.mjpg -i 0

I have check the IP Address for my camera every send command line. and put the IP address in program : Configuring IP Camera Adapter

But i also tried using YOLO for video i've download from youtube, and demo box is showing the video very slow. Is it caused by side effect when iam using no gpu or anyelse?

AlexeyAB commented 6 years ago

But i also tried using YOLO for video i've download from youtube, and demo box is showing the video very slow. Is it caused by side effect when iam using no gpu or anyelse?

Yes.

I follow your instruction to put command : darknet_no_gpu.exe detector demo data/coco.data yolo.cfg yolo.weights http://192.168.0.3:8080/video?dummy=param.mjpg -i 0

Can you see anything if you use your own custom OpenCV application with this URL? http://192.168.0.3:8080/video?dummy=param.mjpg

VideoCapture vid(1);

What command line do you use to detect from Web-camera using Darknet Yolo?

alfamousts commented 6 years ago

Now i use darknet.exe but now the problem is when i type this command on command line "darknet.exe detector demo data/voc.data yolo-voc.cfg yolo-voc.weights -c 0"

No demo window was showing, the light of my laptop webcam only turn on for the moment. (Only 1s i think) and then the light is off, and at the command prompt it written like this : strem closed.: No error

alfamousts commented 6 years ago

darknet.exe detector demo data/coco.data yolo.cfg yolo.weights http://192.168.0.18:8080/video?dummy=param.mjpg -i 0

I also try using IP camera. And the output like this `[mjpeg @ 00000293c6581ae0] overread 8  FPS:0.0 Objects:

Stream closed.: No error`

Are you have any suggestion to fix this problem ?

AlexeyAB commented 6 years ago

using namespace cv; using namespace std;

const int fps = 20;

int main(int argv, char** argc) { Mat frame; std::string net_cam = "http://192.168.0.18:8080/video?dummy=param.mjpg"; VideoCapture vid(net_cam );

if (!vid.isOpened()) { return -1; }

while (vid.read(frame)) { imshow("webcam", frame); if (waitKey(1000 / fps) >= 0) break; } }

alfamousts commented 6 years ago

I am using opencv 3.4.0 and i have put the opencv_ffmpeg340_64.dll in near file darknet.exe

Yes i can use the ip cam with that code.

AlexeyAB commented 6 years ago

Try to install Gstreamer and OpenCV with Gstreamer support: https://cvexplorare.wordpress.com/2016/11/15/opencv-gstreamer-windows/ Apparently it helps on Linux to use Web Camera: https://github.com/pjreddie/darknet/issues/292#issuecomment-368305508

Run this in terminal (cmd.exe) in build folder: cmake -DOPENCV_SKIP_PKGCONFIG_GENERATION=ON . Or add this custom variable via cmake-gui ("Add Entry" button).

AlexeyAB commented 6 years ago

@alfamousts I fixed it. Just update your code from this repo. It was C API bug in OpenCV 3.x.

alfamousts commented 6 years ago

@AlexeyAB Thank you so much, you're such an incredible. This code is working.