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 ↗