Skip to content

zx854217561/YOLOv3-tf2.0

 
 

Repository files navigation

YOLOv3-tf2.0

YOLOv3 implemented with tensorflow 2.0

how to train on MS COCO 2014

download datasets by executing the following command

python3 download_datasets.py

make sure no errors occur during the execution.

then train the model by executing the following command

python3 train_eager.py

or

python3 train_keras.py

here are some results of my model which can be downloaded here with password mvvj. I trained YOLO v3 from scratch for 500k iterations with batch size 8 on a single gtx 1080 ti. which is far from the quality of the official darknet model which was trained on four gtx1080 for 500k iterations. I show my result here anyway.

Loss
train loss
validation loss

Detection results

how to predict with the trained model

detect objects in an image by executing the following command

python3 Predictor.py <path/to/image>

how to train YOLOv3 on your own data

compose label file in the following format.

<path/to/image1> <target num>
<x> <y> <width> <height> <label>
<x> <y> <width> <height> <label>
...
<x> <y> <width> <height> <label>
<path/to/image2> <target num>
...

generate tfrecord file by executing the following command.

python3 create_dataset.py <path/to/annotation>

the script will generate trainset.tfrecord and validationset.tfrecord.

read the tfrecord with following code.

from create_dataset import parse_function_generator;
trainset = tf.data.TFRecordDataset('trainset.tfrecord').map(parse_function_generator(num_classes = num_classes)).repeat(100).shuffle(batch_size).batch(batch_size).prefetch(tf.data.experimental.AUTOTUNE);

About

YOLOv3 implemented with tensorflow 2.0

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%