Code Monkey home page Code Monkey logo

qat_demo's Introduction

QAT_demo

Show how to use QAT in TF1.x to train a network for mnist and convert it into TensorRT engine.

Do it step by step.

  • 0.1 docker pull nvcr.io/nvidia/tensorflow:20.01-tf1-py3

  • 0.2 docker run --rm -it --gpus all nvcr.io/nvidia/tensorflow:20.01-tf1-py3

  • 0.3 git clone https://github.com/shiyongming/QAT_demo.git

  • 0.4 cd QAT_demo/

  • 0.5 pip install -r requirements.txt

  • 0.6 cd onnx-graphsurgeon && make install

  • 0.7 cd ..

  • 1 python qat_training.py

  • 2 python export_freezn_graph.py

  • 3 python fold_constants.py -i saved_results/frozen_graph.pb

  • 4

  python3 -m tf2onnx.convert --input saved_results/folded_mnist.pb\
                              --output saved_results/mnist_qat.onnx \
                              --inputs input_0:0 \
                              --outputs softmax_1:0 \
                              --opset 11 
  • 5 python postprocess_onnx.py --input saved_results/mnist_qat.onnx --output saved_results/mnist_qat_post.onnx
  • 6 python build_engine.py --onnx saved_results/mnist_qat_post.onnx --engine saved_results/mnist_qat.engine -v
  • 7 trtexec --loadEngine=saved_results/mnist_qat.engine
  • 8 python infer_checkAcc.py -e saved_results/mnist_qat.engine -b 1

The result of Step 8 looks abnormal. It may be casued by the wrong scale of input placeholder.

qat_demo's People

Contributors

shiyongming avatar

Stargazers

Ceyda Sahin avatar wili avatar autoregister avatar Yiming Liu avatar

Watchers

 avatar

Forkers

li2508264

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.