Skip to content

Convert and run a TF model using Qualcomm SNPE tools

Notifications You must be signed in to change notification settings

rakelkar/snpe_convert

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

snpe_convert

Scripts to convert and run a TF model using Qualcomm SNPE tools

The tensorflow for poets repo is a good one to get scripts to create and validate a simple PB file and also get training data. This repo has tools that help run SNPE tools on the PB and data....

Prepare images

Assumes you have created a MobileNet_V1 model from scratch or retrained one using TF for poets walkthrough.

  1. Get the data Based on the TF for poets walkthough
curl http://download.tensorflow.org/example_images/flower_photos.tgz \
    | tar xz -C tf_files
    
ls tf_files/flower_photos/ | grep -v LICENSE > labels.txt
  1. Sample the data
random_sample.py tf_files/flower_photos/ samples/
  1. convert images to raw format (with mean subtraction etc)
 python ./toraw.py samples/
 find samples/ -name *.raw > samples.txt

Convert & Quantize

Requires you to have SNPE tools setup

  1. convert the model
snpe-tensorflow-to-dlc --graph flowers.pb -i input 1,224,224,3 --out_node MobilenetV1/Predictions/Reshape_1 --allow_unconsumed_nodes
  1. quantize the model
snpe-dlc-quantize --input_dlc flowers.dlc --output_dlc flowers_q.dlc --input_list samples.txt

Inference Images

  1. run inferencing
snpe-net-run --container flowers.dlc --input_list samples.txt --output_dir flower_output

  1. show results
python show_classifications.py -i samples.txt -o flower_output -l labels.txt -s MobilenetV1/Predicti
ons/Reshape_1\: 

About

Convert and run a TF model using Qualcomm SNPE tools

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages