Headphones Detection 1 | Headphones Detection 2 | Headphones Detection 3 |
---|---|---|
This project aims to train a object detecion deep learning model, using a custom number of classes (Headphones)
Ensure that your python version is >= 3.9 and you have installed the opencv with CUDA
Download the data running the following command in the src
directory:
$ python data_downloader.py
Create the train.txt
and test.txt
files with random split, these files must be in the same directory that the darknet.data
file
$ cd src
$ python split_train_test.py ../data/images/
Get the yolov4-tiny-custom.cfg and change the number of classes and the filters for the [conv] layers before the [yolo] layers
- check the documentation to see all the parameters to be changed: https://github.com/AlexeyAB/darknet#how-to-train-to-detect-your-custom-objects
$ wget https://github.com/AlexeyAB/darknet/blob/master/cfg/yolov4-tiny-custom.cfg
Download file with the first 29-convolutional layers of yolov4-tiny: https://github.com/AlexeyAB/darknet/releases/download/darknet_yolo_v4_pre/yolov4-tiny.conv.29
$ darknet.exe detector train darknet.data yolo-cfg/yolov4-tiny-custom.cfg yolov4-tiny.conv.29 -map
$ darknet.exe detector test darknet.data yolo-cfg/yolov4-tiny-custom.cfg backup/yolov4-tiny-custom_final.weights data/your-image-path.png
$ cd src/
$ python main.py --image your_image.png