flutter_pytorch_mobile
Um plug-in do Flutter para inferência de modelo do PyTorch. Suporta modelos de imagem, bem como modelos personalizados.
- Estrelas
- 103
- Forks
- 52
- Último push (UTC)
- 20 de fev. de 2023
- Status do projeto
- Ativo
README original
Texto original em inglês. Visite o GitHub para a versão atual.
pytorch_mobile
A flutter plugin for pytorch model inference, supported both for Android and iOS.
Usage
Installation
To use this plugin, add pytorch_mobile as a dependency in your pubspec.yaml file.
Create a assets folder with your pytorch model and labels if needed. Modify pubspec.yaml accoringly.
assets:
- assets/models/model.pt
- assets/labels.csv
Run flutter pub get
Import the library
import 'package:pytorch_mobile/pytorch_mobile.dart';
Load model
Either custom model:
Model customModel = await PyTorchMobile
.loadModel('assets/models/custom_model.pt');
Or image model:
Model imageModel = await PyTorchMobile
.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
LinguagensJavaDartObjective-C++Objective-CRubyPython
Categorias
Dependências usadas
Lista de dependências 4 itens
- flutter
{"sdk":"flutter"} - path_provider
^2.0.2 - path
^1.8.0 - flutter_testDesenvolvimento
{"sdk":"flutter"}
Como escolher um repositório para seu projeto?
Filtre pelo caso de uso, compare a atividade e confira o projeto original antes de adotá-lo.
- Busque por nome, autor ou descrição e filtre por tema.
- Compare estrelas, forks e envios recentes. Estrelas indicam interesse, mas não garantem qualidade.
- Confira o README, a licença e as issues no GitHub antes de usar o projeto.
Fontes e manutenção
“A repository is the most basic element of GitHub.”
GitHub Docs — About repositories ↗