This is a plugin to run YOLOX on ncnn.
android.gallery.mp4
android.camera.mp4
android.stream.mp4
ios.gallery.mov
ios.camera.MP4
ios.stream.MP4
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/
final ncnn = NcnnYolox();
ncnn.initYolox(
modelPath: 'assets/yolox/yolox.bin',
paramPath: 'assets/yolox/yolox.param',
);
/// 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/providers/ncnn_yolox_controller.dart for specific usage.
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
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.
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.