build: support OpenCV 5 and TensorRT 10
OpenCV: distros (Arch/CachyOS) now ship OpenCV 5 as default. The config package rejects a 5.x install when find_package requests 4, so probe for 5 first and fall back to 4. All components used here (core, imgproc, imgcodecs, videoio, dnn, objdetect, highgui) exist in both. TensorRT: nvinfer1::Dims5 was removed in TRT 10 (Dims2..Dims4 remain in NvInferLegacyDims.h). Build the TransNetV2 rank-5 input shape via the generic nvinfer1::Dims, which is valid on both 8.x and 10.x.
This commit is contained in:
@@ -511,8 +511,17 @@ public:
|
||||
}
|
||||
|
||||
std::lock_guard<std::mutex> lk(mu_);
|
||||
context_->setInputShape(input_name_.c_str(),
|
||||
nvinfer1::Dims5{1, kWindow, kFrameH, kFrameW, 3});
|
||||
// TensorRT 10 removed the fixed-rank Dims5 helper (Dims2..Dims4 remain
|
||||
// in NvInferLegacyDims.h). Build the rank-5 shape via the generic Dims,
|
||||
// which works on both 8.x and 10.x.
|
||||
nvinfer1::Dims shape{};
|
||||
shape.nbDims = 5;
|
||||
shape.d[0] = 1;
|
||||
shape.d[1] = kWindow;
|
||||
shape.d[2] = kFrameH;
|
||||
shape.d[3] = kFrameW;
|
||||
shape.d[4] = 3;
|
||||
context_->setInputShape(input_name_.c_str(), shape);
|
||||
|
||||
check_cuda(cudaMemcpyAsync(d_input_, buf.data(), buf.size() * 4,
|
||||
cudaMemcpyHostToDevice, stream_), "H2D input");
|
||||
|
||||
Reference in New Issue
Block a user