GithubHelp home page GithubHelp logo

seeker1943 / kerastotensorrt Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jeng1220/kerastotensorrt

0.0 0.0 0.0 25.53 MB

This is a simple demonstration for running Keras model model on Tensorflow with TensorRT integration(TFTRT) or on TensorRT directly without invoking "freeze_graph.py".

Python 100.00%

kerastotensorrt's Introduction

Keras to TensorRT Examples

This is a simple demonstration for running Keras model model on Tensorflow with TensorRT integration(TFTRT) or on TensorRT directly without invoking "freeze_graph.py".

Note: Recommend that use NVIDIA Tensorflow docker image to run these examples. You can download the images from NVIDIA NGC.

Requirement

  • Python (both 2 and 3 are ok)
  • TensorRT (> 3.0)
  • Tensorflow with TensorRT integration (> 1.7)
  • Keras

if you want to run model on TensorRT directly, Pycuda is also needed:

  • Pycuda (> 2017.1.1)

Examples

tftrt_example.py demonstrates how to run Keras model on TFTRT. This approach supports both NCHW and NHWC format because Tensorflow can handles format issue.

$ python tftrt_example.py

tftrt_resnet_example.py demonstrates how to run Keras Applications ResNet50 on TFTRT.

$ python tftrt_resnet_example.py

tftrt_multi_inputs_mutli_outputs_example.py demonstrates how to run a multi-input/output Keras model on TFTRT.

$ python tftrt_multi_inputs_mutli_outputs_example.py

trt_example.py demonstrates how to run Keras model on TensorRT which can achieve fastest speed. Because TensorRT didn't fully support NHWC yet, this approach only suits NCHW format.

$ python trt_example.py

Appendix

get_mnist_model.py can generate needed Keras models with two different input formats, one for NCHW foramt, another one for NHWC format.

Note: the needed models were already provided in repo.

$ python get_mnist_model.py -h # shows help message
$ python get_mnist_model.py -f 0 # generates model for NCHW format
$ python get_mnist_model.py -f 1 # generates model for NHWC format

Reference

kerastotensorrt's People

Contributors

jeng1220 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.