Skip to content

Commit 2360277

Browse files
author
rpehkone
committed
Fix the bug: tensorrt-cpp input blob from BGR to RGB Megvii-BaseDetection#1758
1 parent 953037f commit 2360277

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

demo/TensorRT/cpp/yolox.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,8 @@ float* blobFromImage(cv::Mat& img){
218218
{
219219
for (size_t w = 0; w < img_w; w++)
220220
{
221-
blob[c * img_w * img_h + h * img_w + w] =
221+
size_t invc = ((size_t)channels - 1) - c;
222+
blob[invc * img_w * img_h + h * img_w + w] =
222223
(float)img.at<cv::Vec3b>(h, w)[c];
223224
}
224225
}

0 commit comments

Comments
 (0)