Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

A flutter plugin for pytorch model inference. Supports image models as well as custom models.

License

NotificationsYou must be signed in to change notification settings

fbelderink/flutter_pytorch_mobile

Repository files navigation

A flutter plugin for pytorch model inference, supported both for Android and iOS.

Usage

Installation

To use this plugin, addpytorch_mobile as adependency in your pubspec.yaml file.

Create aassets folder with your pytorch model and labels if needed. Modifypubspec.yaml accoringly.

assets: -assets/models/model.pt -assets/labels.csv

Runflutter pub get

Import the library

import'package:pytorch_mobile/pytorch_mobile.dart';

Load model

Either custom model:

Model customModel=awaitPyTorchMobile        .loadModel('assets/models/custom_model.pt');

Or image model:

Model imageModel=awaitPyTorchMobile        .loadModel('assets/models/resnet18.pt');

Get custom prediction

List prediction=await customModel        .getPrediction([1,2,3,4], [1,2,2],DType.float32);

Get prediction for an image

String prediction=await _imageModel        .getImagePrediction(image,224,224,"assets/labels/labels.csv");

Image prediction for an image with custom mean and std

final mean= [0.5,0.5,0.5];final std= [0.5,0.5,0.5];String prediction=await _imageModel        .getImagePrediction(image,224,224,"assets/labels/labels.csv", mean: mean, std: std);

Contact

fynnmaarten.business@gmail.com

About

A flutter plugin for pytorch model inference. Supports image models as well as custom models.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors4

  •  
  •  
  •  
  •  

[8]ページ先頭

©2009-2025 Movatter.jp