NCNN GPU / CPU produces different result in MediaPipe HandLandmark model
error log | 日志或报错信息 | ログ
context | 编译/运行环境 | バックグラウンド
how to reproduce | 复现步骤 | 再現方法
- Code and models avaible from https://github.com/FeiGeChuanShu/ncnn-Android-mediapipe_hand and converted to windows project
- Use latest library
- Older version of NCNN works correctly on CPU, new version working only in GPU mode
more | 其他 | その他
GPU correct result:
CPU incorrect result:
Both models (hand full & lite) works perfect with NCNN release [20221128] and older.
If use_packing_layout=false then latest version works.
PS: I`m find that Gemm produces wrong result if i turn off packing sse for gemm, then latest library works fine!!!!!!
Gemm_x86::Gemm_x86() { #if SSE2 support_packing = false; #endif // SSE2
nT = 0;
}
My model was supposed to output 1x2 through the GEMM operator, but it turned out to be 1x2x8. Then I optimized my onnx model again, and when exporting ncnn again, GEMM was replaced with InnerProduct. Please try using onnx-sim to simplify your model again, but do not use '--overwrite-input-shape'.
My model was supposed to output 1x2 through the GEMM operator, but it turned out to be 1x2x8. Then I optimized my onnx model again, and when exporting ncnn again, GEMM was replaced with InnerProduct. Please try using onnx-sim to simplify your model again, but do not use '--overwrite-input-shape'.
This is not a solution, this must work well with CPU, because GPU works well with all models.
针对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