Coder Social home page Coder Social logo

tfmodeltoedge's Introduction

TF Keras to Xilinx Zynq (Ultra96v2) design flow

This repo contains all files for compilation and deployment. (Note: check out this project for more detailed explanation.)

List of files:


File name description comment
hw_files hardware description files for DPU on Ultra96 v2 -
docker_run.sh starts the docker for VITIS AI with required parameters ! conda activate vitis-ai-tensorflow
h5topb.py loads weights (hdf5 format) and converts to TensorFlow .pb format run inside VITIS AI docker for TF version 1.15
freeze.sh script to freeze the converted model run inside docker
quantize.sh script to quantize the frozen model run inside docker
unet.py Unet model from dhkim0225 -
compile.sh script for compilation inside docker

Step 1: Convert Model to .pb format

h5topb.py -> provide file path to hdf5 encoded weights

! run inside VITIS AI docker or with tensorflow v1.15 and keras==2.2.4

Step 2: Freeze the converted Model

freeze.sh -> changed input and output node names accordingly

Step 3: Quantization

quantize.sh -> provide a subset of the image dataset previously used for training or validation and adjust path in graph_input_fn.py accordingly. This python script is required for calibration of the quantized model.

! Make sure that output and input labels are correct for quantize.shand graph_input_fn.py

Step 4: Compilation

compile.sh -> DPU hardware files can be retrieved through DPU-PYNQ build.

Troubleshooting

Freezing fails:

  • IndexError: list index out of range

    Make sure the docker image is modified such that conda has correct keras==2.2.4 package installed:

     ./docker_run.sh xilinx/vitis-ai-cpu:latest
     sudo su
     conda activate vitis-ai-tensorflow
     conda install keras==2.2.4  # compatible with TF 1.15
     conda deactivate
     exit
     conda activate vitis-ai-tensorflow
    

    Stage your modifications for the next docker restart:

     sudo docker commit -m "<message>" <image_id> xilinx/vitis-ai-cpu:latest
    

tfmodeltoedge's People

Contributors

swappad avatar

Stargazers

Kien Le-Trung  avatar  avatar Vinayak Sankar avatar Omkar Bhilare avatar  avatar Jum avatar Lrwin16g avatar Jonas Otto avatar

Watchers

James Cloos avatar  avatar

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.