Open baynaa7 opened 2 years 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
Hello, I am following https://github.com/midasklr/yolov5prune and trained yolov5s. After that I converted best.pt to best.onnx and also simplified best.onnx to best_sim.onnx. Using ncnn ncnn2onnx I was able to convert best_sim.onnx. After replacing crop layers into YoloV5Focus layer, I used ncnnoptimize to clean up the ncnn.param and ncnn.bin files. Problem is first few conv layers' w/b tensor values are uint8 as shown below figure (ncnn.param: first conv layers' weight tensor values are captured, also onnx tensor type says it is float16).
I did not add anything in conversion code. DEfault conversion should be float32 right? So I dont know what the problem is. here is part of original ncnn.param:
here is modified part of ncnn.param:
first 8 conv layers' tensor values are look like above and rest of conv layers' tensor values are normal float values. Any idea what is the problem? thanks