yolo-v1-tiny-tf

Use Case and High-Level Description

YOLO v1 Tiny is a real-time object detection model from TensorFlow.js* framework. This model was pretrained on VOC* dataset with 20 classes.

Conversion

0. Install additional dependencies: ``` h5py keras tensorflowjs ``

  1. Download model from [here](https://github.com/shaqian/tfjs-yolo-demo/tree/master/dist/model/v1tiny) (tested onaa4354ccommit).
  2. Convert model to Keras\* format usingtensorflowjs_converterscript, e.g.: `` tensorflowjs_converter –input_format tfjs_layers_model –output_format keras <model_in>.json <model_out>.h5 ```
  3. Convert the produced model to protobuf format.
    1. Get conversion script from repository: ```buildoutcfg git clone https://github.com/amir-abdi/keras_to_tensorflow ```
    1. (Optional) Checkout the commit that the conversion was tested on: ``` git checkout c841508a88faa5aa1ffc7a4947c3809ea4ec1228 ``
    1. Applykeras_to_tensorflow.py.patch<tt>: `` git apply keras_to_tensorflow.py.patch ```
    1. Run script: ``` python keras_to_tensorflow.py –input_model=<model_in>.h5 –output_model=<model_out>.pb ```

Specification

Metric Value
Type Detection
GFLOPs 6.988
MParams 15.858
Source framework TensorFlow.js*

Accuracy

Accuracy metric obtained on VOC2012* validation dataset for converted model.

Metric Value
mAP 72.17%

Input

Original model

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

Channel order is RGB. Scale value - 255.

Converted model

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

Channel order is BGR.

Output

Original model

The array of detection summary info, name - conv2d_9/BiasAdd, shape - 1,13,13,125, format is B,Cx,Cy,N*25 where

Detection box has format [x,y,h,w,box_score,class_no_1, ..., class_no_20], where:

The anchor values are 1.08,1.19, 3.42,4.41, 6.63,11.38, 9.42,5.11, 16.62,10.52.

Converted model

The array of detection summary info, name - conv2d_9/BiasAdd/YoloRegion, shape - 1,21125, which could be reshaped to 1, 125, 13, 13, format is B,N*25,Cx,Cy where

Detection box has format [x,y,h,w,box_score,class_no_1, ..., class_no_20], where:

The anchor values are 1.08,1.19, 3.42,4.41, 6.63,11.38, 9.42,5.11, 16.62,10.52.

Legal Information

The original model is distributed under the following license:

Copyright (c) 2018 Qian Sha
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.