dart_ncnn_yolov8

Creator: coderz1093

Last updated:

0 purchases

dart_ncnn_yolov8 Image
dart_ncnn_yolov8 Images

Languages

Categories

Add to Cart

Description:

dart ncnn yolov8

dart_ncnn_yolov8 #
A plugin use ncnn to drive yolov8.
Getting Started #
This project is a starting point for a Flutter
FFI plugin,
a specialized package that includes native code directly invoked with Dart FFI.
Project structure #
This template uses the following structure:


src: Contains the native source code, and a CmakeFile.txt file for building
that source code into a dynamic library.


lib: Contains the Dart code that defines the API of the plugin, and which
calls into the native code using dart:ffi.


platform folders (android, ios, windows, etc.): Contains the build files
for building and bundling the native code library with the platform application.


How to use #
For now, the example app only have Android app.
Get dependencies of plugin and example app #
dart pub get
cd example
flutter pub get
copied to clipboard
Get NCNN Model #
Use Ultralytics export NCNN model without any modification for model structure.
yolo export model=yolov8n format=ncnn
copied to clipboard
and put into example\assets\yolo, example\lib\providers\ncnn_yolo_options.dart used to custom yout own model.
Add NCNN & OpenCV-mobile library #
Take Android for example:

Download NCNN (download ncnn-xxxxxxx-android[-vulkan].zip).
Download opencv-mobile (download opencv-mobile-x.x.x-android.zip).
Extract Zip file to dart_ncnn_yolov8/android/src/main/cpp.
Change corresponding platform library path in dart_ncnn_yolov8/src/CMakeLists.txt.

Use ffigen to generate ffi bindings (Optional) #
In project root folder:
dart run ffigen --config ffigen.yaml
copied to clipboard
Use Freezed to generate code (Optional) #
In project root folder:
dart run build_runner build
copied to clipboard
Building and bundling native code #
The pubspec.yaml specifies FFI plugins as follows:
plugin:
platforms:
some_platform:
ffiPlugin: true
copied to clipboard
This configuration invokes the native build for the various target platforms
and bundles the binaries in Flutter applications using these FFI plugins.
This can be combined with dartPluginClass, such as when FFI is used for the
implementation of one platform in a federated plugin:
plugin:
implements: some_other_plugin
platforms:
some_platform:
dartPluginClass: SomeClass
ffiPlugin: true
copied to clipboard
A plugin can have both FFI and method channels:
plugin:
platforms:
some_platform:
pluginClass: SomeName
ffiPlugin: true
copied to clipboard
The native build systems that are invoked by FFI (and method channel) plugins are:

For Android: Gradle, which invokes the Android NDK for native builds.

See the documentation in android/build.gradle.


For iOS and MacOS: Xcode, via CocoaPods.

See the documentation in ios/dart_ncnn_yolov8.podspec.
See the documentation in macos/dart_ncnn_yolov8.podspec.


For Linux and Windows: CMake.

See the documentation in linux/CMakeLists.txt.
See the documentation in windows/CMakeLists.txt.



Binding to native code #
To use the native code, bindings in Dart are needed.
To avoid writing these by hand, they are generated from the header file
(src/dart_ncnn_yolov8.h) by package:ffigen.
Regenerate the bindings by running flutter pub run ffigen --config ffigen.yaml.
Invoking native code #
Very short-running native functions can be directly invoked from any isolate.
For example, see sum in lib/dart_ncnn_yolov8.dart.
Longer-running functions should be invoked on a helper isolate to avoid
dropping frames in Flutter applications.
For example, see sumAsync in lib/dart_ncnn_yolov8.dart.
Flutter help #
For help getting started with Flutter, view our
online documentation, which offers tutorials,
samples, guidance on mobile development, and a full API reference.
Reference #

FeiGeChuanShu/ncnn-android-yolov8
KoheiKanagu/ncnn_yolox_flutter
Flutter ncnn 使用

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.