Open Heidar-An opened 1 year ago
I'm trying to use your flutter package for a custom model but I get that my model is not initialised. Is this a regular occurrence?
Let me show you some of my code:
import 'package:pytorch_mobile/pytorch_mobile.dart'; import 'package:pytorch_mobile/model.dart';
I've put pytorch_mobile in my dependencies and added my assets:
assets: - assets/models/[fine-tuning_0.pt](http://fine-tuning_0.pt/) - assets/models/
I put both the actual asset and the directory because it wasn't working, so i just put both, I've tried the combinations and it doesn't work.
@override void initState() { loadPytorchModel().whenComplete(() => log("THIS IS DONE")); Future<void> loadPytorchModel() async { mobileNetModel = await PyTorchMobile.loadModel('assets/models/[fine-tuning_0.pt](http://fine-tuning_0.pt/)'); } Future<void> takePicture() async { image = .... // Ensure that model has been initialised log("this works..."); if (mobileNetModel == null) { await loadPytorchModel(); } List? prediction = await mobileNetModel! .getImagePredictionList(image, decodedImage.width, decodedImage.height);
If I put the if statement checking if the model is null, then nothing happens, if I remove it, I get "mobileNetModel" is uninitialised.
I'm trying to use your flutter package for a custom model but I get that my model is not initialised. Is this a regular occurrence?
Let me show you some of my code:
I've put pytorch_mobile in my dependencies and added my assets:
I put both the actual asset and the directory because it wasn't working, so i just put both, I've tried the combinations and it doesn't work.
If I put the if statement checking if the model is null, then nothing happens, if I remove it, I get "mobileNetModel" is uninitialised.