Tencent / ncnn

ncnn is a high-performance neural network inference framework optimized for the mobile platform
Other
20.15k stars 4.14k forks source link

Android12 出现闪退问题 #4203

Open gezhongqi1992 opened 2 years ago

gezhongqi1992 commented 2 years ago

error log | 日志或报错信息 | ログ

Build fingerprint: 'samsung/c1qzcx/c1q:12/SP1A.210812.016/N9810ZCU3FVG3:user/release-keys' 2022-09-16 10:30:35.757 11045-11045/? A/DEBUG: Revision: '10' 2022-09-16 10:30:35.757 11045-11045/? A/DEBUG: ABI: 'arm64' 2022-09-16 10:30:35.757 11045-11045/? A/DEBUG: Processor: '7' 2022-09-16 10:30:35.757 11045-11045/? A/DEBUG: Timestamp: 2022-09-16 10:30:35.566323880+0800 2022-09-16 10:30:35.757 11045-11045/? A/DEBUG: Process uptime: 11s 2022-09-16 10:30:35.757 11045-11045/? A/DEBUG: Cmdline: com.ocrgroup.vin 2022-09-16 10:30:35.757 11045-11045/? A/DEBUG: pid: 10927, tid: 11040, name: pool-3-thread-1 >>> com.ocrgroup.vin <<< 2022-09-16 10:30:35.757 11045-11045/? A/DEBUG: uid: 10330 2022-09-16 10:30:35.757 11045-11045/? A/DEBUG: signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0 2022-09-16 10:30:35.757 11045-11045/? A/DEBUG: Cause: null pointer dereference

context | 编译/运行环境 | バックグラウンド

工具: android studio 系统环境: android 12(项目使用api 31)

how to reproduce | 复现步骤 | 再現方法

  1. 使用from_pixels_resize方法输入参数trage_height=32,trage_width=(32/图像高度) * 图像宽度, 其中trage_width为动态数值测试过程分别在不同的数值下出现崩溃.
  2. ex.extract("result", out); 此方法为崩溃点,由第一步中的trage_width决定是否出现崩溃

more | 其他 | その他

代码块: int input_geometry_width = 0; int input_geometry_height = 0;

input_geometry_height = 32; 
double scale_cy = input_geometry_height * 1.0 / h;
input_geometry_width = w * scale_cy;   // android 12 崩溃决定因素
//input_geometry_width = 400;  // 如果使用400 固定值 则不会出现崩溃
etncnn::Mat in = etncnn::Mat::from_pixels_resize(rgbdata, etncnn::Mat::PIXEL_BGR, w, h, input_geometry_width, input_geometry_height);

in.substract_mean_normalize(mean_value, NULL);
etncnn::Mat out;
etncnn::Extractor ex = _vgg_net.create_extractor();

ex.set_num_threads(4);
ex.set_light_mode(true);

ex.input("data", in);
ex.extract("result", out);  // android12 崩溃点

etncnn::Mat out_flatterned = out.reshape(out.w * out.h * out.c);

注!!!!!!!!!!!!:

目前ncnn底层在android 12下的环境崩溃以及影响公司所有产品运营,希望官方可以重视这一问题,能尽快给出解决方案,大家有遇到类似的问题,可以一起讨论,有好的解决方法可以一起分享。

nihui commented 2 years ago

ncnn最新版本试了吗?

gezhongqi1992 commented 2 years ago

已经测试了 ----- 原始邮件 ----- 发件人:nihui @.> 收件人:Tencent/ncnn @.> 抄送人:gezhongqi1992 @.>, Author @.> 主题:Re:_[Tencent/ncnn]_Android12出现闪退问题(Issue_#4203) 日期:2022年09月16日 16点18分

ncnn最新版本试了吗?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

gezhongqi commented 2 years ago

您好,我是楼主大号 这里定位到崩溃问题在此处: 微信图片_20220919151227 还在定位此方法崩溃点...

gezhongqi commented 2 years ago

问题原因已经定位: 在arm/pooling_3x3.h下的pooling3x3s2_max_neon方法中: 此方法的neon相关宏关闭后,在android 12环境下是可以通过的

gezhongqi commented 1 year ago

关闭宏会导致识别速度大幅下降,目前只能等待官方修复。。。

gezhongqi commented 1 year ago

目前可复现机型: IQOO Neo5 SE 三星Galaxy Note20

Android版本为12,并且项目配置build_api版本为31

gezhongqi commented 1 year ago

新发现崩溃机型: IQOO 9 (vivo) Android版本为12,并且项目配置build_api版本为31

目前官方仍然没有修复,已经准备更换ncnn核心改为mnn(mnn目前没有发现此问题)

junchao98 commented 1 year ago

目前可复现机型: IQOO Neo5 SE 三星Galaxy Note20

Android版本为12,并且项目配置build_api版本为31

请寄若干台上述机型给社区成员并提供复现环境,以便于尽快给出解决方案

gezhongqi commented 1 year ago

已经提供过

showwaychen commented 1 year ago

@gezhongqi 我这边也是的, 华为手机 vivo手机 android 12以上都会闪退,很奇怪小米和OPPO是正常的,实在搞不懂android 12的底层做了哪些更新,导致这个闪退问题。

gezhongqi commented 1 year ago

我打日志查询到了位置,已经提供了官方,可能是某一处宏定义或代码块在android12上编码问题,最新的ncnn可以试试是否修复,我这里目前还没用到最新版

xiaozhi003 commented 9 months ago

该问题现在还没有关闭,请问已经解决了吗?

gezhongqi commented 9 months ago

该问题现在还没有关闭,请问已经解决了吗?

目前还没解决,最新版本我这里目前还没测试是否可行

xiaozhi003 commented 9 months ago

该问题现在还没有关闭,请问已经解决了吗?

目前还没解决,最新版本我这里目前还没测试是否可行

好吧,那问下您这边现在是怎么处理的呢?

gezhongqi commented 9 months ago

该问题现在还没有关闭,请问已经解决了吗?

目前还没解决,最新版本我这里目前还没测试是否可行

好吧,那问下您这边现在是怎么处理的呢?

目前公司产品更换了识别引擎