flutter_tflite
flutter_tflite copied to clipboard
any way that I can download tflite model from web to use ?
I tried to use download with below plugin. https://github.com/edjostenes/download_assets
with above plugin, asset folder looks /data/user/0/com.onofflab.traffic/app_flutter/assets.
I checked that file is downloaded well,
bool? filedownloaded = await dc?.assetsFileExists("quantized.tflite");
print("render... ddownload asset comeeeeee"+filedownloaded.toString());
file downloaded is true.
but with loading model,
case ModelType.SSDMobileNet:
print("render... come!!!!");
try {
res = await Tflite.loadModel(
model: '${dc?.assetsDir}/quantized.tflite',
labels: 'assets/models/newmobnet.txt');
} catch ( e) {
print("render... error:"+e.toString());
}
print("render... load done final"+res.toString());
break;
it cause file not found error. I look into log and found out that model path is flutter_assets/data/user/0/com.onofflab.traffic/app_flutter/assets/models/quantized.tflite so, flutter_assets is prefix.... that is why it cause file not found error.
any example that I can download model from web to use ?
I don't how to do it but if need to acess the external storage of the device you can use:
import 'dart:io';
import 'package:path_provider/path_provider.dart';
Directory directory = await getApplicationDocumentsDirectory();
path_provider: ^2.0.6
I tried to use download with below plugin. https://github.com/edjostenes/download_assets
with above plugin, asset folder looks /data/user/0/com.onofflab.traffic/app_flutter/assets.
I checked that file is downloaded well,
bool? filedownloaded = await dc?.assetsFileExists("quantized.tflite"); print("render... ddownload asset comeeeeee"+filedownloaded.toString());
file downloaded is true.
but with loading model,
case ModelType.SSDMobileNet: print("render... come!!!!"); try { res = await Tflite.loadModel( model: '${dc?.assetsDir}/quantized.tflite', labels: 'assets/models/newmobnet.txt'); } catch ( e) { print("render... error:"+e.toString()); } print("render... load done final"+res.toString()); break;
it cause file not found error. I look into log and found out that model path is flutter_assets/data/user/0/com.onofflab.traffic/app_flutter/assets/models/quantized.tflite so, flutter_assets is prefix.... that is why it cause file not found error.
any example that I can download model from web to use ?
How do you solve this pr ?