This repo is the implementation of YOLOv3 with Tensorflow 2. It refers to many repos as mentioned in Acknowledgments.
Original paper: YOLOv3: An Incremental Improvemen by Joseph Redmon and Ali Farhadi.
Darknet: https://github.com/pjreddie/darknet
yolov3_step_by_step.ipynb
-
Please download the VOC2012 dataset and put it into
data
folder.$ mkdir data $ wget http://host.robots.ox.ac.uk/pascal/VOC/voc2012/VOCtrainval_11-May-2012.tar -O ./data/VOCtrainval_11-May-2012.tar $ tar xvf ./data/VOCtrainval_11-May-2012.tar --directory ./data
-
Split dataset and transfer to
tfrecord
.# train $ python3 voc2012.py \ --data_dir ./data/VOCdevkit/VOC2012/ \ --split train \ --output_dir ./data # val $ python3 voc2012.py \ --data_dir ./data/VOCdevkit/VOC2012/ \ --split val \ --output_dir ./data
-
Validate the dataset
$ python3 visualize.py
$ python3 train.py --transfer=Fasle
-
Download pre-trained Darknet weights
$ wget https://pjreddie.com/media/files/yolov3.weights -O model_data/yolov3.weights
-
Convert Darknet weights to Tensorflow weights
$ mkdir -p checkpoints $ python3 convert.py
-
Validate pre-trained weight
$ python3 detect.py
-
Training
$ python3 train.py \ --size 416 \ --epochs 10 \ --num_classes 20 \ --batch_size 16 \ --train_dataset ./data/voc2012_train.tfrecord \ --val_dataset ./data/voc_2012_val.tfrecord \ --transfer=True \ --pretrained_weights ./checkpoints/yolov3.tf \ --weights_num_classes 80
-
Inference with pre-trained Darknet weights
$ python3 detect.py
-
Inference with the model that you just trained
$ python3 detect.py \ --classes ./model_data/voc2012_classes.txt \ --num_classes 20 \ --weights=./checkpoints/yolov3_train_10.tf \ --image=./data/street.jpg
-
Other command option please using
--help
to see, as below:$ python3 detect.py --help
-
- official yolov3 implementation
-
- models
-
- models
- loss functions
-
- models
- loss functions