As I continued exploring YOLO object detection, I found that for starters to train their own custom object detection project, it is ideal to use a YOLOv3-tiny architecture since the network is relative shallow and suitable for small/middle size datasets
Compiling with CUDA and OpenCV, here is the instruction: https://pjreddie.com/darknet/install/#cuda Make sure your can run those commands before training your own dataset
Prepare your own labled dataset: Here is a great tool I used to annotate my own datasets: https://github.com/AlexeyAB/Yolo_mark Remember, dataset is very crucial for deep learning and your model's performance, it is time consuming to prepare your own annotated dataset.
Step 4:
Copy all your prepared images and their corresponding .txt files to the directroy in your Darknet file:
./home/Darknet/data/img
Step 5:
In Step 3, you should have created a txt file called : obj.names. Since I trained on 6 objects, I named my file as obj6.names and they are: babybuggy, bicycle, fire_engine, motor_cycle, scooter, moter_scooter. I have uploaded a sample obj.names file in this post.
Step 6:
Create a "train.txt" file which including the directory and the names of your labeled images for training:
Create a "test.txt" file which including the directory and the names of your labeled images for testing, remember do not test on the same images which used for training already.
In Darknet file, there is a cfg file. Creat your own YOLOv3-tiny.cfg in that file. I have posted a sample "YOLOv3-tiny6.cfg" file which I used to train my model.
Now you can start your training by typing: ./darknet detector train data/obj6.data yolov3-tiny6.cfg darknet53.conv.74 The trained weights will be saved at your ../darknet/backup
Step 10:
After you monitored the training for maybe 10,000 iterations, you can stop training and test out your model by typing: ./darknet detector test data/obj6.data yolov3-tiny6.cfg backup/yolov3-tiny6_10000.weights data/test/babybuggy.jpg