Skip to content

How to Train on Your Dataset

Mohammad edited this page Jun 29, 2021 · 7 revisions

Step 01:

Clone or download the repo.

Step 02:

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.

Step 03:

Download the Complete-Blood-Cell-Count-Dataset, unzip it, rename the folder as dataset and move to the working directory.

Step 04:

List all the class names in the label.txt file.

Step 05:

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.

Step 06:

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.

Step 07:

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.

Clone this wiki locally