|
Snapdragon Neural Processing Engine SDK
Reference Guide
|
Tensorflow DeepLabv3 model
Preprocessing Input Images
Running the model in SNPE
Postprocessing Output Segmentation Maps
A specific version of the Tensorflow DeepLabv3 model has been tested: deeplabv3_mnv2_pascal_train_aug_2018_01_29.tar. This version of DeepLabv3 uses MobileNet-v2 as the backbone and has been pretrained on the Pascal VOC 2012 dataset.
Download the model.
wget http://download.tensorflow.org/models/deeplabv3_mnv2_pascal_train_aug_2018_01_29.tar.gz
After downloading the model extract the contents to a directory.
tar xzvf deeplabv3_mnv2_pascal_train_aug_2018_01_29.tar.gz
Convert the model using the snpe-tensorflow-to-dlc converter.
snpe-tensorflow-to-dlc --input_network deeplabv3_mnv2_pascal_train_aug/frozen_inference_graph.pb --input_dim sub_7 1,513,513,3 --out_node ArgMax --output_path deeplabv3.dlc --allow_unconsumed_nodes
The output layers for the model is:
The output buffer names is:
SNPE does not support the preprocessing done within the DeepLabv3 model. Preprocessing must be done offline before the images are run. In the preprocessing phase, images must be resized to 513x513x3 and the pixels must be normalized to be between -1 to 1.
The following steps need to be performed on all input images in this exact order:
resize_ratio = 513.0 / max(width, height) target_size = (int(resize_ratio * width), int(resize_ratio * height))
The following are limitations and suggestions for running DLC model in SNPE:
–runtime_order option Running DeepLabv3 with SNPE will produce an output segmentation map of size 513x513x1 where every element is an integer that represents a class (e.g. 0=background, etc.).
However the output of SNPE still has the padding applied in the preprocessing step. This padding must be cropped out and the image should be resized to the orginal size.
The following steps should be taken in order to get the same dimensions as the original image: