-
Notifications
You must be signed in to change notification settings - Fork 53
How to Train on Your Dataset
Clone or download the repo.
Download original tiny-yolo weights. Rename it as tiny-yolo-voc.weights
. Create a bin\
folder in your working directory and move the weights file to the bin folder as bin\tiny-yolo-voc.weights
.
Download the Complete-Blood-Cell-Count-Dataset, unzip it, rename the folder as dataset
and move to the working directory.
List all the class names in the label.txt
file.
In the cfg\
folder make a copy of tiny-yolo-voc.cfg
and rename it as tiny-yolo-voc-#c.cfg
. Here, # stands for the total number of classes listed in the label.txt file. Complete Blood Cell Count Dataset has three classes so the name will be tiny-yolo-voc-3c.cfg
. Make sure that cfg\
folder contains both tiny-yolo-voc.cfg
and tiny-yolo-voc-3c.cfg
files.
Open the tiny-yolo-voc-3c.cfg
file using any text editor and go to the line 114
and change the filter number for the final convolutional layer. The total number of filters for your dataset should be:
No. of anchors x (No. of classes + 5)
=> 5 x (3 + 5)
=> 40
Now move to line 120
and change the number of classes. For this dataset, it will be 3.
You can train on your dataset directly using command line arguments.
python flow --model cfg/tiny-yolo-voc-3c.cfg --load bin/tiny-yolo-voc.weights --train --gpu .7 --annotation dataset/Training/Annotations --dataset dataset/Training/Images --lr 1e-3 --epoch 100
--model => configuration file.
--load => tiny-yolo weight file.
--train => to train the network.
--gpu => to specify GPU usage percentage. To train without GPU set it 0.
--annotation => Annotation folder directory.
--dataset => Image folder directory.
--lr => to specify learning rate.
--epoch => Specify the number of epochs.
That's it. Your trained weight files will be saved in the weights\
folder.