yolo-v3-tf

Use Case and High-Level Description

YOLO v3 is a real-time object detection model implemented with Keras* from this repository and converted to TensorFlow* framework. This model was pre-trained on Common Objects in Context (COCO) dataset with 80 classes.

Conversion

  1. Download or clone the official repository (tested on d38c3d8 commit).

  2. Use the following commands to get original model (named yolov3 in repository) and convert it to Keras* format (see details in the README.md file in the official repository):

    1. Download YOLO v3 weights:

      wget -O weights/yolov3.weights https://pjreddie.com/media/files/yolov3.weights
    2. Convert model weights to Keras*: ` python tools/model_converter/convert.py cfg/yolov3.cfg weights/yolov3.weights weights/yolov3.h5 `

  3. Convert model to protobuf:

    python tools/model_converter/keras_to_tensorflow.py --input_model weights/yolov3.h5 --output_model=weights/yolo-v3.pb

Specification

Metric

Value

Type

Detection

GFLOPs

65.984

MParams

61.922

Source framework

Keras*

Accuracy

Accuracy metrics obtained on Common Objects in Context (COCO) validation dataset for converted model.

Metric

Value

mAP

62.27%

COCO mAP

67.7%

Input

Original model

Image, name - input_1, shape - 1, 416, 416, 3, format is B, H, W, C, where:

  • B - batch size

  • H - height

  • W - width

  • C - channel

Channel order is RGB. Scale value - 255.

Converted model

Image, name - input_1, shape - 1, 416, 416, 3, format is B, H, W, C, where:

  • B - batch size

  • H - height

  • W - width

  • C - channel

Channel order is BGR.

Output

Original model

  1. The array of detection summary info, name - conv2d_58/BiasAdd, shape - 1, 13, 13, 255. The anchor values are 116,90, 156,198, 373,326.

  2. The array of detection summary info, name - conv2d_66/BiasAdd, shape - 1, 26, 26, 255. The anchor values are 30,61, 62,45, 59,119.

  3. The array of detection summary info, name - conv2d_74/BiasAdd, shape - 1, 52, 52, 255. The anchor values are 10,13, 16,30, 33,23.

For each case format is B, Cx, Cy, N\*85,, where:

  • B - batch size

  • Cx, Cy - cell index

  • N - number of detection boxes for cell

Detection box has format [x, y, h, w, box_score, class_no_1, …, class_no_80], where:

  • (x, y) - raw coordinates of box center, apply sigmoid function to get relative to the cell coordinates

  • h, w - raw height and width of box, apply exponential function and multiply by corresponding anchors to get absolute height and width values

  • box_score - confidence of detection box, apply sigmoid function to get confidence in [0, 1] range

  • class_no_1, …, class_no_80 - probability distribution over the classes in logits format, apply sigmoid function and multiply by obtained confidence value to get confidence of each class

The model was trained on Common Objects in Context (COCO) dataset version with 80 categories of object. Mapping to class names provided in <omz_dir>/data/dataset_classes/coco_80cl.txt file.

Converted model

  1. The array of detection summary info, name - conv2d_58/BiasAdd/YoloRegion, shape - 1, 13, 13, 255. The anchor values are 116,90, 156,198, 373,326.

  2. The array of detection summary info, name - conv2d_66/BiasAdd/YoloRegion, shape - 1, 26, 26, 255. The anchor values are 30,61, 62,45, 59,119.

  3. The array of detection summary info, name - conv2d_74/BiasAdd/YoloRegion, shape - 1, 52, 52, 255. The anchor values are 10,13, 16,30, 33,23.

For each case format is B, Cx, Cy, N\*85, where:

  • B - batch size

  • N - number of detection boxes for cell

  • Cx, Cy - cell index

Detection box has format [x, y, h, w, box_score, class_no_1, …, class_no_80], where:

  • (x, y) - coordinates of box center relative to the cell

  • h, w - raw height and width of box, apply exponential function and multiply by corresponding anchors to get absolute height and width values

  • box_score - confidence of detection box in [0, 1] range

  • class_no_1, …, class_no_80 - probability distribution over the classes in the [0, 1] range, multiply by confidence value to get confidence of each class

The model was trained on Common Objects in Context (COCO) dataset version with 80 categories of object. Mapping to class names provided in <omz_dir>/data/dataset_classes/coco_80cl.txt file.

Download a Model and Convert it into OpenVINO™ IR Format

You can download models and if necessary convert them into OpenVINO™ IR format using the Model Downloader and other automation tools as shown in the examples below.

An example of using the Model Downloader:

omz_downloader --name <model_name>

An example of using the Model Converter:

omz_converter --name <model_name>

Demo usage

The model can be used in the following demos provided by the Open Model Zoo to show its capabilities: