A Flutter plugin for inference of Pytorch models.
Note: This plugin is still under development, only image classification models are supported for the moment.
torch_mobile as a dependency in your pubspec.yaml file.
Not implemented yet
No configuration required - the plugin should work out of the box.
assets folder with pytorch model and labels file and model file in it.
assets: - assets/model.pt - assets/labels.txt
Import the library
Load model and labels
TorchMobile.loadModel(model: 'assets/model.pt', labels: 'assets/labels.txt');
Get prediction for image
String prediction = await TorchMobile.getPrediction(image, maxWidth: 400, maxHeight: 400);