rockchip-linux / rknn-toolkit

BSD 3-Clause "New" or "Revised" License
813 stars 174 forks source link

用resnet50做backbone训练reid行人特征提取, 转成rknn模型后结果会完全错误 #280

Open MayItbever opened 2 years ago

MayItbever commented 2 years ago

请问用resnet50做backbone训练reid行人特征提取,当模型输出特征没有零值的时候转成rknn全部正常。当某个训练出的模型输出特征数据是下面结构时(特征有一半是0值,但是已经收敛,用来比对也很正常),转成rknn模型后结果会完全错误,现象是转成rknn模型后不同图片会出现同样输出。是因为什么原因? image

测试了3种方式, 1: pytorch直接转rknn,不量化do_quantization=False 2: pytorch直接转rknn,不量化do_quantization=True, 300张图片量化 3:pytorch先转onnx,onnx输出结果与pytorch一致,比对相似度也一致。onnx转rknn后,模型输出结果错误,比对相似度全为0,不同图片输出特征一样

zishui-wu commented 2 years ago

我用resnet50 训练reid提取特征,也遇到完全不相同图像结果99%近似。

zen-xingle commented 2 years ago
  1. 如果浮点模型的结果就存在异常,大概率是 toolkit/ librknn_runtime 的bug。可以尝试更新到1.7.3版本
  2. 如果更新到1.7.3仍未解决,可以上传模型,我们复现下问题
Takizzl commented 1 year ago

想问下,两位大佬的问题解决了吗

LucreKiwisGit commented 1 year ago

更新至1.7.3后,问题并未解决。

LucreKiwisGit commented 1 year ago

#

  1. 如果浮点模型的结果就存在异常,大概率是 toolkit/ librknn_runtime 的bug。可以尝试更新到1.7.3版本
  2. 如果更新到1.7.3仍未解决,可以上传模型,我们复现下问题

如何上传模型?

RamatovInomjon commented 9 months ago
  1. If the results of the floating-point model are abnormal, it is most likely a bug in the toolkit/librknn_runtime. You can try updating to version 1.7.3
  2. If the problem is still not solved after updating to 1.7.3, you can upload the model and we can reproduce the problem.

@zen-xingle @zishui-wu @Takizzl @MayItbever @LucreKiwisGit Hi there here is the model, please can you help debug? I have uploaded convert and inference script, onnx model as well https://drive.google.com/file/d/1JGEzQafrh0i_QOpkp8uBhnjK04OkEWJL/view?usp=sharing

aijle commented 3 months ago

同样的问题,使用模型https://github.com/KaiyangZhou/deep-person-reid.git rknn-toolkit 结果完全错误 rknn-toolkit2 数据大致一致