Giter Club home page Giter Club logo

tflite-support's Introduction

This repo is a fork of the tflite-support repo, with the addition of the tflite_model_runner related code to show how it is built using bazel and emsdk.

  1. Add emscripten toolchain to the WORKSPACE file. This will set up emsdk and provide a useful build rule wasm_cc_binary that can be used to build WASM module from a cc_binary (see below).
  2. I also added a small patch for the com_google_glog library. Without it, the emscripten build will fail on Mac/Linux. The glog v0.5.0 release has a fix for this issue, but it requires some TFLite code refactoring. I will talk to the TFLite team about this. For now we will just use the patch.
  3. The cpp code is here.
    • tflite_model_runner.* implement the model runner.
    • tflite_model_runner_wasm.cc sets up the WASM related bindings.
    • The BUILD file uses the wasm_cc_binary rule to build the WASM module. It is currently linking with XNNPACK, with WASM SIMD and multi-threading turned on.
  4. The demo code is here. To run the demo:
    • Run yarn && yarn build in the demo directory. yarn build runs build.sh where you can see how the bazel build command is used and how to extract the output files.
    • Run yarn start to start the demo locally. It creates a model runner instance with the MobilenetV2 model and classfies an image. See the script.js file for details about how things are used from the JS side.
    • Since this build configuration is for SIMD+multi-threading, please make sure Chrome has these two features turned on from chrome://flags.

tflite-support's People

Contributors

lu-wang-g avatar tensorflower-gardener avatar xunkai55 avatar fergushenderson avatar flamearrow avatar wangtz avatar jinjingforever avatar lintian06 avatar farmaker47 avatar honry avatar am15h avatar talumbau avatar thaink avatar tflite-support-robot avatar meghnanatraj avatar jalexstark avatar abattery avatar jdduke avatar khanhlvg avatar cushon avatar rchen152 avatar vihangaaw 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.