tensorrtx icon indicating copy to clipboard operation
tensorrtx copied to clipboard

API Usage Error (Parameter check failed

Open MyraBaba opened this issue 3 years ago • 4 comments

Env

  • GPU, 2080RTX Ti
  • docker nvcr.io/nvidia/tensorrt:22.07-py3
  • 11.2
  • TensorRT 8.4.1.

About this repo

yolov5

Your problem

root@23fd790e8b4b:/tensorrtx/yolov5/build# ./yolov5 -s yolov5s.wts yolov5s.engine s [08/20/2022-13:19:03] [W] [TRT] The implicit batch dimension mode has been deprecated. Please create the network with NetworkDefinitionCreationFlag::kEXPLICIT_BATCH flag whenever possible. Loading weights: yolov5s.wts [08/20/2022-13:19:03] [E] [TRT] 3: [network.cpp::addScale::736] Error Code 3: API Usage Error (Parameter check failed at: optimizer/api/network.cpp::addScale::736, condition: shift.count > 0 ? (shift.values != nullptr) : (shift.values == nullptr) ) yolov5: /tensorrtx/yolov5/common.hpp:155: nvinfer1::IScaleLayer* addBatchNorm2d(nvinfer1::INetworkDefinition*, std::map<std::__cxx11::basic_string, nvinfer1::Weights>&, nvinfer1::ITensor&, std::string, float): Assertion `scale_1' failed. Aborted (core dumped)

MyraBaba avatar Aug 20 '22 13:08 MyraBaba

Did you try the official trained .pt model? https://github.com/wang-xinyu/tensorrtx/tree/master/yolov5#different-versions-of-yolov5

wang-xinyu avatar Aug 22 '22 03:08 wang-xinyu

@wang-xinyu Hi,

I followed the tutorial and create yolov5s.wts from official model. than follow instruction. here the error:

./yolov5 -s yolov5s.wts yolov5s.engine s [08/22/2022-11:49:11] [W] [TRT] The implicit batch dimension mode has been deprecated. Please create the network with NetworkDefinitionCreationFlag::kEXPLICIT_BATCH flag whenever possible. Loading weights: yolov5s.wts CUDA error 222 at /tensorrtx/yolov5/yololayer.cu:37yolov5: /tensorrtx/yolov5/yololayer.cu:37: nvinfer1::YoloLayerPlugin::YoloLayerPlugin(int, int, int, int, const std::vectorYolo::YoloKernel&): Assertion `0' failed. Aborted (core dumped)

docker nvcr.io/nvidia/tensorrt:22.07-py3 & TensorRT 8.4.1.

MyraBaba avatar Aug 22 '22 11:08 MyraBaba

@wang-xinyu

I changed to the tensorRT 7

than above model conversion and detections worked.

But yolo5m and yolo5l has error.

./yolov5ORG -s yolov5m-v4.0/yolov5m.wts yolov5m.engine s Loading weights: yolov5m-v4.0/yolov5m.wts [08/22/2022-23:42:07] [E] [TRT] Parameter check failed at: ../builder/Network.cpp::addScale::494, condition: shift.count > 0 ? (shift.values != nullptr) : (shift.values == nullptr) yolov5ORG: /tensorrtx/yolov5/common.hpp:155: nvinfer1::IScaleLayer* addBatchNorm2d(nvinfer1::INetworkDefinition*, std::map<std::__cxx11::basic_string, nvinfer1::Weights>&, nvinfer1::ITensor&, std::string, float): Assertion `scale_1' failed. Aborted (core dumped)

And for yolo5l

./yolov5ORG -s yolov5l.wts yolov5l.engine s Loading weights: yolov5l.wts [08/22/2022-23:42:53] [E] [TRT] (Unnamed Layer* 0) [Convolution]: kernel weights has count 6912 but 3456 was expected [08/22/2022-23:42:53] [E] [TRT] (Unnamed Layer* 0) [Convolution]: count of 6912 weights in kernel, but kernel dimensions (6,6) with 3 input channels, 32 output channels and 1 groups were specified. Expected Weights count is 3 * 66 * 32 / 1 = 3456 [08/22/2022-23:42:53] [E] [TRT] (Unnamed Layer 0) [Convolution]: kernel weights has count 6912 but 3456 was expected [08/22/2022-23:42:53] [E] [TRT] (Unnamed Layer* 0) [Convolution]: count of 6912 weights in kernel, but kernel dimensions (6,6) with 3 input channels, 32 output channels and 1 groups were specified. Expected Weights count is 3 * 66 * 32 / 1 = 3456 [08/22/2022-23:42:53] [E] [TRT] (Unnamed Layer 0) [Convolution]: kernel weights has count 6912 but 3456 was expected [08/22/2022-23:42:53] [E] [TRT] (Unnamed Layer* 0) [Convolution]: count of 6912 weights in kernel, but kernel dimensions (6,6) with 3 input channels, 32 output channels and 1 groups were specified. Expected Weights count is 3 * 66 * 32 / 1 = 3456 [08/22/2022-23:42:53] [E] [TRT] (Unnamed Layer 0) [Convolution]: kernel weights has count 6912 but 3456 was expected [08/22/2022-23:42:53] [E] [TRT] (Unnamed Layer* 0) [Convolution]: count of 6912 weights in kernel, but kernel dimensions (6,6) with 3 input channels, 32 output channels and 1 groups were specified. Expected Weights count is 3 * 66 * 32 / 1 = 3456 [08/22/2022-23:42:53] [E] [TRT] (Unnamed Layer 0) [Convolution]: kernel weights has count 6912 but 3456 was expected [08/22/2022-23:42:53] [E] [TRT] (Unnamed Layer* 0) [Convolution]: count of 6912 weights in kernel, but kernel dimensions (6,6) with 3 input channels, 32 output channels and 1 groups were specified. Expected Weights count is 3 * 66 * 32 / 1 = 3456 [08/22/2022-23:42:53] [E] [TRT] (Unnamed Layer 0) [Convolution]: kernel weights has count 6912 but 3456 was expected [08/22/2022-23:42:53] [E] [TRT] (Unnamed Layer* 0) [Convolution]: count of 6912 weights in kernel, but kernel dimensions (6,6) with 3 input channels, 32 output channels and 1 groups were specified. Expected Weights count is 3 * 66 * 32 / 1 = 3456 [08/22/2022-23:42:53] [E] [TRT] Parameter check failed at: ../builder/Network.cpp::addResize::940, condition: input.getDimensions().nbDims > 0 yolov5ORG: /tensorrtx/yolov5/yolov5.cpp:63: nvinfer1::ICudaEngine build_engine(unsigned int, nvinfer1::IBuilder*, nvinfer1::IBuilderConfig*, nvinfer1::DataType, float&, float&, std::string&): Assertion `upsample11' failed. Aborted (core dumped)


Also I try to download yolo5m and yolo5l wts from model zoo there is also errors.

do I need to change code for model m and moe l ?

MyraBaba avatar Aug 22 '22 20:08 MyraBaba

Please check the readme. The last cli argument means the model type is s, m or l.

wang-xinyu avatar Aug 23 '22 03:08 wang-xinyu

Did you mean : https://github.com/ultralytics/yolov5/releases/download/v6.2/yolov5s-cls.pt

On 22 Aug 2022, at 06:36, Wang Xinyu @.***> wrote:

Did you try the official trained .pt model? https://github.com/wang-xinyu/tensorrtx/tree/master/yolov5#different-versions-of-yolov5 https://github.com/wang-xinyu/tensorrtx/tree/master/yolov5#different-versions-of-yolov5 — Reply to this email directly, view it on GitHub https://github.com/wang-xinyu/tensorrtx/issues/1078#issuecomment-1221759573, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEFRZHZ6ZOOZBIIRJ6XUJH3V2LYTPANCNFSM57DHEOPQ. You are receiving this because you authored the thread.

MyraBaba avatar Oct 11 '22 07:10 MyraBaba

Like this:

./yolov5 -s yolov5s.wts yolov5s.engine s
./yolov5 -s yolov5m.wts yolov5m.engine m
./yolov5 -s yolov5l.wts yolov5l.engine l

wang-xinyu avatar Oct 12 '22 08:10 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 Dec 11 '22 18:12 stale[bot]