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 766 forks source link

tflite conversion to tnn fails #1695

Open liamsun2019 opened 2 years ago

liamsun2019 commented 2 years ago

python3.6 converter.py tflite2tnn test.tflite ---------- convert model, please wait a moment ----------

Oh No, tflite2tnn failed :(

  1. 这个tflite是int8 QAT训练得到的,即已经是量化后的模型,确定可以正常推理
  2. 如果有需要的话,我可以提供这个tflite档
seanxcwang commented 2 years ago

可以把模型发一下,可能部分op没转过来,另外tnn只支持对称量化的模型

liamsun2019 commented 2 years ago

test.zip

liamsun2019 commented 2 years ago

请参考模型,这是一个int8 QAT的tflite模型

liamsun2019 commented 2 years ago

我持续测试了一些模型,看起来有些模型转tnn会失败。测试情况如下:

  1. yolo_v3_tiny_darknet_fp32.tflite 失败
  2. ssd_mobilenet_v1_int8.tflite 失败
  3. ssd_mobilenet_v1_u8.tflite成功 (这个应该是非对称量化,和你说的只支持对称量化似乎矛盾)
  4. ssd_mobilenet_v1_fp32.tflite 成功

个别模型较大无法上传,可以到: https://github.com/ARM-software/ML-zoo/tree/master/models/object_detection 进行下载

liamsun2019 commented 2 years ago

再补充一个无法转tnn格式的tflite模型。此模型PC上可以正确推理。 test.zip