Ask Your Question
0

Implement and train YOLO 3 with Opencv and C++

asked 2019-08-08 12:12:47 -0500

heflie gravatar image

updated 2019-08-08 12:23:12 -0500

I want to implement and train YOLO 3 with my dataset using Opencv and C++, i can't find an example to start with, or a tutorial to explain how to train YOLO with my own data, all the tutorials i found are in python and don't use Opencv. Do you have any example, or an explanation to how to code an object detector with YOLO 3, opencv with C++.

I find this tutorial : https://www.learnopencv.com/deep-lear...

The code for this tutorial is here :

https://github.com/spmallick/learnopencv

but i can't find the C++ code, i think it exist only with python.

Please i need your help, and thank you

edit retag flag offensive close merge delete

Comments

I think it's here

LBerger gravatar imageLBerger ( 2019-08-08 12:42:21 -0500 )edit

Thank you very much @LBerger I will read the code and see if it do the training, by the way do you know, please any other tutorial or code like the "learnopencv" that detect 1 or multiple objects with yolo3 with opencv and C++, I search a lot and I find only this tutorial.

heflie gravatar imageheflie ( 2019-08-08 13:18:41 -0500 )edit

I think this code is only for detection not training

heflie gravatar imageheflie ( 2019-08-11 12:45:46 -0500 )edit

1 answer

Sort by ยป oldest newest most voted
2

answered 2019-08-08 13:26:12 -0500

Witek gravatar image

updated 2019-08-08 13:27:20 -0500

You cannot train YOLO with OpenCV - you can just use it as a detector WITHOUT Nvidia GPU SUPPORT - which means it is going to be quite slow. If you want to train YOLO for your custom objects you have to compile it from source and follow the instructions. Compilation on Ubuntu is quite straightforward but installing CUDA was quite painful. On the other hand, compilation on Windows is a bit troublesome but I do not recall any problems with CUDA and other prerequisites. If you want to detect object using Nvidia GPU you also need to use the original version, but you may easily combine it with OpenCV.

edit flag offensive delete link more

Comments

Thank you for your response, Please I am new in this, I want to create an application for commercial use, with opencv c++ and YLO3 and I have to use windows, and visual studio, I don't know what is CUDA or NVIDIA GPU, are they free and I can use them for commercial use.

heflie gravatar imageheflie ( 2019-08-08 13:58:50 -0500 )edit

OpenCV is free for commercial use. YOLO is opensource and also free. I am not sure about CUDA - you need it to make YOLO fast (esp. during training).

Witek gravatar imageWitek ( 2019-08-08 14:36:28 -0500 )edit

Please do you have any code to train yolo3 with C++ i can't find a code with C++

heflie gravatar imageheflie ( 2019-08-11 09:06:57 -0500 )edit

What operating system are you using?

Witek gravatar imageWitek ( 2019-08-11 15:38:49 -0500 )edit

Windows 7 and Visual studio

heflie gravatar imageheflie ( 2019-08-11 15:43:01 -0500 )edit

Any help please, I'm stuck I do not know how to start

heflie gravatar imageheflie ( 2019-08-13 08:20:54 -0500 )edit

You have the link up in the answer. Install CUDA, cuDNN, cmake and create a VS solution which you later build and you shall have a working darknet (YOLOv3) application to train your stuff.

Witek gravatar imageWitek ( 2019-08-14 06:11:56 -0500 )edit

Ok, thank you, please i have a question, tell me if I'm wrong, I have to use CUDA to make my GPU more efficient, because trainning requires a lot of calculation. My question is : it is possible that the training only works by using the CPU, because I have not a lot of images, and thank you again for your help

heflie gravatar imageheflie ( 2019-08-14 14:06:40 -0500 )edit

You should use CUDA to make use of your Nvidia GPU. If you don't use CUDA you will train on CPU, which is possible, but very slow - 10-50 times slower depending on what CPU and GPU you have. With Yolo and other deep learning frameworks you should have hundreds of images for training, otherwise the trained network will not be able recognize objects in real life situations. How many images do you have and how many classes?

Witek gravatar imageWitek ( 2019-08-15 11:22:56 -0500 )edit

I have two classes, and 300 images for each classe

heflie gravatar imageheflie ( 2019-08-15 11:33:19 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2019-08-08 12:12:47 -0500

Seen: 66 times

Last updated: Aug 08