Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can i make it more faster?? #8

Open
tuneshverma opened this issue Nov 3, 2020 · 2 comments
Open

How can i make it more faster?? #8

tuneshverma opened this issue Nov 3, 2020 · 2 comments

Comments

@tuneshverma
Copy link

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;
}

@tjuskyzhang
Copy link
Owner

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.

@tuneshverma
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants