项目
在 GitHub 查看
nex3z/tflite-mnist-android
关于
MNIST with TensorFlow Lite on Android
人工智能与机器学习实测星标增长
- 24小时
- 0
- 7天
- 0
- 15天
- 0
- 1个月
- 正在收集历史
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
README.md
原文MNIST with TensorFlow Lite on Android
This project demonstrates how to use TensorFlow Lite on Android for handwritten digits classification from MNIST.
Prebuilt APK can be downloaded from here.
How to build from scratch
Environment
- Python 3.7
- tensorflow 2.3.0
- tensorflow-datasets 3.2.1
Step 1. Train and convert the model to TensorFlow Lite FlatBuffer
Run all the code cells in model.ipynb.
- If you are running Jupyter Notebook locally, a
mnist.tflitefile will be saved to the project directory. - If you are running the notebook in Google Colab, a
mnist.tflitefile will be downloaded.
Step 2. Build Android app
Copy the mnist.tflite generated in Step 1 to /android/app/src/main/assets, then build and run the app. A prebuilt APK can be downloaded from here.
The Classifer reads the mnist.tflite from assets directory and loads it into an Interpreter for inference. The Interpreter provides an interface between TensorFlow Lite model and Java code.
If you are building your own app, remember to add the following code to build.gradle to prevent compression for model files.
aaptOptions {
noCompress "tflite"
noCompress "lite"
}
Credits
- The basic model architecture comes from tensorflow-mnist-tutorial.
- The official TensorFlow Lite examples.
- The FingerPaint from Android API demo.
探索相关项目
加载中…