Tencent / TNN

TNN: developed by Tencent Youtu Lab and Guangying Lab, a uniform deep learning inference framework for mobile、desktop and server. TNN is distinguished by several outstanding features, including its cross-platform capability, high performance, model compression and code pruning. Based on ncnn and Rapidnet, TNN further strengthens the support and performance optimization for mobile devices, and also draws on the advantages of good extensibility and high performance from existed open source efforts. TNN has been deployed in multiple Apps from Tencent, such as Mobile QQ, Weishi, Pitu, etc. Contributions are welcome to work in collaborative with us and make TNN a better framework.
Other
4.38k stars 768 forks source link

拉取最新TNN工程后Android Demo部分模型无法正常初始化和推理,最新更新与之前Demo中的TNN模型不兼容? #1517

Closed bestpower closed 2 years ago

bestpower commented 2 years ago

Commit Id:767dbfed192a3170bf710d83137b0e4653faeafb

Demo地址:https://github.com/Tencent/TNN/tree/master/examples/android

模型地址:https://github.com/darrenyao87/tnn-models/tree/master/model

编译环境及配置: OS:Windows 10 x64 IDE:Android Studio 3.5.2 Android Gradle Plugin Version:3.5.2 Gradle Version:5.4.1 NDK:android-ndk-r19c Cmake Version:3.6.4/3.10.2 abiFilters:armeabi-v7a、arm64-v8a

问题复现过程: 1、通过git bash命令行终端克隆、拉取TNN最新工程代码 2、运行TNN/model/download_model.bat或download_model.sh脚本下载TNN模型 3、通过Android Studio加载TNN/examples/android工程 4、配置编译环境,修改Cmake编译选项set(TNN_OPENCV_ENABLE ON CACHE BOOL "" FORCE)开启OCR检测功能 5、执行Sync、Build、Run 6、Install至Android真机设备 7、尝试运行各个功能

问题现象: 除“图像分类-图片输入”功能可正常运行以外,其余功能均模型无法正常初始化与推理,功能界面无任何结果输出

所有问题日志类似如下:

com.tencent.tnn.demo E/tnn: virtual tnn::Status tnn::ModelInterpreter::InterpretModel(std::string &) [File ${Project parent path}\TNN\source\tnn\interpreter\tnn\model_interpreter.cc][Line 361] tnnmodel is invalid, maybe you should upgrade TNN
com.tencent.tnn.demo E/tnn: virtual tnn::Status tnn::TNNSDKSample::Init(std::shared_ptr<TNNSDKOption>) [File ${Project parent path}\TNN\examples\base\tnn_sdk_sample.cc][Line 572] instance.net init failed 16385
com.tencent.tnn.demo E/tnn: jint Java_com_tencent_tnn_demo_FaceDetector_init(JNIEnv *, jobject, jstring, jint, jint, jfloat, jfloat, jint, jint) [File ${Project parent path}\TNN\examples\android\demo\src\main\jni\cc\face_detector_jni.cc][Line 72] detector init failed 16385
com.tencent.tnn.demo E/ImageFaceDetectFragment: failed to init model -1

请问是否是TNN最新更新与之前Demo中的TNN模型不兼容还是其他问题,麻烦帮忙分析一下,盼复,不胜感激!

darrenyao87 commented 2 years ago

你下载的模型有问题,download_model.sh从github下载模型,很多情况下tnnmodel文件下载不全导致的。国内用户模型也可以阿里云盘下载,https://www.aliyundrive.com/s/MSmarP3zqrb