Tencent / ncnn

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

find_blob_index_by_name failed!!!!!! #3277

Closed Ijustakid closed 2 years ago

Ijustakid commented 2 years ago

detail | 详细描述 | 詳細な説明

gaze-pfld onnx 转 ncnn, 得到param和bin, 通过netron看到input和output name 为 'images'和'output' / '468' Screenshot from 2021-10-11 17-03-04 但是 ex.input("images", in); ncnn::Mat landmark, gaze; ex.extract("output", landmark); ex.extract("468", gaze);

得到 W/ncnn: find_blob_index_by_name 469 failed W/ncnn: Try W/ncnn: find_blob_index_by_name output failed W/ncnn: Try W/ncnn: find_blob_index_by_name 468 failed W/ncnn: Try

bin/param: gaze-pfld.zip

我也用ncnn2mem转换为id.h, 得到: namespace gaze_pfld_param_id { const int LAYER_images = 0; const int BLOB_images = 0; ... const int BLOB_output = 113; ... const int BLOB_468 = 125; } // namespace gaze_pfld_param_id

尝试使用: ex.input("BLOB_images", in); ncnn::Mat landmark, gaze; ex.extract("BLOB_output", landmark); ex.extract("BLOB_468", gaze);

得到同样的结果: W/ncnn: find_blob_index_by_name BLOB_images failed W/ncnn: Try W/ncnn: find_blob_index_by_name BLOB_output failed W/ncnn: Try W/ncnn: find_blob_index_by_name BLOB_468 failed W/ncnn: Try

@nihui 大神帮忙看下这个问题, 一直都找不到input和output node

Ijustakid commented 2 years ago

I look like an idiot...... 在loadparam和loadbin的那个函数中没有加入assetmanager mgr, 导致根本没有load model......

Zing-desire commented 1 year ago

find_blob_index_by_name images failed Try find_blob_index_by_name output failed Try ,所以这个·怎么解决啊

nihui commented 1 month ago

针对onnx模型转换的各种问题,推荐使用最新的pnnx工具转换到ncnn In view of various problems in onnx model conversion, it is recommended to use the latest pnnx tool to convert your model to ncnn

pip install pnnx
pnnx model.onnx inputshape=[1,3,224,224]

详细参考文档 Detailed reference documentation https://github.com/pnnx/pnnx https://github.com/Tencent/ncnn/wiki/use-ncnn-with-pytorch-or-onnx#how-to-use-pnnx