| | |
| | | |
| | | 5. Run command: `type 2007_train.txt 2007_val.txt 2012_*.txt > train.txt` |
| | | |
| | | 6. Set `batch=64` and `subdivisions=8` in the file `yolo-voc.cfg`: [link](https://github.com/AlexeyAB/darknet/blob/master/build/darknet/x64/yolo-voc.cfg#L3) |
| | | 6. Set `batch=64` and `subdivisions=8` in the file `yolo-voc.2.0.cfg`: [link](https://github.com/AlexeyAB/darknet/blob/master/build/darknet/x64/yolo-voc.cfg#L3) |
| | | |
| | | 7. Start training by using `train_voc.cmd` or by using the command line: `darknet.exe detector train data/voc.data yolo-voc.cfg darknet19_448.conv.23` |
| | | 7. Start training by using `train_voc.cmd` or by using the command line: `darknet.exe detector train data/voc.data yolo-voc.2.0.cfg darknet19_448.conv.23` |
| | | |
| | | If required change pathes in the file `build\darknet\x64\data\voc.data` |
| | | |
| | |
| | | |
| | | ## How to train with multi-GPU: |
| | | |
| | | 1. Train it first on 1 GPU for like 1000 iterations: `darknet.exe detector train data/voc.data yolo-voc.cfg darknet19_448.conv.23` |
| | | 1. Train it first on 1 GPU for like 1000 iterations: `darknet.exe detector train data/voc.data yolo-voc.2.0.cfg darknet19_448.conv.23` |
| | | |
| | | 2. Then stop and by using partially-trained model `/backup/yolo-voc_1000.weights` run training with multigpu (up to 4 GPUs): `darknet.exe detector train data/voc.data yolo-voc.cfg yolo-voc_1000.weights -gpus 0,1,2,3` |
| | | 2. Then stop and by using partially-trained model `/backup/yolo-voc_1000.weights` run training with multigpu (up to 4 GPUs): `darknet.exe detector train data/voc.data yolo-voc.2.0.cfg yolo-voc_1000.weights -gpus 0,1,2,3` |
| | | |
| | | https://groups.google.com/d/msg/darknet/NbJqonJBTSY/Te5PfIpuCAAJ |
| | | |
| | | ## How to train (to detect your custom objects): |
| | | |
| | | 1. Create file `yolo-obj.cfg` with the same content as in `yolo-voc.cfg` (or copy `yolo-voc.cfg` to `yolo-obj.cfg)` and: |
| | | 1. Create file `yolo-obj.cfg` with the same content as in `yolo-voc.2.0.cfg` (or copy `yolo-voc.2.0.cfg` to `yolo-obj.cfg)` and: |
| | | |
| | | * change line batch to [`batch=64`](https://github.com/AlexeyAB/darknet/blob/master/build/darknet/x64/yolo-voc.cfg#L3) |
| | | * change line subdivisions to [`subdivisions=8`](https://github.com/AlexeyAB/darknet/blob/master/build/darknet/x64/yolo-voc.cfg#L4) |
| | | * change line `classes=20` to your number of objects |
| | | * change line #237 from [`filters=125`](https://github.com/AlexeyAB/darknet/blob/master/cfg/yolo-voc.cfg#L237) to `filters=(classes + 5)*5` (generally this depends on the `num` and `coords`, i.e. equal to `(classes + coords + 1)*num`) |
| | | |
| | | For example, for 2 objects, your file `yolo-obj.cfg` should differ from `yolo-voc.cfg` in such lines: |
| | | For example, for 2 objects, your file `yolo-obj.cfg` should differ from `yolo-voc.2.0.cfg` in such lines: |
| | | |
| | | ``` |
| | | [convolutional] |
| | |
| | | |
| | | ``` |
| | | classes= 2 |
| | | train = train.txt |
| | | valid = test.txt |
| | | names = obj.names |
| | | train = data/train.txt |
| | | valid = data/test.txt |
| | | names = data/obj.names |
| | | backup = backup/ |
| | | ``` |
| | | |
| | |
| | | |
| | | 8. Start training by using the command line: `darknet.exe detector train data/obj.data yolo-obj.cfg darknet19_448.conv.23` |
| | | |
| | | (file `yolo-obj_xxx.weights` will be saved to the `build\darknet\x64\backup\` for each 100 iterations until 1000 iterations has been reached, and after for each 1000 iterations) |
| | | |
| | | 9. After training is complete - get result `yolo-obj_final.weights` from path `build\darknet\x64\backup\` |
| | | |
| | | * After each 1000 iterations you can stop and later start training from this point. For example, after 2000 iterations you can stop training, and later just copy `yolo-obj_2000.weights` from `build\darknet\x64\backup\` to `build\darknet\x64\` and start training using: `darknet.exe detector train data/obj.data yolo-obj.cfg yolo-obj_2000.weights` |
| | |
| | | * **9002** - iteration number (number of batch) |
| | | * **0.060730 avg** - average loss (error) - **the lower, the better** |
| | | |
| | | When you see that average loss **0.060730 avg** enough low at many iterations and no longer decreases then you should stop training. |
| | | When you see that average loss **0.xxxxxx avg** no longer decreases at many iterations then you should stop training. |
| | | |
| | | 2. Once training is stopped, you should take some of last `.weights`-files from `darknet\build\darknet\x64\backup` and choose the best of them: |
| | | |
| | |
| | | |
| | |  |
| | | |
| | | To get weights from Early Stopping Point: |
| | | |
| | | 2.1. At first, in your file `obj.data` you must specify the path to the validation dataset `valid = valid.txt` (format of `valid.txt` as in `train.txt`), and if you haven't validation images, just copy `data\train.txt` to `data\valid.txt`. |
| | | |
| | | 2.2 If training is stopped after 9000 iterations, to validate some of previous weights use this commands: |
| | |
| | | > 7586 7612 7689 RPs/Img: 68.23 **IOU: 77.86%** Recall:99.00% |
| | | |
| | | * **IOU** - the bigger, the better (says about accuracy) - **better to use** |
| | | * **Recall** - the bigger, the better (says about accuracy) |
| | | * **Recall** - the bigger, the better (says about accuracy) - actually Yolo calculates true positives, so it shouldn't be used |
| | | |
| | | For example, **bigger IUO** gives weights `yolo-obj_8000.weights` - then **use this weights for detection**. |
| | | For example, **bigger IOU** gives weights `yolo-obj_8000.weights` - then **use this weights for detection**. |
| | | |
| | | |
| | |  |