Skip to content

Feat: Optimize YOLOv8 Inference with Unified Single-Call Pipeline & Restore FeatureUpdate speed up#2

Open
yeonseok-zeticai wants to merge 5 commits intomainfrom
update_speed_up
Open

Feat: Optimize YOLOv8 Inference with Unified Single-Call Pipeline & Restore FeatureUpdate speed up#2
yeonseok-zeticai wants to merge 5 commits intomainfrom
update_speed_up

Conversation

@yeonseok-zeticai
Copy link
Copy Markdown
Member

@yeonseok-zeticai yeonseok-zeticai commented Jan 17, 2026

  • This PR introduces a significant performance optimization for the ZETIC.MLange Flutter plugin by implementing a Unified Native Pipeline. It consolidates the inference workflow (preprocess → run → postprocess) into a single native call, drastically reducing the communication overhead between Dart and the Native layer.

  • Performance Improvements

    • Unified Pipeline (runPipeline): Replaced the sequential MethodChannel calls with a single runPipeline method.
    • Reduced IO Overhead: Decreased Platform Channel calls from 4 to 1 per frame.
    • Zero-Copy Logic: Eliminated redundant data serialization and transfer of heavy tensor logic between Dart and Native during the inference loop.
  • Key Changes

    1. Architecture: Shared Registry Pattern
    • Android/iOS: Updated ZeticMLangeModelFlutterPlugin to expose a thread-safe static registry. This allows the YOLOv8Wrapper plugin to directly access ZeticMLangeModel instances internally to orchestrate the pipeline natively.
    • Core: Added getInstanceOrNull to safely retrieve instances without triggering Flutter error results during internal calls.
    1. Feature: Unified Pipeline Implementation
    • Android (YOLOv8WrapperFlutterPlugin.kt): Implemented runPipeline to handle the full cycle (Preprocess → Model.Run → Postprocess) in a background thread.
    • iOS (YOLOv8WrapperFlutterPlugin.swift): Implemented equivalent logic using Swift concurrency and pointer manipulation for zero-copy handling.
    • Dart (yolov8.dart): Added the runPipeline API.
    1. Housekeeping & Fixes
    • Dependency Update: Migrated to com.zeticai.ext:ext:0.0.1 (Maven Central) and resolved libc++_shared.so packaging conflicts.
    • Documentation: Overhauled README.md with detailed installation steps, usage guides, and contribution standards.
    • Refactor: Updated example/lib/main.dart to utilize the new optimized pipeline.
  • Verification

    • Build: Confirmed successful Android build (./gradlew assembleDebug) and clean flutter analyze results.
    • Functionality: Verified path to runPipeline integration in the example app.

@yeonseok-zeticai yeonseok-zeticai self-assigned this Jan 17, 2026
@yeonseok-zeticai
Copy link
Copy Markdown
Member Author

@DenisovAV, can you kindly review this PR? :)

@yeonseok-zeticai yeonseok-zeticai added the enhancement New feature or request label Jan 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant