Ask Your Question
0

OpenCV 3.4.0 with new samples/dnn/object_detection?

asked 2018-04-23 08:50:37 -0600

austinmw gravatar image

Hi, I'm trying to get OpenCV to work with Darknet YOLO V3. I was told that Darknet doesn't support OpenCV 3.4.1, and I need to use 3.4.0. However, it looks like a fix for YOLO V3 in DNN layers was just very recently pushed to the samples/dnn/object_detection* files in branch 3.4. So what I'm wondering is, can I apply this fix easily to version 3.4.0 of OpenCV? Any help is greatly appreciated, thanks!

Also if I'm over-complicating or misunderstanding the issue and there's an easier way to run Yolo V3 config files on video please let me know!

edit retag flag offensive close merge delete

Comments

"I was told that Darknet doesn't support OpenCV 3.4.1, and I need to use 3.4.0" -- that's nonsense, and it's the other way round

berak gravatar imageberak ( 2018-04-23 09:08:19 -0600 )edit

OpenCV is going to increase a major version (it will be 4.x.x). However that means that a lot of significant changes will come. The same thing was once between OpenCV 2 and OpenCV 3. Then master branch was used to develop a new version of OpenCV but a branch 2.4 to let users work with an old one. Nowadays master branch is a future OpenCV 4 and all the 3.x.x versions will be at branch 3.4. Once a week master branch merges some changes from 3.4.x so you can use both (just wait a moment when master branch will be updated).

dkurt gravatar imagedkurt ( 2018-04-23 09:21:29 -0600 )edit

I had problems compiling with 3.4.1 and then found this post: https://github.com/pjreddie/darknet/i... Maybe I was doing something wrong, is that bug outdated and master branch should compile now?

austinmw gravatar imageaustinmw ( 2018-04-23 09:21:56 -0600 )edit
1

apologies, i misread it:

  • if you want to use darknet with opencv support, indeed, use 3.4.0 (to avoid the c++11 issues specific to darknet)
  • if you want to use pretrained yolov3 networks with opencv's dnn, -- use latest master. (it was added only days ago !)


please clarify again, which of the 2 different things you wanted to do, it's unclear in your question

berak gravatar imageberak ( 2018-04-23 09:26:22 -0600 )edit

Is it possible to do both, darknet with opencv support along with pretrained yolo v3 network? I have a video that I want to run real-time detections on that I believe requires opencv support, but the pretrained network uses yolov3 layers.

austinmw gravatar imageaustinmw ( 2018-04-23 09:30:31 -0600 )edit

not with the same opencv version

berak gravatar imageberak ( 2018-04-23 09:37:32 -0600 )edit

hmm so just to make sure that I follow, there's no way to run detection on videos in real-time with pretrained yolov3 network currently?

austinmw gravatar imageaustinmw ( 2018-04-23 09:40:47 -0600 )edit

you don't have to build the darknet lib with opencv, that's where the problem is.

you can build it without any (internal, c-api) opencv support, and do your own c++ visualization in your main program. that would work with latest opencv master, too.

berak gravatar imageberak ( 2018-04-23 09:45:16 -0600 )edit

Ah, okay. Thanks for your help in understanding. Maybe I got confused because the darknet website shows the example command ./darknet detector demo cfg/coco.data cfg/yolov3.cfg yolov3.weights <video file="">, which I think requires building with opencv, but also needs DNN module support for V3? Maybe I'm mistaken again though.

austinmw gravatar imageaustinmw ( 2018-04-23 09:59:25 -0600 )edit

darknet does not need or use opencv's dnn (it has it's own)

berak gravatar imageberak ( 2018-04-23 10:22:57 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
1

answered 2018-04-23 10:28:26 -0600

dkurt gravatar image

updated 2018-04-23 10:29:44 -0600

@austinmw, OpenCV and Darknet are separate libraries. Both of them can work standalone. YOLOv3 is a deep learning network which trained in Darknet. There is an application (./darknet) that you can use without OpenCV (output is produced to *.png file) or with OpenCV (perhaps output will be rendered on the screen). On the other hand you may use OpenCV without Darknet. You need to build it from source from branch 3.4 and run object_detection.cpp or object_detection.py. Read more about arguments in tutorial https://docs.opencv.org/master/da/d9d... .

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2018-04-23 08:50:37 -0600

Seen: 1,512 times

Last updated: Apr 23 '18