tensorrtx icon indicating copy to clipboard operation
tensorrtx copied to clipboard

YOLOV8 Assertion `serialized_engine' failed. 使用自己的.pt 生成 .wts 是成功的,但转.engine 是报错。chat说是卷积层权重数量不匹配

Open cimmen opened this issue 1 month ago • 5 comments

各版本 cuda 12.1 tensorrt 8.6.1 pytorch 2.2.2 cudnn 8.9.7

生成.pt的框架(是yolov8的官方镜像) pytorch 2.0 cuda 11.8

:~/YOLO/yolov8$ python gen_wts.py -w cricle-n.pt -o c8n.wts -t detect Generating .wts for detect model Loading cricle-n.pt

~/YOLO/yolov8/build$ ./yolov8_det -s c8n.wts c8.engine n ^[[ALoading weights: c8n.wts [05/19/2024-19:49:18] [W] [TRT] The implicit batch dimension mode has been deprecated. Please create the network with NetworkDefinitionCreationFlag::kEXPLICIT_BATCH flag whenever possible. [05/19/2024-19:49:18] [E] [TRT] 3: (Unnamed Layer* 239) [Convolution]:kernel weights has count 36864 but 46080 was expected [05/19/2024-19:49:18] [E] [TRT] 4: (Unnamed Layer* 239) [Convolution]: count of 36864 weights in kernel, but kernel dimensions (3,3) with 64 input channels, 80 output channels and 1 groups were specified. Expected Weights count is 64 * 33 * 80 / 1 = 46080 [05/19/2024-19:49:18] [E] [TRT] 4: [convolutionNode.cpp::computeOutputExtents::58] Error Code 4: Internal Error ((Unnamed Layer 239) [Convolution]: number of kernel weights does not match tensor dimensions) [05/19/2024-19:49:18] [E] [TRT] 3: (Unnamed Layer* 258) [Convolution]:kernel weights has count 73728 but 92160 was expected [05/19/2024-19:49:18] [E] [TRT] 4: (Unnamed Layer* 258) [Convolution]: count of 73728 weights in kernel, but kernel dimensions (3,3) with 128 input channels, 80 output channels and 1 groups were specified. Expected Weights count is 128 * 33 * 80 / 1 = 92160 [05/19/2024-19:49:18] [E] [TRT] 4: [convolutionNode.cpp::computeOutputExtents::58] Error Code 4: Internal Error ((Unnamed Layer 258) [Convolution]: number of kernel weights does not match tensor dimensions) [05/19/2024-19:49:18] [E] [TRT] 3: (Unnamed Layer* 277) [Convolution]:kernel weights has count 147456 but 184320 was expected [05/19/2024-19:49:18] [E] [TRT] 4: (Unnamed Layer* 277) [Convolution]: count of 147456 weights in kernel, but kernel dimensions (3,3) with 256 input channels, 80 output channels and 1 groups were specified. Expected Weights count is 256 * 33 * 80 / 1 = 184320 [05/19/2024-19:49:18] [E] [TRT] 4: [convolutionNode.cpp::computeOutputExtents::58] Error Code 4: Internal Error ((Unnamed Layer 277) [Convolution]: number of kernel weights does not match tensor dimensions) Building engine, please wait for a while... [05/19/2024-19:49:18] [E] [TRT] 4: [graphShapeAnalyzer.cpp::needTypeAndDimensions::2212] Error Code 4: Internal Error ((Unnamed Layer* 239) [Convolution]: output shape can not be computed) [05/19/2024-19:49:18] [E] [TRT] 4: [network.cpp::validate::3093] Error Code 4: Internal Error (Could not compute dimensions for (Unnamed Layer* 239) [Convolution]_output, because the network is not valid.) Build engine successfully! yolov8_det: /home/big/YOLO/yolov8/yolov8_det.cpp:30: void serialize_engine(std::string&, std::string&, int&, std::string&, float&, float&, int&): Assertion `serialized_engine' failed. 已放弃 (核心已转储)

cimmen avatar May 19 '24 12:05 cimmen