tensorrtx icon indicating copy to clipboard operation
tensorrtx copied to clipboard

issues about the size of yolov5s-int8 and yolov5s-fp16

Open JackjackFan opened this issue 2 years ago • 4 comments

Env

  • GPU, e.g. V100, RTX2080, TX2, Xavier NX, Nano, etc.
  • OS, e.g. Ubuntu16.04, Win10, etc.
  • Cuda version
  • TensorRT version

About this repo

  • which branch/tag/commit are you using?
  • which model? yolov5, retinaface?

Your problem

Hi,Mr.Wang. I try to convert yolov5s.wts to engie and quali it to int8.But besides the map of the difference between int8 and fp16.The size of model is different too. yolov5s-fp16 14.2M,and yolov5s-in8 14.3M.What is the reason of this difference?In my opinin,IN8 should be half of fp16 right?could you pleace give me a hand?Thanks a lot

  • what is your command? e.g. sudo ./yolov5 -s
  • what's your output?
  • what output do you expect?

JackjackFan avatar Mar 04 '22 03:03 JackjackFan

Hi, @JackjackFan - how did you convert? I have a custom model Yolov5 5.0 and I am getting errors while running the code on my Jetson Xavier NX env

~/tensorrtx/yolov5/build$ sudo ./yolov5 -s yolov5.wts yolov5.engine s
Loading weights: yolov5.wts
[04/15/2022-00:10:18] [E] [TRT] (Unnamed Layer* 201) [Convolution]: kernel weights has count 2304 but 32640 was expected
[04/15/2022-00:10:18] [E] [TRT] (Unnamed Layer* 201) [Convolution]: count of 2304 weights in kernel, but kernel dimensions (1,1) with 128 input channels, 255 output channels and 1 groups were specified. Expected Weights count is 128 * 1*1 * 255 / 1 = 32640
[04/15/2022-00:10:18] [E] [TRT] (Unnamed Layer* 201) [Convolution]: kernel weights has count 2304 but 32640 was expected
[04/15/2022-00:10:18] [E] [TRT] (Unnamed Layer* 201) [Convolution]: count of 2304 weights in kernel, but kernel dimensions (1,1) with 128 input channels, 255 output channels and 1 groups were specified. Expected Weights count is 128 * 1*1 * 255 / 1 = 32640
[04/15/2022-00:10:18] [E] [TRT] (Unnamed Layer* 201) [Convolution]: kernel weights has count 2304 but 32640 was expected
[04/15/2022-00:10:18] [E] [TRT] (Unnamed Layer* 201) [Convolution]: count of 2304 weights in kernel, but kernel dimensions (1,1) with 128 input channels, 255 output channels and 1 groups were specified. Expected Weights count is 128 * 1*1 * 255 / 1 = 32640
[04/15/2022-00:10:18] [E] [TRT] (Unnamed Layer* 201) [Convolution]: kernel weights has count 2304 but 32640 was expected
[04/15/2022-00:10:18] [E] [TRT] (Unnamed Layer* 201) [Convolution]: count of 2304 weights in kernel, but kernel dimensions (1,1) with 128 input channels, 255 output channels and 1 groups were specified. Expected Weights count is 128 * 1*1 * 255 / 1 = 32640
Building engine, please wait for a while...
[04/15/2022-00:10:18] [E] [TRT] (Unnamed Layer* 201) [Convolution]: kernel weights has count 2304 but 32640 was expected
[04/15/2022-00:10:18] [E] [TRT] (Unnamed Layer* 201) [Convolution]: count of 2304 weights in kernel, but kernel dimensions (1,1) with 128 input channels, 255 output channels and 1 groups were specified. Expected Weights count is 128 * 1*1 * 255 / 1 = 32640
[04/15/2022-00:10:18] [E] [TRT] Could not compute dimensions for (Unnamed Layer* 201) [Convolution]_output, because the network is not valid.
[04/15/2022-00:10:18] [E] [TRT] Network validation failed.
Build engine successfully!
yolov5: /home/nvidia/tensorrtx/yolov5/yolov5.cpp:243: void APIToModel(unsigned int, nvinfer1::IHostMemory**, bool&, float&, float&, std::__cxx11::string&): Assertion `engine != nullptr' failed.
Aborted

I will much appreciate if you can help.

rajeshroy402 avatar Apr 14 '22 18:04 rajeshroy402

Hi, @JackjackFan - how did you convert? I have a custom model Yolov5 5.0 and I am getting errors while running the code on my Jetson Xavier NX env

~/tensorrtx/yolov5/build$ sudo ./yolov5 -s yolov5.wts yolov5.engine s
Loading weights: yolov5.wts
[04/15/2022-00:10:18] [E] [TRT] (Unnamed Layer* 201) [Convolution]: kernel weights has count 2304 but 32640 was expected
[04/15/2022-00:10:18] [E] [TRT] (Unnamed Layer* 201) [Convolution]: count of 2304 weights in kernel, but kernel dimensions (1,1) with 128 input channels, 255 output channels and 1 groups were specified. Expected Weights count is 128 * 1*1 * 255 / 1 = 32640
[04/15/2022-00:10:18] [E] [TRT] (Unnamed Layer* 201) [Convolution]: kernel weights has count 2304 but 32640 was expected
[04/15/2022-00:10:18] [E] [TRT] (Unnamed Layer* 201) [Convolution]: count of 2304 weights in kernel, but kernel dimensions (1,1) with 128 input channels, 255 output channels and 1 groups were specified. Expected Weights count is 128 * 1*1 * 255 / 1 = 32640
[04/15/2022-00:10:18] [E] [TRT] (Unnamed Layer* 201) [Convolution]: kernel weights has count 2304 but 32640 was expected
[04/15/2022-00:10:18] [E] [TRT] (Unnamed Layer* 201) [Convolution]: count of 2304 weights in kernel, but kernel dimensions (1,1) with 128 input channels, 255 output channels and 1 groups were specified. Expected Weights count is 128 * 1*1 * 255 / 1 = 32640
[04/15/2022-00:10:18] [E] [TRT] (Unnamed Layer* 201) [Convolution]: kernel weights has count 2304 but 32640 was expected
[04/15/2022-00:10:18] [E] [TRT] (Unnamed Layer* 201) [Convolution]: count of 2304 weights in kernel, but kernel dimensions (1,1) with 128 input channels, 255 output channels and 1 groups were specified. Expected Weights count is 128 * 1*1 * 255 / 1 = 32640
Building engine, please wait for a while...
[04/15/2022-00:10:18] [E] [TRT] (Unnamed Layer* 201) [Convolution]: kernel weights has count 2304 but 32640 was expected
[04/15/2022-00:10:18] [E] [TRT] (Unnamed Layer* 201) [Convolution]: count of 2304 weights in kernel, but kernel dimensions (1,1) with 128 input channels, 255 output channels and 1 groups were specified. Expected Weights count is 128 * 1*1 * 255 / 1 = 32640
[04/15/2022-00:10:18] [E] [TRT] Could not compute dimensions for (Unnamed Layer* 201) [Convolution]_output, because the network is not valid.
[04/15/2022-00:10:18] [E] [TRT] Network validation failed.
Build engine successfully!
yolov5: /home/nvidia/tensorrtx/yolov5/yolov5.cpp:243: void APIToModel(unsigned int, nvinfer1::IHostMemory**, bool&, float&, float&, std::__cxx11::string&): Assertion `engine != nullptr' failed.
Aborted

I will much appreciate if you can help.

@rajeshroy402 I am having same issue , were you able to solve it ?

suyashhchougule avatar May 11 '22 06:05 suyashhchougule

I am facing the same issue, @JackjackFan @rajeshroy402 @suyashhchougule were you able to solve them?

sicarioakki avatar Jun 19 '22 14:06 sicarioakki

Errors like this is due to model mismatch between pytorch and tensorrt. You can follow the readme to use the matched version, and try official model first.

[04/15/2022-00:10:18] [E] [TRT] (Unnamed Layer* 201) [Convolution]: kernel weights has count 2304 but 32640 was expected

wang-xinyu avatar Jun 29 '22 02:06 wang-xinyu

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Aug 31 '22 02:08 stale[bot]