This document describes the step-by-step to reproduce Yolo-v3 tuning result with Neural Compressor.
Recommend python 3.6 or higher version.
# Install Intel® Neural Compressor
pip install neural-compressor
pip install intel-tensorflow==1.15.0up3
Note: Supported Tensorflow versions please refer to Neural Compressor readme file.
cd examples/tensorflow/object_detection
pip install -r requirements.txt
git clone https://github.com/mystic123/tensorflow-yolo-v3.git
cd tensorflow-yolo-v3
wget https://raw.githubusercontent.com/pjreddie/darknet/master/data/coco.names
wget https://pjreddie.com/media/files/yolov3.weights
python convert_weights_pb.py --class_names coco.names --weights_file yolov3.weights --data_format NHWC --size 416 --output_graph yolov3.pb
Note:
prepare_dataset.sh
script works with TF version 1.x.
Run the prepare_dataset.sh
script located in examples/tensorflow/object_detection
.
Usage:
cd examples/tensorflow/object_detection
. prepare_dataset.sh
This script will download the train, validation and test COCO datasets. Furthermore it will convert them to
tensorflow records using the https://github.com/tensorflow/models.git
dedicated script.
Download CoCo Dataset from Official Website.
Usage
cd examples/tensorflow/object_detection/yolo_v3
python infer_detections.py --input_graph /path/to/yolov3_fp32.pb --config ./yolo_v3.yaml --output_graph /path/to/save/yolov3_tuned3.pb
Finally, the program will generate the quantized Yolo-v3 model with relative 1% loss.