搜索插件、代码仓与 APP 分类

flutter_vision 封面
插件详情v3.0.2

flutter_vision

用于管理 Yolov5、Yolov8 和 Yolov11 的插件,通过 LiteRT(TensorFlow Lite)支持。在 Android 上支持目标检测和分割,iOS 正在开发中。

AndroidiOS
近 30 天下载
348
喜欢数
116
Pub 分数
160

安装插件

flutter pub add flutter_vision

插件介绍

基于插件公开信息、社区数据与项目使用情况整理的选型参考。

flutter_vision 是一个 Flutter 插件,通过 LiteRT(TensorFlow Lite)支持使用 YOLOv5、YOLOv8 和 YOLOv11 模型进行物体检测和分割。它支持 Android 和 iOS 平台,为计算机视觉任务提供高效的设备端推理。该插件专为希望在移动应用中集成实时图像分析的开发者设计,并持续开发以提升功能和性能。对于需要在设备上快速、准确地识别和定位物体的应用程序尤其有用。

适合场景

  • 移动应用中的实时目标检测
  • 增强现实中的图像分割
  • 设备端 OCR 和视觉分析
  • 基于移动设备的监控系统
  • AI驱动的照片标记

主要特点

  • 支持 YOLOv5、YOLOv8 和 YOLOv11 模型
  • 通过 LiteRT 使用 TensorFlow Lite 以实现优化性能
  • 跨平台 Android 和 iOS 兼容性
  • 轻量且适合移动部署
  • 内置对象检测和分割支持

适合对象

  • 移动应用开发者使用人工智能视觉
  • 团队正在构建本地设备上的计算机视觉功能
  • 需要低延迟推理的项目
  • 开发人员使用最少的设置即可针对 Android 和 iOS
  • 原型开发人工智能驱动的相机应用

使用建议

  • 仍在积极开发中
  • 可用文档有限
  • 性能取决于设备硬件
  • 模型大小可能会影响应用包大小
  • iOS 集成可能需要额外配置

原始 README

以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。

flutter_vision

A Flutter plugin for managing Yolov5, Yolov8, and Yolov11 accessing with LiteRT (TensorFlow Lite). Support object detection and segmentation on Android. iOS not updated, working in progress.

Installation

Add flutter_vision as a dependency in your pubspec.yaml file.

Android

In android/app/build.gradle, add the following setting in android block.

    android{
        aaptOptions {
            noCompress 'tflite'
            noCompress 'lite'
        }
    }

iOS

Coming soon ...

Usage

For YoloV5, YoloV8, and YoloV11 MODEL

  1. Create a assets folder and place your labels file and model file in it. In pubspec.yaml add:
  assets:
   - assets/labels.txt
   - assets/yolovx.tflite
  1. Import the library:
import 'package:flutter_vision/flutter_vision.dart';
  1. Initialized the flutter_vision library:
 FlutterVision vision = FlutterVision();
  1. Load the model and labels: modelVersion: yolov5 or yolov8 or yolov8seg or yolo11 or yolov11
await vision.loadYoloModel(
        labels: 'assets/labelss.txt',
        modelPath: 'assets/yolov5n.tflite',
        modelVersion: "yolov5",
        quantization: false,
        numThreads: 1,
        useGpu: false);
For camera live feed
  1. Make your first detection: confThreshold work with yolov5 other case it is omited.

Make use of camera plugin

final result = await vision.yoloOnFrame(
        bytesList: cameraImage.planes.map((plane) => plane.bytes).toList(),
        imageHeight: cameraImage.height,
        imageWidth: cameraImage.width,
        iouThreshold: 0.4,
        confThreshold: 0.4,
        classThreshold: 0.5);
For static image
  1. Make your first detection or segmentation:
final result = await vision.yoloOnImage(
        bytesList: byte,
        imageHeight: image.height,
        imageWidth: image.width,
        iouThreshold: 0.8,
        confThreshold: 0.4,
        classThreshold: 0.7);
  1. Release resources:
await vision.closeYoloModel();

About results

For Yolo v5, v8, or v11 in detection task

result is a List<Map<String,dynamic>> where Map have the following keys:

   Map<String, dynamic>:{
    "box": [x1:left, y1:top, x2:right, y2:bottom, class_confidence]
    "tag": String: detected class
   }

For YoloV8 in segmentation task

result is a List<Map<String,dynamic>> where Map have the following keys:

   Map<String, dynamic>:{
    "box": [x1:left, y1:top, x2:right, y2:bottom, class_confidence]
    "tag": String: detected class
    "polygons": List<Map<String, double>>: [{x:coordx, y:coordy}]
   }

Example

Screenshot_2022-04-08-23-59-05-652_com vladih dni_scanner_example Home Detection Segmentation

Contact

  • For flutter_vision bug reports and feature requests please visit GitHub Issues
  • For direct contact: yurihuallpavargas@gmail.com

所属分类

依赖

依赖清单 1 项

源码仓库

使用此插件的项目

暂无相关数据。