TensorFlow SSD config file

Overview

In order to use TensorFlow* SSD networks with the NCSDK Toolkit commands (mvNCCompile, mvNCCheck, mvNCProfile), users will need to create a new config file and use the --tf-ssd-config option with the associated command.

NCSDK SSD Config File Example

Here is an example of an NCSDK compatible TensorFlow SSD config file that shows how to set the different parameters:

input_height: 300
input_width: 300

postprocessing_params {
    num_classes: 91
    background_label_id: 0
    max_detections: 100

    nms_params {
        score_threshold: 0.300000011921
        iou_threshold: 0.600000023842
        max_detections_per_class: 100
    }

    box_params {
        var: 0.1
        var: 0.1
        var: 0.2
        var: 0.2
  }
}

score_converter: SIGMOID

The NCSDK SSD config file contains information relevent to the network:

Parameter Description
input_height Input height of the network.
input_width Input width of the network.
num_classes Number of different labels/objects that the model will be able to detect. Includes the background label.
background_label_id Id of the background label.
max_detections Total number of objects that can be detected in a single image.
score_threshold Minimum score for detected objects. The model will ignore all detected objects with a score lower than the specified threshold. Scores range from 0.0 to 1.0.
iou_threshold Intersection over union threshold value. Used to eliminate potential duplicate objects that are detected.
box_param Variance of the bounding box. This affects the size and position of the bounding boxes.

1. The first value (0.1 in the example) is the variance for the Y position for the center of the boxes.
2. The second value (0.1 in the example) is the variance for the X position for the center of the boxes.
3. The third value (0.2 in the example) is the variance for the height of the boxes.
4. The fourth value (0.2 in the example) is the variance for the width of the boxes.

Note: If you use other values than those in the example, you may want to also adjust the iou_threshold value since the box overlaps wil be affected.
score_converter Function that will convert/normalize the output scores. Available options: SIGMOID, SOFTMAX.

Example of a mvNCCheck command using the –tf-ssd-config option:

mvNCCheck -s 12 frozen_inference_graph.pb --tf-ssd-config ssd_mob.config -i 300_Cellphone.jpg -cs 0,1,2 -M "123,117,104" -S 255

NOTE: In order to use mvNCCheck with a TensorFlow SSD network, an image must be specified as input. This image must also be the same input resolution as required by the TensorFlow SSD network. The following Python code snippet may be useful in resizing an image to be used with mvNCCheck.

import cv2
img = cv2.imread('IMAGE_FILENAME.jpg')
new_img = cv2.resize(img, (300, 300))
cv2.imwrite('NEW_FILENAME.jpg', new_img)

Example of a mvNCCompile command using the –tf-ssd-config option:

mvNCCompile -s 12 frozen_inference_graph.pb --tf-ssd-config ssd_mob.config

Example of a mvNCProfile command using the –tf-ssd-config option:

mvNCProfile -s 12 frozen_inference_graph.pb --tf-ssd-config ssd_mob.config