Use CPU resize before upload to GPU to remove PCIe bottleneck

This commit is contained in:
2026-04-04 22:29:08 +11:00
parent e134ebdf15
commit 98681f4da6
15 changed files with 572 additions and 493 deletions

View File

@@ -178,10 +178,10 @@ std::vector<TextBox> RTOCRDetector::Detect(const cv::Mat& image,
}
if (!usedNV12) {
// Fallback: standard BGR upload
cv::cuda::GpuMat gpuImg;
gpuImg.upload(image);
cv::cuda::resize(gpuImg, gpuResized, resizeShape);
// Fallback: CPU resize then upload small image to GPU
cv::Mat cpuResized;
cv::resize(image, cpuResized, resizeShape, 0, 0, cv::INTER_LINEAR);
gpuResized.upload(cpuResized);
}
// Keep BGR order (PaddleOCR official does NOT convert BGR->RGB)