flutter_pytorch_mobile
一个用于 PyTorch 模型推理的 Flutter 插件。支持图像模型以及自定义模型。
- 星标
- 103
- 复刻
- 52
- 最近推送(UTC)
- 2023年2月20日
- 项目状态
- 未归档
原始 README
以下为英文项目原文快照,最新内容请访问 GitHub。
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
语言JavaDartObjective-C++Objective-CRubyPython
分类
使用的依赖
依赖清单 4 项
- flutter
{"sdk":"flutter"} - path_provider
^2.0.2 - path
^1.8.0 - flutter_test开发依赖
{"sdk":"flutter"}
如何选择适合项目的代码仓?
先按使用场景筛选,再比较项目活跃情况,最后到原始仓库核对使用要求。
- 通过仓库名、作者或描述搜索,再按技术分类缩小范围。
- 结合星标、复刻与最近推送比较项目;星标反映社区关注,不代表质量保证。
- 使用前在 GitHub 核对 README、许可证与 Issues。
来源与维护
“A repository is the most basic element of GitHub.”
GitHub Docs — About repositories ↗