-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 19b2e78
Showing
34 changed files
with
3,301 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
## YOLOv9 安卓手机部署 | ||
|
||
本项目将YOLOv9通过QT和NCNN部署到小米手机上运行 | ||
|
||
1. 模型转换 | ||
|
||
请参考 <https://github.com/DataXujing/YOLOv9/tree/main/ncnn> | ||
|
||
2. ### 基于QT的NCNN安卓程序编译 | ||
|
||
关于QT安卓开发的相关配置和QT和NCNN开发安卓程序的其他应用请参考笔者的其他几个项目,内有详细的介绍 | ||
|
||
- https://github.com/DataXujing/Qt_NCNN_NanoDet | ||
- https://github.com/DataXujing/ncnn_android_yolov6 | ||
- https://github.com/DataXujing/ncnn_android_yolov8 | ||
|
||
3. 安卓端的Demo | ||
|
||
| 安卓模拟器Demo1 | 小米手机Demo2 | | ||
| :---------------------------: | ------------- | | ||
| <img src="./docs/video.gif"/> | ToDo | | ||
|
||
4. apk文件下载 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,131 @@ | ||
QT += core gui multimedia multimediawidgets | ||
QT += androidextras testlib | ||
|
||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets | ||
|
||
CONFIG += c++11 | ||
|
||
# The following define makes your compiler emit warnings if you use | ||
# any Qt feature that has been marked deprecated (the exact warnings | ||
# depend on your compiler). Please consult the documentation of the | ||
# deprecated API in order to know how to port your code away from it. | ||
DEFINES += QT_DEPRECATED_WARNINGS | ||
|
||
# You can also make your code fail to compile if it uses deprecated APIs. | ||
# In order to do so, uncomment the following line. | ||
# You can also select to disable deprecated APIs only up to a certain version of Qt. | ||
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 | ||
|
||
SOURCES += \ | ||
main.cpp \ | ||
myqlabel.cpp \ | ||
myvideosurface.cpp \ | ||
widget.cpp \ | ||
yolov9.cpp | ||
|
||
HEADERS += \ | ||
myqlabel.h \ | ||
myvideosurface.h \ | ||
widget.h \ | ||
yolov9.h | ||
|
||
FORMS += \ | ||
widget.ui | ||
|
||
# Default rules for deployment. | ||
qnx: target.path = /tmp/$${TARGET}/bin | ||
else: unix:!android: target.path = /opt/$${TARGET}/bin | ||
!isEmpty(target.path): INSTALLS += target | ||
|
||
|
||
|
||
RESOURCES += \ | ||
pic.qrc | ||
|
||
|
||
|
||
|
||
QMAKE_CXXFLAGS += -fopenmp -static-openmp | ||
QMAKE_LFLAGS += -fopenmp -static-openmp | ||
LIBS += -fopenmp -static-openmp | ||
|
||
android { | ||
ANDROID_OPENCV = F:/andriod_env/OpenCV-android-sdk/sdk/native | ||
#ANDROID_OPENCV = D:/NCNN/opencv-mobile-4.5.1-android/sdk/native | ||
INCLUDEPATH += \ | ||
$$ANDROID_OPENCV/jni/include/opencv2 \ | ||
$$ANDROID_OPENCV/jni/include \ | ||
F:/andriod_env/ncnn/ncnn-20240102-android/armeabi-v7a/include \ | ||
F:/andriod_env/ncnn/ncnn-20240102-android/armeabi-v7a/include/ncnn | ||
|
||
|
||
LIBS += \ | ||
$$ANDROID_OPENCV/staticlibs/armeabi-v7a/libopencv_ml.a \ | ||
$$ANDROID_OPENCV/staticlibs/armeabi-v7a/libopencv_objdetect.a \ | ||
$$ANDROID_OPENCV/staticlibs/armeabi-v7a/libopencv_calib3d.a \ | ||
$$ANDROID_OPENCV/staticlibs/armeabi-v7a/libopencv_video.a \ | ||
$$ANDROID_OPENCV/staticlibs/armeabi-v7a/libopencv_features2d.a \ | ||
$$ANDROID_OPENCV/staticlibs/armeabi-v7a/libopencv_highgui.a \ | ||
$$ANDROID_OPENCV/staticlibs/armeabi-v7a/libopencv_flann.a \ | ||
$$ANDROID_OPENCV/staticlibs/armeabi-v7a/libopencv_imgproc.a \ | ||
$$ANDROID_OPENCV/staticlibs/armeabi-v7a/libopencv_dnn.a \ | ||
$$ANDROID_OPENCV/staticlibs/armeabi-v7a/libopencv_core.a \ | ||
$$ANDROID_OPENCV/3rdparty/libs/armeabi-v7a/libcpufeatures.a \ | ||
$$ANDROID_OPENCV/3rdparty/libs/armeabi-v7a/libIlmImf.a \ | ||
#$$ANDROID_OPENCV/3rdparty/libs/armeabi-v7a/liblibjasper.a \ | ||
$$ANDROID_OPENCV/3rdparty/libs/armeabi-v7a/liblibjpeg-turbo.a \ | ||
$$ANDROID_OPENCV/3rdparty/libs/armeabi-v7a/liblibpng.a \ | ||
$$ANDROID_OPENCV/3rdparty/libs/armeabi-v7a/liblibprotobuf.a \ | ||
$$ANDROID_OPENCV/3rdparty/libs/armeabi-v7a/liblibtiff.a \ | ||
$$ANDROID_OPENCV/3rdparty/libs/armeabi-v7a/liblibwebp.a \ | ||
$$ANDROID_OPENCV/3rdparty/libs/armeabi-v7a/libquirc.a \ | ||
$$ANDROID_OPENCV/3rdparty/libs/armeabi-v7a/libtbb.a \ | ||
$$ANDROID_OPENCV/3rdparty/libs/armeabi-v7a/libtegra_hal.a \ | ||
$$ANDROID_OPENCV/libs/armeabi-v7a/libopencv_java4.so \ | ||
F:/andriod_env/ncnn/ncnn-20240102-android/armeabi-v7a/lib/libncnn.a \ | ||
F:/andriod_env/qtforandroid/android-ndk-r21/platforms/android-28/arch-arm/usr/lib/libandroid.so \ | ||
F:/andriod_env/qtforandroid/android-ndk-r21/toolchains/llvm/prebuilt/windows-x86_64/lib64/clang/9.0.8/lib/linux/arm/libomp.a \ | ||
F:/andriod_env/qtforandroid/android-ndk-r21/toolchains/llvm/prebuilt/windows-x86_64/lib64/clang/9.0.8/lib/linux/arm/libomp.so | ||
|
||
# opencv-mobile配置 已废弃 | ||
#$$ANDROID_OPENCV/staticlibs/armeabi-v7a/libopencv_core.a \ | ||
#$$ANDROID_OPENCV/staticlibs/armeabi-v7a/libopencv_features2d.a \ | ||
#$$ANDROID_OPENCV/staticlibs/armeabi-v7a/libopencv_highgui.a \ | ||
#$$ANDROID_OPENCV/staticlibs/armeabi-v7a/libopencv_imgproc.a \ | ||
#$$ANDROID_OPENCV/staticlibs/armeabi-v7a/libopencv_photo.a \ | ||
#$$ANDROID_OPENCV/staticlibs/armeabi-v7a/libopencv_video.a \ | ||
|
||
# add other file to assets | ||
|
||
data.files += assets/ai.png | ||
data.files += assets/icon.png | ||
data.files += assets/splash.png | ||
data.files += assets/x-ray.png | ||
data.files += model/yolov9-c-opt.param | ||
data.files += model/yolov9-c-opt.bin | ||
|
||
|
||
data.path = /assets/file | ||
INSTALLS += data | ||
|
||
} | ||
|
||
|
||
ANDROID_EXTRA_LIBS += F:/andriod_env/OpenCV-android-sdk/sdk/native/libs/armeabi-v7a/libopencv_java4.so \ | ||
F:/andriod_env/qtforandroid/android-ndk-r21/platforms/android-28/arch-arm/usr/lib/libandroid.so \ | ||
F:/andriod_env/qtforandroid/android-ndk-r21/toolchains/llvm/prebuilt/windows-x86_64/lib64/clang/9.0.8/lib/linux/arm/libomp.so | ||
|
||
DISTFILES += \ | ||
android/AndroidManifest.xml \ | ||
android/build.gradle \ | ||
android/gradle/wrapper/gradle-wrapper.jar \ | ||
android/gradle/wrapper/gradle-wrapper.properties \ | ||
android/gradlew \ | ||
android/gradlew.bat \ | ||
android/res/drawable-ldpi/icon.png \ | ||
android/res/values/libs.xml \ | ||
android/src/com/amin/QtAndroidGallery/QtAndroidGallery.java \ | ||
model/yolov9-c-opt.bin \ | ||
model/yolov9-c-opt.param | ||
|
||
ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android |
Oops, something went wrong.