torch_mobile 0.0.2 copy "torch_mobile: ^0.0.2" to clipboard
torch_mobile: ^0.0.2 copied to clipboard

A Flutter plugin for inference of Pytorch models. Supports image classification on Android.

torch_mobile #

A Flutter plugin for inference of Pytorch models.

Note: This plugin is still under development, only image classification models are supported for the moment.

Installation #

First, add torch_mobile as a dependency in your pubspec.yaml file.

iOS #

Not implemented yet

Android #

No configuration required - the plugin should work out of the box.

Usage #

Create a assets folder with pytorch model and labels file and model file in it. Modify pubspec.yaml accordingly.

  assets:
   - assets/model.pt
   - assets/labels.txt

Import the library

import 'package:torch_mobile/torch_mobile.dart';

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);
8
likes
40
pub points
39%
popularity

Publisher

unverified uploader

A Flutter plugin for inference of Pytorch models. Supports image classification on Android.

Repository (GitHub)
View/report issues

License

BSD-3-Clause (LICENSE)

Dependencies

flutter, path, path_provider

More

Packages that depend on torch_mobile