Skip to content

jamesjakeies/YOLOv3-Pytorch-better

Repository files navigation

YOLOv3 by Pytorch

Train

$ train.py [-h] [--epochs EPOCHS] [--batch_size BATCH_SIZE]
                [--gradient_accumulations GRADIENT_ACCUMULATIONS]
                [--model_def MODEL_DEF] [--data_config DATA_CONFIG]
                [--pretrained_weights PRETRAINED_WEIGHTS] [--n_cpu N_CPU]
                [--img_size IMG_SIZE]
                [--checkpoint_interval CHECKPOINT_INTERVAL]
                [--evaluation_interval EVALUATION_INTERVAL]
                [--compute_map COMPUTE_MAP]
                [--multiscale_training MULTISCALE_TRAINING]

Example (COCO)

To train on COCO using a Darknet-53 backend pretrained on ImageNet run:

$ python3 train.py --data_config config/coco.data  --pretrained_weights weights/darknet53.conv.74

Training log

---- [Epoch 7/100, Batch 7300/14658] ----
+------------+--------------+--------------+--------------+
| Metrics    | YOLO Layer 0 | YOLO Layer 1 | YOLO Layer 2 |
+------------+--------------+--------------+--------------+
| grid_size  | 16           | 32           | 64           |
| loss       | 1.554926     | 1.446884     | 1.427585     |
| x          | 0.028157     | 0.044483     | 0.051159     |
| y          | 0.040524     | 0.035687     | 0.046307     |
| w          | 0.078980     | 0.066310     | 0.027984     |
| h          | 0.133414     | 0.094540     | 0.037121     |
| conf       | 1.234448     | 1.165665     | 1.223495     |
| cls        | 0.039402     | 0.040198     | 0.041520     |
| cls_acc    | 44.44%       | 43.59%       | 32.50%       |
| recall50   | 0.361111     | 0.384615     | 0.300000     |
| recall75   | 0.222222     | 0.282051     | 0.300000     |
| precision  | 0.520000     | 0.300000     | 0.070175     |
| conf_obj   | 0.599058     | 0.622685     | 0.651472     |
| conf_noobj | 0.003778     | 0.004039     | 0.004044     |
+------------+--------------+--------------+--------------+
Total Loss 4.429395
---- ETA 0:35:48.821929

Tensorboard

Track training progress in Tensorboard:

$ tensorboard --logdir='logs' --port=6006

Train on VOC custom datasets

####you should create three Directories in Directory 'data'

$----data
    --Annotations
     --ImageSets
     --JPEGImages

If you wanna use the custom dataset of VOC,please set up you classes what u want to train,just as: from the path

data\custom

you can look a file named 'class.names '

click the file

write you class on the file, just as

aircraft

Run 
$ cd data 
$ python label.py
$ cd ..
$ python voc_annotation.py

Train

To train on the custom dataset run:

$ python train.py --model_def config/yolov3-tiny.cfg --data_config config/custom.data --python train.py --pretrained_weights weights/yolov3-tiny.conv.15

Add --pretrained_weights weights/darknet53.conv.74 to train using a backend pretrained on ImageNet.

About

YOLOv3 Pytorch better

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages