GitHub 저장소fbelderink/flutter_pytorch_mobile

flutter_pytorch_mobile

PyTorch 모델 추론을 위한 플러터 플러그인입니다. 이미지 모델과 사용자 정의 모델 모두를 지원합니다.

flutter_pytorch_mobile 프로젝트 이미지
스타
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

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 ↗