YOLOv3 implemented with tensorflow 2.0
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
Detection results
detect objects in an image by executing the following command
python3 Predictor.py <path/to/image>
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);