Closed colinleng closed 3 years ago
因为demo用的是vulkan有gpu接口,应该是你下载的ncnn库不是gpu版本。 或者自己改下代码,加下 Vulkan 的宏判断
#if NCNN_VULKAN
hasGPU = ncnn::get_gpu_count() > 0;
#endif
宏在 platform.h 文件里面,导入下头文件
如果我按照说明当中去掉opencv的话,是不是就是指在CMakeLists.txt当中将 include_directories( ${CMAKE_SOURCE_DIR}/opencv/include/ ) add_library(libopencv_java4 STATIC IMPORTED) set_target_properties( libopencv_java4 PROPERTIES IMPORTED_LOCATION ${CMAKE_SOURCE_DIR}/opencv/${ANDROID_ABI}/libopencv_java4.so ) 注释掉也可以呢?
其二,就是我在 https://github.com/Tencent/ncnn 当中下载gpu版本的之后进行编译VULKAN版本,之后替换掉VULKAN版本内的文件就可以
您好,不好意思还需要请教下,我使用您给方法,手动改动了代码,在报错的地方,添加了
apk可以正常编译成功。但是,在使用yolov5_custom_layer的时候,会闪退。
D/Hwaps: APS: EventAnalyzed: registerCallbackInApsManagerService, mPkgName:com.wzt.yolov5; result = true E/libc: Access denied finding property "emui_hwagp_high_freq_scenes" E/libc: Access denied finding property "emui_hwagp_high_freq_scenes" W/com.wzt.yolov5: type=1400 audit(0.0:204906): avc: denied { read } for pid=15037 name="u:object_r:hwagp_high_freq_scenes_prop:s0" dev="tmpfs" ino=17124 scontext=u:r:untrusted_app:s0:c93,c258,c512,c768 tcontext=u:object_r:hwagp_high_freq_scenes_prop:s0 tclass=file permissive=0 V/AudioManager: querySoundEffectsEnabled... W/ActivityThread: handleWindowVisibility: no activity for token android.os.BinderProxy@267368 V/ActivityThread: callActivityOnCreate I/DecorView[]: pkgName:com.wzt.yolov5 old windowMode:0 new windoMode:1, isFixedSize:false W/ncnn: layer YoloV5Focus not exists or registered A/libc: Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0xf in tid 15037 (com.wzt.yolov5), pid 15037 (com.wzt.yolov5) 您好,这个时候是什么错误呢?不好意思,麻烦您。
W/ncnn: layer YoloV5Focus not exists or registered 会建工程的话建议自己新建个工程,demo想要全部都正常的话需要按说明重新编译ncnn。 或者直接用 nihui 的工程 yolov5
已搞定,重新编译了VULKAN版本,进行替换之后就可以了,感谢🙏
已搞定,重新编译了VULKAN版本,进行替换之后就可以了,感谢🙏
1、从git上clonele ncnn进行编译之后对src/main/cpp/ncnn下的文件对应进行了替换 2、修改CMakeLists.txt文件为一下内容:
For more information about using CMake with Android Studio, read the
但是项目编译的时候会报:YOLOv5_NCNN/android_YOLOV5_NCNN/app/src/main/cpp/MbnFCN.cpp:15:20: error: no member named 'get_gpu_count' in namespace 'ncnn' 错误,请问这个大概是什么问题引起的呢 另:模型已按照 https://zhuanlan.zhihu.com/p/275989233 这个文章的方法进行转换并对文章内的图片demo进行测试没有问题,先想将模型放到这个项目当中。所以需要使用 YoloV5CustomLayer这个进行操作。