tensorrt_inference icon indicating copy to clipboard operation
tensorrt_inference copied to clipboard

INT8

Open alicera opened this issue 3 years ago • 5 comments

Do you try the INT8 for yolov5?

I try to do onnx ->trt I cant detect any object for yolov5 INT8. But the yolov5 FP16 can detect the object.

Do you have any idea?

alicera avatar Dec 25 '20 03:12 alicera

@alicera I have not try yet, int8 inference need calib dataset, only build engine is not enough.

linghu8812 avatar Dec 25 '20 05:12 linghu8812

@alicera I have not try yet, int8 inference need calib dataset, only build engine is not enough.

大佬,我yolov5的onnx模型做int8量化的时候,是有加入量化数据的,可是还是不出框,你能尝试一下吗?

Wulingtian avatar Dec 31 '20 06:12 Wulingtian

I meet the same problem.

alicera avatar Dec 31 '20 07:12 alicera

我试了https://github.com/linghu8812/tensorrt_inference/tree/master/Yolov4 的int8推理,结果是正确的,只是精度不够。最近看了一些TRT的int8量化资料,精度下降太多可能与训练时使用的激活函数有关,猜测是TRT只对正半轴做了8bits quantize,yolov4使用了mish激活函数,所以feature map是存在负值的,yolov4可以使用ReLU替换Leaky-ReLU,我认为这点替换后的精度损失相比于int8的精度下降是可以接受的。还有一点思考就是如果TRT真的只做正半轴的话,sigmoid激活函数可能需要在解析层来做了。所以yolov5 int8应该没问题。

DaChaoXc avatar Feb 20 '21 07:02 DaChaoXc

@DaChaoXc Tensorrt使用的是对称量化,就算是非对称量化,也是有zeropoint,不存在你说的仅对正半轴取值

www516717402 avatar Mar 10 '22 03:03 www516717402