Git Product home page Git Product logo

ncnn_yolox_flutter's Introduction

ncnn_yolox_flutter

This is a plugin to run YOLOX on ncnn.

Demo

on Android

Real Device Simulator

on iOS

Real Device Simulator

Stream

How to use

1. Add the YOLOX model to assets

For example, you can use yolox_onnx_to_ncnn.ipynb

Note that you will need to manually modify the model.


If you want to use yolox_tiny, you can find it in example/assets/yolox.


Don't forget to add the model of assets to your pubspec.yaml.

flutter:
  assets:
    - assets/yolox/

2. Load the model

final ncnn = NcnnYolox();

ncnn.initYolox(
  modelPath: 'assets/yolox/yolox.bin',
  paramPath: 'assets/yolox/yolox.param',
);

3. Get the result

/// When using image file
/// **Exif Orientation is ignored**
_results = ncnn.detect(
  imagePath: "path",
);

/// When using image pixels
_results = ncnn.detect(
  pixels: image.pixels,
  pixelFormat: PixelFormat.bgra,
  width: image.width,
  height: image.height,
);

Please check example/lib for specific usage.

How to set up for using custom ncnn and custom YOLOX model

1. Build ncnn

See build_ncnn.yaml for details.

If you want pre-built ncnn, look at the URL of the Releases referenced in these files. Such as this https://github.com/KoheiKanagu/ncnn_yolox_flutter/releases/download/x.y.z/ncnn-android.zip

2. Download ncnn

The library is a binary file, so it is not packaged in the repository. The ncnn libraries for iOS and Android are CMake and Cocoapods, downloaded from Github Releases.

The ncnn library zip you are downloading is the artifact of build_ncnn.yaml. Change the URL if you want.


If you do not want to download the ncnn library, remove the process of downloading the zip. Then install the ncnn library manually.

Please refer to the comments in these files.

3. Change the parameters of YOLOX

Change ios/Classes/yolox.cpp if you want.

For example, if you want to change the size of the input image, change YOLOX_TARGET_SIZE.

Alternatively, you can change the ncnn::Net yolox; in the void initYolox(char *modelPath, char *paramPath) method.


The original yolox.cpp is ncnn/yolox.cpp at 20220216 · Tencent/ncnn.

ncnn_yolox_flutter's People

Contributors

koheikanagu avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.