GitHub リポジトリfbelderink/flutter_pytorch_mobile

flutter_pytorch_mobile

PyTorch モデル推論用のFlutterプラグイン。画像モデルおよびカスタムモデルをサポートしています。

flutter_pytorch_mobile のプロジェクト画像
スター
103
フォーク
52
最終プッシュ(UTC)
2023/02/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

Fynn Maarten Belderink GitHub avatar
GitHub 作者

Fynn Maarten Belderink ↗

Trying to inspire people!

RWTH Aachen UniversityGermany
言語JavaDartObjective-C++Objective-CRubyPython

カテゴリー

使用している依存関係

依存関係一覧 4 件

  • flutter{"sdk":"flutter"}
  • path_provider^2.0.2
  • path^1.8.0
  • flutter_test開発用{"sdk":"flutter"}

プロジェクトに合うリポジトリを選ぶには?

用途で絞り込み、開発状況を比較し、採用前に元のリポジトリで要件を確認しましょう。

  1. 名前・作者・説明で検索し、技術トピックで絞り込みます。
  2. スター、フォーク、最近のプッシュを比較します。スターは関心の目安であり、品質の保証ではありません。
  3. 利用前に GitHub で README、ライセンス、Issues を確認します。

情報源と管理

“A repository is the most basic element of GitHub.”

GitHub Docs — About repositories ↗