Giter Site home page Giter Site logo

snpe_convert's Introduction

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\: 

snpe_convert's People

Contributors

rakelkar avatar rakelkar-msft avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

snpe_convert's Issues

RuntimeError

Any idea for the below error

saini@saini:~/deeplearning/SNPE/snpe-1.29.0.456$ python /home/saini/flawer/show_classifications.py -i /home/saini/flawer/samples.txt -o /home/saini/flawer/flower_output/ -l /home/saini/flawer/labels.txt -s /home/saini/flawer/flower_output/Result_0/detection_classes\:
Classification results
Result_0
/home/saini/flawer/flower_output/Result_0/detection_classes:0.raw
Traceback (most recent call last):
  File "/home/saini/flawer/show_classifications.py", line 92, in <module>
    main()
  File "/home/saini/flawer/show_classifications.py", line 66, in main
    raise RuntimeError(str(len(float_array)) + ' outputs in ' + cur_results_file)
RuntimeError: 100 outputs in /home/saini/flawer/flower_output/Result_0/detection_classes:0.raw

please help

Hi, Rakelkar,
question: can the snpe-net-run run the dlc on a PC ubuntu environment?
if yes, could you please share all the necessary files to run through this repo?
like flowers.dlc etc...

many thanks,
q

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.