Skip to content
Mitesh Patel edited this page May 27, 2020 · 1 revision

Welcome to the FXPAL darknet wiki!

How to train (transfer learn) your own dataset.

On gpu04 using conda.

clone

git clone https://github.com/FXPAL/darknet

Environment installation

Create conda env and install all the requirements in the darknet_requirement.txt file located in darknet main folder using the below command

conda install --file=darknet_conda_requirements.txt

Hack for telling nvcc to use gcc-5 (requirment for NVCC)

Go to /usr/local/cuda/bin folder and create a soft link pointing to gcc and g++ 5

ln -s /usr/bin/gcc-5 gcc
ln -s /usr/bin/g++-5 g++

Compiling

Go to darknet folder and use make command

It should compile without complains with GPU support.

Training and testing

./darknet detector train data_mitesh/obj.data cfg/yolov3-obj.cfg build/darknet/x64/darknet53.conv.74 -dont_show
./darknet detector test cfg/openimages.data cfg/yolov3-openimages.cfg weights/yolov3-openimages.weights -dont_show -ext_output < build/darknet/x64/data/train.txt >  result.txt

NOTE:

For training and testing darknet has specific data format requirement. Refer to https://github.com/FXPAL/darknet/blob/master/README.md

Things to know while training and/or transfer learning on YOLO-V3:

Segmentation fault errors:

  • https://github.com/pjreddie/darknet/issues/288 : I followed this issue and checked my label.txt file to see there were values close to 0.0 e.g. 0.001. I wrote script named check_bounded_boxes.py located in script folder. Using this I found that I had a very many values in the range of 0.01 and 0.001. Hence removing them won't be ideal for my case. Not sure if this is helping my trainer or not.. (still needs to be tested)
  • Conversely, there was another comment in the issues/288 which said that turn the random flag to 0. This will make sure that the image is not resized randomly which goes into the a high dimension range and hence leads to segmentation fault as CUDA is not able to allocate that much memory. (by doing so the code ran without seg faulting)

Details of parameters in yolov3.cfg file:

Importance of Random flag in cfg file and anchor calculation

details of console output on yolo V3 (ref: https://github.com/AlexeyAB/darknet/issues/636) :

  • Region 82 - index of current [yolo]-layer (in the default yolov3.cfg there are 3 yolo layers: 82, 94, 106)
  • Avg IOU - is average intersect of union between Detected objects and Ground truth from label-txt-file
  • Class: - is average of the probabilities of correctly classified objects
  • Obj: - is average of the objectness T0 (probabilities that there is an object in this box (anchor))
  • .5R: - is average true positives with (IoU > 0.5)
  • .75R: - is average true positives with (IoU > 0.75)