wang-xinyu / tensorrtx

Implementation of popular deep learning networks with TensorRT network definition API
MIT License
7.02k stars 1.78k forks source link

wts转化engine模型失败,Load engine file failed: D:/YOLOv8/yolov8_tensorrt-main/weights/yolov8n.engine #1576

Open ranranmen opened 2 months ago

ranranmen commented 2 months ago

Env

About this repo

yolov8

problem

您好,我在得到yolov8n.exe文件之后转化engine模型就遇到了下面这个问题 文件夹cmd之后 D:\YOLOv8\yolov8_tensorrt-main\build\Release>yolov8.exe -s D:\YOLOv8\weights\yolov8n.wts D:\YOLOv8\weights\yolov8n.engine s Load engine file failed: D:/YOLOv8/yolov8_tensorrt-main/weights/yolov8n.engine 我现在思考是不是因为,我安装了cuda之后再装的visual studio导致的(针对这个编译前我已经把cuda相关文件复制到vs里面了),转化模型修改参数,目前还没有做过修改

ranranmen commented 2 months ago

后续是这样的 yolov8.exe -s D:\YOLOv8\yolov8_tensorrt-main\weights\yolov8n.wts D:\YOLOv8\yolov8_tensorrt-main\weights\yolov8n.engine n CUDA lazy loading is not enabled. Enabling it can significantly reduce device memory usage and speed up TensorRT initialization. See "Lazy Loading" section of CUDA documentation https://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html#lazy-loading Loading weights: ..weights/yolov8n.wts The implicit batch dimension mode has been deprecated. Please create the network with NetworkDefinitionCreationFlag::kEXPLICIT_BATCH flag whenever possible. 3: (Unnamed Layer 0) [Convolution]:kernel weights has count 0 but 864 was expected 4: (Unnamed Layer 0) [Convolution]: count of 0 weights in kernel, but kernel dimensions (3,3) with 3 input channels, 32 output channels and 1 groups were specified. Expected Weights count is 3 33 32 / 1 = 864 4: [convolutionNode.cpp::nvinfer1::builder::ConvolutionNode::computeOutputExtents::58] Error Code 4: Internal Error ((Unnamed Layer 0) [Convolution]: number of kernel weights does not match tensor dimensions) 3: [scaleLayer.h::nvinfer1::ScaleLayer::setScale::23] Error Code 3: API Usage Error (Parameter check failed at: scaleLayer.h::nvinfer1::ScaleLayer::setScale::23, condition: scale.count > 0 ) 3: [scaleLayer.h::nvinfer1::ScaleLayer::setShift::24] Error Code 3: API Usage Error (Parameter check failed at: scaleLayer.h::nvinfer1::ScaleLayer::setShift::24, condition: shift.count > 0 ) 3: [scaleLayer.h::nvinfer1::ScaleLayer::setPower::25] Error Code 3: API Usage Error (Parameter check failed at: scaleLayer.h::nvinfer1::ScaleLayer::setPower::25, condition: power.count > 0 ) 3: [scaleLayer.h::nvinfer1::ScaleLayer::setScale::23] Error Code 3: API Usage Error (Parameter check failed at: scaleLayer.h::nvinfer1::ScaleLayer::setScale::23, condition: scale.count > 0 ) 3: [scaleLayer.h::nvinfer1::ScaleLayer::setShift::24] Error Code 3: API Usage Error (Parameter check failed at: scaleLayer.h::nvinfer1::ScaleLayer::setShift::24, condition: shift.count > 0 ) 3: [scaleLayer.h::nvinfer1::ScaleLayer::setPower::25] Error Code 3: API Usage Error (Parameter check failed at: scaleLayer.h::nvinfer1::ScaleLayer::setPower::25, condition: power.count > 0 ) 3: [scaleLayer.h::nvinfer1::ScaleLayer::setScale::23] Error Code 3: API Usage Error (Parameter check failed at: scaleLayer.h::nvinfer1::ScaleLayer::setScale::23, condition: scale.count > 0 ) 3: [scaleLayer.h::nvinfer1::ScaleLayer::setShift::24] Error Code 3: API Usage Error (Parameter check failed at: scaleLayer.h::nvinfer1::ScaleLayer::setShift::24, condition: shift.count > 0 ) 3: [scaleLayer.h::nvinfer1::ScaleLayer::setPower::25] Error Code 3: API Usage Error (Parameter check failed at: scaleLayer.h::nvinfer1::ScaleLayer::setPower::25, condition: power.count > 0 ) 3: [scaleLayer.h::nvinfer1::ScaleLayer::setScale::23] Error Code 3: API Usage Error (Parameter check failed at: scaleLayer.h::nvinfer1::ScaleLayer::setScale::23, condition: scale.count > 0 ) 3: [scaleLayer.h::nvinfer1::ScaleLayer::setShift::24] Error Code 3: API Usage Error (Parameter check failed at: scaleLayer.h::nvinfer1::ScaleLayer::setShift::24, condition: shift.count > 0 ) 3: [scaleLayer.h::nvinfer1::ScaleLayer::setPower::25] Error Code 3: API Usage Error (Parameter check failed at: scaleLayer.h::nvinfer1::ScaleLayer::setPower::25, condition: power.count > 0 ) 3: [scaleLayer.h::nvinfer1::ScaleLayer::setScale::23] Error Code 3: API Usage Error (Parameter check failed at: scaleLayer.h::nvinfer1::ScaleLayer::setScale::23, condition: scale.count > 0 ) 3: [scaleLayer.h::nvinfer1::ScaleLayer::setShift::24] Error Code 3: API Usage Error (Parameter check failed at: scaleLayer.h::nvinfer1::ScaleLayer::setShift::24, condition: shift.count > 0 ) 3: [scaleLayer.h::nvinfer1::ScaleLayer::setPower::25] Error Code 3: API Usage Error (Parameter check failed at: scaleLayer.h::nvinfer1::ScaleLayer::setPower::25, condition: power.count > 0 ) 3: [scaleLayer.h::nvinfer1::ScaleLayer::setScale::23] Error Code 3: API Usage Error (Parameter check failed at: scaleLayer.h::nvinfer1::ScaleLayer::setScale::23, condition: scale.count > 0 ) 3: [scaleLayer.h::nvinfer1::ScaleLayer::setShift::24] Error Code 3: API Usage Error (Parameter check failed at: scaleLayer.h::nvinfer1::ScaleLayer::setShift::24, condition: shift.count > 0 ) 3: [scaleLayer.h::nvinfer1::ScaleLayer::setPower::25] Error Code 3: API Usage Error (Parameter check failed at: scaleLayer.h::nvinfer1::ScaleLayer::setPower::25, condition: power.count > 0 ) 3: [scaleLayer.h::nvinfer1::ScaleLayer::setScale::23] Error Code 3: API Usage Error (Parameter check failed at: scaleLayer.h::nvinfer1::ScaleLayer::setScale::23, condition: scale.count > 0 ) 3: [scaleLayer.h::nvinfer1::ScaleLayer::setShift::24] Error Code 3: API Usage Error (Parameter check failed at: scaleLayer.h::nvinfer1::ScaleLayer::setShift::24, condition: shift.count > 0 ) 3: [scaleLayer.h::nvinfer1::ScaleLayer::setPower::25] Error Code 3: API Usage Error (Parameter check failed at: scaleLayer.h::nvinfer1::ScaleLayer::setPower::25, condition: power.count > 0 ) 3: [scaleLayer.h::nvinfer1::ScaleLayer::setScale::23] Error Code 3: API Usage Error (Parameter check failed at: scaleLayer.h::nvinfer1::ScaleLayer::setScale::23, condition: scale.count > 0 ) 3: [scaleLayer.h::nvinfer1::ScaleLayer::setShift::24] Error Code 3: API Usage Error (Parameter check failed at: scaleLayer.h::nvinfer1::ScaleLayer::setShift::24, condition: shift.count > 0 ) 3: [scaleLayer.h::nvinfer1::ScaleLayer::setPower::25] Error Code 3: API Usage Error (Parameter check failed at: scaleLayer.h::nvinfer1::ScaleLayer::setPower::25, condition: power.count > 0 ) 3: [scaleLayer.h::nvinfer1::ScaleLayer::setScale::23] Error Code 3: API Usage Error (Parameter check failed at: scaleLayer.h::nvinfer1::ScaleLayer::setScale::23, condition: scale.count > 0 ) 3: [scaleLayer.h::nvinfer1::ScaleLayer::setShift::24] Error Code 3: API Usage Error (Parameter check failed at: scaleLayer.h::nvinfer1::ScaleLayer::setShift::24, condition: shift.count > 0 ) 3: [scaleLayer.h::nvinfer1::ScaleLayer::setPower::25] Error Code 3: API Usage Error (Parameter check failed at: scaleLayer.h::nvinfer1::ScaleLayer::setPower::25, condition: power.count > 0 ) 3: [scaleLayer.h::nvinfer1::ScaleLayer::setScale::23] Error Code 3: API Usage Error (Parameter check failed at: scaleLayer.h::nvinfer1::ScaleLayer::setScale::23, condition: scale.count > 0 ) 3: [scaleLayer.h::nvinfer1::ScaleLayer::setShift::24] Error Code 3: API Usage Error (Parameter check failed at: scaleLayer.h::nvinfer1::ScaleLayer::setShift::24, condition: shift.count > 0 ) 3: [scaleLayer.h::nvinfer1::ScaleLayer::setPower::25] Error Code 3: API Usage Error (Parameter check failed at: scaleLayer.h::nvinfer1::ScaleLayer::setPower::25, condition: power.count > 0 ) 3: [scaleLayer.h::nvinfer1::ScaleLayer::setScale::23] Error Code 3: API Usage Error (Parameter check failed at: scaleLayer.h::nvinfer1::ScaleLayer::setScale::23, condition: scale.count > 0 ) 3: [scaleLayer.h::nvinfer1::ScaleLayer::setShift::24] Error Code 3: API Usage Error (Parameter check failed at: scaleLayer.h::nvinfer1::ScaleLayer::setShift::24, condition: shift.count > 0 ) 3: [scaleLayer.h::nvinfer1::ScaleLayer::setPower::25] Error Code 3: API Usage Error (Parameter check failed at: scaleLayer.h::nvinfer1::ScaleLayer::setPower::25, condition: power.count > 0 ) 3: [scaleLayer.h::nvinfer1::ScaleLayer::setScale::23] Error Code 3: API Usage Error (Parameter check failed at: scaleLayer.h::nvinfer1::ScaleLayer::setScale::23, condition: scale.count > 0 ) 3: [scaleLayer.h::nvinfer1::ScaleLayer::setShift::24] Error Code 3: API Usage Error (Parameter check failed at: scaleLayer.h::nvinfer1::ScaleLayer::setShift::24, condition: shift.count > 0 ) 3: [scaleLayer.h::nvinfer1::ScaleLayer::setPower::25] Error Code 3: API Usage Error (Parameter check failed at: scaleLayer.h::nvinfer1::ScaleLayer::setPower::25, condition: power.count > 0 ) 3: [scaleLayer.h::nvinfer1::ScaleLayer::setScale::23] Error Code 3: API Usage Error (Parameter check failed at: scaleLayer.h::nvinfer1::ScaleLayer::setScale::23, condition: scale.count > 0 ) 3: [scaleLayer.h::nvinfer1::ScaleLayer::setShift::24] Error Code 3: API Usage Error (Parameter check failed at: scaleLayer.h::nvinfer1::ScaleLayer::setShift::24, condition: shift.count > 0 ) 3: [scaleLayer.h::nvinfer1::ScaleLayer::setPower::25] Error Code 3: API Usage Error (Parameter check failed at: scaleLayer.h::nvinfer1::ScaleLayer::setPower::25, condition: power.count > 0 ) 3: [scaleLayer.h::nvinfer1::ScaleLayer::setScale::23] Error Code 3: API Usage Error (Parameter check failed at: scaleLayer.h::nvinfer1::ScaleLayer::setScale::23, condition: scale.count > 0 ) 3: [scaleLayer.h::nvinfer1::ScaleLayer::setShift::24] Error Code 3: API Usage Error (Parameter check failed at: scaleLayer.h::nvinfer1::ScaleLayer::setShift::24, condition: shift.count > 0 ) 3: [scaleLayer.h::nvinfer1::ScaleLayer::setPower::25] Error Code 3: API Usage Error (Parameter check failed at: scaleLayer.h::nvinfer1::ScaleLayer::setPower::25, condition: power.count > 0 ) 3: [scaleLayer.h::nvinfer1::ScaleLayer::setScale::23] Error Code 3: API Usage Error (Parameter check failed at: scaleLayer.h::nvinfer1::ScaleLayer::setScale::23, condition: scale.count > 0 ) 3: [scaleLayer.h::nvinfer1::ScaleLayer::setShift::24] Error Code 3: API Usage Error (Parameter check failed at: scaleLayer.h::nvinfer1::ScaleLayer::setShift::24, condition: shift.count > 0 ) 3: [scaleLayer.h::nvinfer1::ScaleLayer::setPower::25] Error Code 3: API Usage Error (Parameter check failed at: scaleLayer.h::nvinfer1::ScaleLayer::setPower::25, condition: power.count > 0 ) 3: [scaleLayer.h::nvinfer1::ScaleLayer::setScale::23] Error Code 3: API Usage Error (Parameter check failed at: scaleLayer.h::nvinfer1::ScaleLayer::setScale::23, condition: scale.count > 0 ) 3: [scaleLayer.h::nvinfer1::ScaleLayer::setShift::24] Error Code 3: API Usage Error (Parameter check failed at: scaleLayer.h::nvinfer1::ScaleLayer::setShift::24, condition: shift.count > 0 ) 3: [scaleLayer.h::nvinfer1::ScaleLayer::setPower::25] Error Code 3: API Usage Error (Parameter check failed at: scaleLayer.h::nvinfer1::ScaleLayer::setPower::25, condition: power.count > 0 ) 3: [scaleLayer.h::nvinfer1::ScaleLayer::setScale::23] Error Code 3: API Usage Error (Parameter check failed at: scaleLayer.h::nvinfer1::ScaleLayer::setScale::23, condition: scale.count > 0 ) 3: [scaleLayer.h::nvinfer1::ScaleLayer::setShift::24] Error Code 3: API Usage Error (Parameter check failed at: scaleLayer.h::nvinfer1::ScaleLayer::setShift::24, condition: shift.count > 0 ) 3: [scaleLayer.h::nvinfer1::ScaleLayer::setPower::25] Error Code 3: API Usage Error (Parameter check failed at: scaleLayer.h::nvinfer1::ScaleLayer::setPower::25, condition: power.count > 0 ) 3: [scaleLayer.h::nvinfer1::ScaleLayer::setScale::23] Error Code 3: API Usage Error (Parameter check failed at: scaleLayer.h::nvinfer1::ScaleLayer::setScale::23, condition: scale.count > 0 ) 3: [scaleLayer.h::nvinfer1::ScaleLayer::setShift::24] Error Code 3: API Usage Error (Parameter check failed at: scaleLayer.h::nvinfer1::ScaleLayer::setShift::24, condition: shift.count > 0 ) 3: [scaleLayer.h::nvinfer1::ScaleLayer::setPower::25] Error Code 3: API Usage Error (Parameter check failed at: scaleLayer.h::nvinfer1::ScaleLayer::setPower::25, condition: power.count > 0 ) 3: [scaleLayer.h::nvinfer1::ScaleLayer::setScale::23] Error Code 3: API Usage Error (Parameter check failed at: scaleLayer.h::nvinfer1::ScaleLayer::setScale::23, condition: scale.count > 0 ) 3: [scaleLayer.h::nvinfer1::ScaleLayer::setShift::24] Error Code 3: API Usage Error (Parameter check failed at: scaleLayer.h::nvinfer1::ScaleLayer::setShift::24, condition: shift.count > 0 ) 3: [scaleLayer.h::nvinfer1::ScaleLayer::setPower::25] Error Code 3: API Usage Error (Parameter check failed at: scaleLayer.h::nvinfer1::ScaleLayer::setPower::25, condition: power.count > 0 ) 3: [scaleLayer.h::nvinfer1::ScaleLayer::setScale::23] Error Code 3: API Usage Error (Parameter check failed at: scaleLayer.h::nvinfer1::ScaleLayer::setScale::23, condition: scale.count > 0 ) 3: [scaleLayer.h::nvinfer1::ScaleLayer::setShift::24] Error Code 3: API Usage Error (Parameter check failed at: scaleLayer.h::nvinfer1::ScaleLayer::setShift::24, condition: shift.count > 0 ) 3: [scaleLayer.h::nvinfer1::ScaleLayer::setPower::25] Error Code 3: API Usage Error (Parameter check failed at: scaleLayer.h::nvinfer1::ScaleLayer::setPower::25, condition: power.count > 0 ) 3: [scaleLayer.h::nvinfer1::ScaleLayer::setScale::23] Error Code 3: API Usage Error (Parameter check failed at: scaleLayer.h::nvinfer1::ScaleLayer::setScale::23, condition: scale.count > 0 ) 3: [scaleLayer.h::nvinfer1::ScaleLayer::setShift::24] Error Code 3: API Usage Error (Parameter check failed at: scaleLayer.h::nvinfer1::ScaleLayer::setShift::24, condition: shift.count > 0 ) 3: [scaleLayer.h::nvinfer1::ScaleLayer::setPower::25] Error Code 3: API Usage Error (Parameter check failed at: scaleLayer.h::nvinfer1::ScaleLayer::setPower::25, condition: power.count > 0 ) 3: [scaleLayer.h::nvinfer1::ScaleLayer::setScale::23] Error Code 3: API Usage Error (Parameter check failed at: scaleLayer.h::nvinfer1::ScaleLayer::setScale::23, condition: scale.count > 0 ) 3: [scaleLayer.h::nvinfer1::ScaleLayer::setShift::24] Error Code 3: API Usage Error (Parameter check failed at: scaleLayer.h::nvinfer1::ScaleLayer::setShift::24, condition: shift.count > 0 ) 3: [scaleLayer.h::nvinfer1::ScaleLayer::setPower::25] Error Code 3: API Usage Error (Parameter check failed at: scaleLayer.h::nvinfer1::ScaleLayer::setPower::25, condition: power.count > 0 ) 3: [scaleLayer.h::nvinfer1::ScaleLayer::setScale::23] Error Code 3: API Usage Error (Parameter check failed at: scaleLayer.h::nvinfer1::ScaleLayer::setScale::23, condition: scale.count > 0 ) 3: [scaleLayer.h::nvinfer1::ScaleLayer::setShift::24] Error Code 3: API Usage Error (Parameter check failed at: scaleLayer.h::nvinfer1::ScaleLayer::setShift::24, condition: shift.count > 0 ) 3: [scaleLayer.h::nvinfer1::ScaleLayer::setPower::25] Error Code 3: API Usage Error (Parameter check failed at: scaleLayer.h::nvinfer1::ScaleLayer::setPower::25, condition: power.count > 0 ) 3: [scaleLayer.h::nvinfer1::ScaleLayer::setScale::23] Error Code 3: API Usage Error (Parameter check failed at: scaleLayer.h::nvinfer1::ScaleLayer::setScale::23, condition: scale.count > 0 ) 3: [scaleLayer.h::nvinfer1::ScaleLayer::setShift::24] Error Code 3: API Usage Error (Parameter check failed at: scaleLayer.h::nvinfer1::ScaleLayer::setShift::24, condition: shift.count > 0 ) 3: [scaleLayer.h::nvinfer1::ScaleLayer::setPower::25] Error Code 3: API Usage Error (Parameter check failed at: scaleLayer.h::nvinfer1::ScaleLayer::setPower::25, condition: power.count > 0 ) 3: [scaleLayer.h::nvinfer1::ScaleLayer::setScale::23] Error Code 3: API Usage Error (Parameter check failed at: scaleLayer.h::nvinfer1::ScaleLayer::setScale::23, condition: scale.count > 0 ) 3: [scaleLayer.h::nvinfer1::ScaleLayer::setShift::24] Error Code 3: API Usage Error (Parameter check failed at: scaleLayer.h::nvinfer1::ScaleLayer::setShift::24, condition: shift.count > 0 ) 3: [scaleLayer.h::nvinfer1::ScaleLayer::setPower::25] Error Code 3: API Usage Error (Parameter check failed at: scaleLayer.h::nvinfer1::ScaleLayer::setPower::25, condition: power.count > 0 ) 3: [scaleLayer.h::nvinfer1::ScaleLayer::setScale::23] Error Code 3: API Usage Error (Parameter check failed at: scaleLayer.h::nvinfer1::ScaleLayer::setScale::23, condition: scale.count > 0 ) 3: [scaleLayer.h::nvinfer1::ScaleLayer::setShift::24] Error Code 3: API Usage Error (Parameter check failed at: scaleLayer.h::nvinfer1::ScaleLayer::setShift::24, condition: shift.count > 0 ) 3: [scaleLayer.h::nvinfer1::ScaleLayer::setPower::25] Error Code 3: API Usage Error (Parameter check failed at: scaleLayer.h::nvinfer1::ScaleLayer::setPower::25, condition: power.count > 0 ) 3: [scaleLayer.h::nvinfer1::ScaleLayer::setScale::23] Error Code 3: API Usage Error (Parameter check failed at: scaleLayer.h::nvinfer1::ScaleLayer::setScale::23, condition: scale.count > 0 ) 3: [scaleLayer.h::nvinfer1::ScaleLayer::setShift::24] Error Code 3: API Usage Error (Parameter check failed at: scaleLayer.h::nvinfer1::ScaleLayer::setShift::24, condition: shift.count > 0 ) 3: [scaleLayer.h::nvinfer1::ScaleLayer::setPower::25] Error Code 3: API Usage Error (Parameter check failed at: scaleLayer.h::nvinfer1::ScaleLayer::setPower::25, condition: power.count > 0 ) 3: [network.cpp::nvinfer1::Network::addResize::1421] Error Code 3: API Usage Error (Parameter check failed at: network.cpp::nvinfer1::Network::addResize::1421, condition: input.getDimensions().nbDims > 0 )

lindsayshuo commented 2 months ago

kernel weights has count 0 but 864 was expected

看这个报错

“kernel weights has count 0 but 864 was expected”

检查下wts

felipemasuda commented 1 month ago

Any solution?