Scaled-YOLOv4-TensorRT icon indicating copy to clipboard operation
Scaled-YOLOv4-TensorRT copied to clipboard

How can i make it more faster??

Open tuneshverma opened this issue 4 years ago • 2 comments

Is there a way to make this loop more faster?

for (int i = 0; i < INPUT_H * INPUT_W; i++) { data[b * 3 * INPUT_H * INPUT_W + i] = pr_img.atcv::Vec3b(i)[2] / 255.0; data[b * 3 * INPUT_H * INPUT_W + i + INPUT_H * INPUT_W] = pr_img.atcv::Vec3b(i)[1] / 255.0; data[b * 3 * INPUT_H * INPUT_W + i + 2 * INPUT_H * INPUT_W] = pr_img.atcv::Vec3b(i)[0] / 255.0; }

tuneshverma avatar Nov 03 '20 07:11 tuneshverma

Is there a way to make this loop more faster?

for (int i = 0; i < INPUT_H * INPUT_W; i++) { data[b * 3 * INPUT_H * INPUT_W + i] = pr_img.atcv::Vec3b(i)[2] / 255.0; data[b * 3 * INPUT_H * INPUT_W + i + INPUT_H * INPUT_W] = pr_img.atcv::Vec3b(i)[1] / 255.0; data[b * 3 * INPUT_H * INPUT_W + i + 2 * INPUT_H * INPUT_W] = pr_img.atcv::Vec3b(i)[0] / 255.0; }

You can try to preprocess the input image on GPU.

tjuskyzhang avatar Nov 03 '20 07:11 tjuskyzhang

would using cv::normalize() be better here?

tuneshverma avatar Nov 03 '20 09:11 tuneshverma