本文是 TensorFlow + YOLO + React Native 制作 Not Hotdog App 的 Flutter 实现,建模过程相同,只是 App 使用 Flutter 开发。
https://github.com/shaqian/Not-Hotdog
预览
Native 模块
调用 TensorFlow Mobile 接口用了自己实现的 Native 模块。
-
iOS 端的实现代码在
flutter_nothotdog/ios/Runner/TensorFlow/
-
Android 端的实现代码在
flutter_nothotdog/android/app/src/main/java/com/nothotdog/tensorflow/
依赖库一览
- TensorFlow Mobile: iOS, Android
- camera
- path_provider
- share
准备工作
将 ./yolo 文件夹内的 quantized_yolov2-tiny-hotdog.pb 复制至以下路径:
- flutter_nothotdog/android/app/src/main/assets/
- flutter_nothotdog/ios/Runner/TensorFlow/
安装
- iOS 端的 TensorFlow Mobile 使用 POD 安装:
cd flutter_nothotdog/ios
pod install
- 安装其他依赖:
cd flutter_nothotdog/
flutter packages get
运行 App
flutter run
Android 端:
- 直接安装 flutter_nothotdog 文件夹内的 flutter_hotdog.apk。