Git Product home page Git Product logo

deploying-mobile-app's Introduction

deploying-mobile-app

About

This is a sample template repo showing how to use tensorflow.js with react native.

Here is the app in action.

In Action

Assumptions

In order to use this repo, you need to have a tfjs model. You can get a smaple artifact from this repo's release.

Please download it from this repos's release and place the contents in assets/model_tfjs

(base) deploying-mobile-app % tree assets/model_tfjs 
assets/model_tfjs
├── classes.json
├── classes.txt
├── group1-shard1of1.bin
└── model.json

If you want to bring in your own model, please use a command like below to convert a keras h5 artifact.

The below command converts artifacts/model_tf_keras.h5 to tfjs and saves it to artifacts/model_tfjs.

The model is also 16 bit quanitzed.
The model is converted to tfjs_graph_model which is an optimized version of the graph. The model is broken into 100MB shards.

pip install tensorflowjs==2.3.0

tensorflowjs_converter \
--input_format=keras \
--output_format=tfjs_graph_model \
--split_weights_by_layer \
--weight_shard_size_bytes=99999999 \ 
--quantize_float16=* \
artifacts/model_tf_keras.h5 artifacts/model_tfjs

Running

yarn global add expo-cli    

# you can open iOS, Android, or web from here, or run them directly with the commands below.
yarn start 

# you can open in android simulator or device driectly
yarn android 

# you can open in ios simulator or device directly
yarn ios


Future

In the future, it is possible that packages may be out of date.

The below upgrade will upgrade expo and its dependencies

expo upgrade

The below command command can be used to interactively update dependencies.

yarn upgrade-interactive       

Other

If you are interested in a guided exploration of this content, consider Manning's Live project Deploying a Deep Learning Model on Web and Mobile Applications

deploying-mobile-app's People

Contributors

npatta01 avatar reshamas avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

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