{"id":14958792,"url":"https://github.com/hereismari/mnist-android-tensorflow","last_synced_at":"2025-04-09T10:08:13.263Z","repository":{"id":88345709,"uuid":"88886997","full_name":"hereismari/mnist-android-tensorflow","owner":"hereismari","description":"Handwritten digits classification from MNIST with TensorFlow on Android; Featuring Tutorial!","archived":false,"fork":false,"pushed_at":"2018-05-13T12:39:22.000Z","size":54781,"stargazers_count":328,"open_issues_count":2,"forks_count":66,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-04-02T08:11:10.574Z","etag":null,"topics":["android","mnist","mnist-classification","tensorflow","tensorflow-tutorials","tutorial","x86"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hereismari.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-04-20T16:24:36.000Z","updated_at":"2024-12-04T12:57:29.000Z","dependencies_parsed_at":null,"dependency_job_id":"45868a00-a539-4405-8143-cb52dd60a049","html_url":"https://github.com/hereismari/mnist-android-tensorflow","commit_stats":{"total_commits":15,"total_committers":3,"mean_commits":5.0,"dds":0.6,"last_synced_commit":"2fca736067c9d820f603fbcdd2c8e46363fd766c"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hereismari%2Fmnist-android-tensorflow","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hereismari%2Fmnist-android-tensorflow/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hereismari%2Fmnist-android-tensorflow/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hereismari%2Fmnist-android-tensorflow/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hereismari","download_url":"https://codeload.github.com/hereismari/mnist-android-tensorflow/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248018060,"owners_count":21034048,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","mnist","mnist-classification","tensorflow","tensorflow-tutorials","tutorial","x86"],"created_at":"2024-09-24T13:18:17.213Z","updated_at":"2025-04-09T10:08:13.240Z","avatar_url":"https://github.com/hereismari.png","language":"Java","readme":"# MNIST on Android with TensorFlow\n## Handwritten digits classification from MNIST on Android with TensorFlow.  \n\nIf you want to make your own version of this app or want to know\nhow to save your model and export it for Android or other devices check the\nvery simple tutorial below.  \n\n* The UI and expert-graph.pb model were taken from: https://github.com/miyosuda/TensorFlowAndroidMNIST, so thank you miyousuda.  \n* The TensorFlow jar and so armeabi-v7a were taken from: https://github.com/MindorksOpenSource/AndroidTensorFlowMNISTExample,\nso thank you MindorksOpenSource.  \n* The Tensorflow so of x86 was taken from: https://github.com/cesardelgadof/TensorFlowAndroidMNIST, so thank you cesardelgadof.  \n\n----\nThis work was featured on a [video from Siraj Raval!](https://www.youtube.com/watch?v=kFWKdLOxykE\u0026t=67s)  \n![](https://img.youtube.com/vi/kFWKdLOxykE/hqdefault.jpg)\n\nCheck the video demo [here](https://www.youtube.com/watch?v=gahi0Hjgokw).\n\n![Image](images/demo.png)\nBeautiful art work, right? I know.  \n\n## How to run this?\n\nJust open this project with Android Studio and is ready to run, this will work\nwith x86 and armeabi-v7a architectures.\n\n## How to export my model?\n\nA full example can be seen [here](https://github.com/mari-linhares/mnist-android-tensorflow/blob/master/tensorflow_model/convnet.py)\n\n1. Train your model\n2. Keep an in memory copy of eveything your model learned (like biases and weights)\n   Example: `_w = sess.eval(w)`, where w was learned from training.\n3. Rewrite your model changing the variables for constants with value = in memory copy of learned variables.\n   Example: `w_save = tf.constant(_w)`  \n   \n   Also make sure to put names in the input and output of the model, this will be needed for the model later.\n   Example:  \n   `x = tf.placeholder(tf.float32, [None, 1000], name='input')`  \n   `y = tf.nn.softmax(tf.matmul(x, w_save) + b_save), name='output')`  \n4. Export your model with:  \n   `tf.train.write_graph(\u003cgraph\u003e, \u003cpath for the exported model\u003e, \u003cname of the model\u003e.pb, as_text=False)`\n\n## How to run my model with Android?\n\nYou basically need two things:\n\n1. [The TensorFlow jar](https://github.com/MindorksOpenSource/AndroidTensorFlowMNISTExample/blob/master/app/libs/libandroid_tensorflow_inference_java.jar)  \n   Move it to the libs folder, right click and add as library.  \n\n2. The TensorFlow so file for the desired architecture:  \n[x86](https://github.com/cesardelgadof/TensorFlowAndroidMNIST/blob/master/app/src/main/jniLibs/x86/libtensorflow_mnist.so)  \n[armeabi-v7a](https://github.com/MindorksOpenSource/AndroidTensorFlowMNISTExample/tree/master/app/src/main/jniLibs/armeabi-v7a)  \n\nCreat the jniLibs/x86 folder or the jniLibs/armeabi-v7a folder at the main folder.  \nMove it to app/src/main/jniLibs/x86/libtensorflow_inference.so or app/src/jniLibs/armeabi-v7a/libtensorflow_inference.so\n\nIf you want to generate these files yourself, [here](https://blog.mindorks.com/android-tensorflow-machine-learning-example-ff0e9b2654cc) is a nice tutorial of how to do it.\n\n## Interacting with TensorFlow\n\nTo interact with TensorFlow you will need an instance of TensorFlowInferenceInterface, you can see more details about it [here](https://github.com/mari-linhares/mnist-android-tensorflow/blob/master/MnistAndroid/app/src/main/java/mariannelinhares/mnistandroid/Classifier.java).\n\nThank you, have fun!\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhereismari%2Fmnist-android-tensorflow","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhereismari%2Fmnist-android-tensorflow","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhereismari%2Fmnist-android-tensorflow/lists"}