yolo-v4-tf

Use Case and High-Level Description

YOLO v4 is a real-time object detection model based on "YOLOv4: Optimal Speed and Accuracy of Object Detection" paper. It was implemented in Keras* framework and converted to TensorFlow* framework. For details see repository. This model was pre-trained on Common Objects in Context (COCO) dataset with 80 classes.

Specification

Metric Value
Type Detection
GFLOPs 129.5567
MParams 64.33
Source framework Keras*

Accuracy

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

Metric Value
mAP 71.23%
COCO mAP (0.5) 77.40%
COCO mAP (0.5:0.05:0.95) 50.26%

Input

Original model

Image, name - image_input, shape - 1, 608, 608, 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 - image_input, shape - 1, 3, 608, 608, format is B, C, H, W, where:

  • B - batch size
  • C - channel
  • H - height
  • W - width

Channel order is BGR.

Output

Original model

  1. The array of detection summary info, name - conv2d_93/BiasAdd, shape - 1, 76, 76, 255. The anchor values are 12,16, 19,36, 40,28.
  2. The array of detection summary info, name - conv2d_101/BiasAdd, shape - 1, 38, 38, 255. The anchor values are 36,75, 76,55, 72,146.
  3. The array of detection summary info, name - conv2d_109/BiasAdd, shape - 1, 19, 19, 255. The anchor values are 142,110, 192,243, 459,401.

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 - StatefulPartitionedCall/model/conv2d_93/BiasAdd/Add, shape - 1, 255, 76, 76. The anchor values are 12,16, 19,36, 40,28.
  2. The array of detection summary info, name - StatefulPartitionedCall/model/conv2d_101/BiasAdd/Add, shape - 1, 255, 38, 38. The anchor values are 36,75, 76,55, 72,146.
  3. The array of detection summary info, name - StatefulPartitionedCall/model/conv2d_109/BiasAdd/Add, shape - 1, 255, 19, 19. The anchor values are 142,110, 192,243, 459,401.

For each case format is B, N*85, Cx, Cy, 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) - 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.

Download a Model and Convert it into Inference Engine Format

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

An example of using the Model Downloader:

python3 <omz_dir>/tools/downloader/downloader.py --name <model_name>

An example of using the Model Converter:

python3 <omz_dir>/tools/downloader/converter.py --name <model_name>

Legal Information

The original model is distributed under the following license:

MIT License
Copyright (c) 2019 david8862
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.