You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
void Normalize::Run(cv::Mat *im, const std::vector<float> &mean,
const std::vector<float> &scale, const bool is_scale) {
double e = 1.0;
if (is_scale) {
e /= 255.0;
}
(*im).convertTo(*im, CV_32FC3, e);
std::vector<cv::Mat> bgr_channels(3);
cv::split(*im, bgr_channels);
for (auto i = 0; i < bgr_channels.size(); i++) {
bgr_channels[i].convertTo(bgr_channels[i], CV_32FC1, 1.0 * scale[i],
(0.0 - mean[i]) * scale[i]);
}
cv::merge(bgr_channels, *im);
}
The order of mean_ = {0.485f, 0.456f, 0.406f} and scale_ = {1 / 0.229f, 1 / 0.224f, 1 / 0.225f} is RGB,but, the order of picture channels is BGR. Why to process image in this way?Is it wrong?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
code location:deploy/cpp_infer/src/preprocess_op.cpp
The order of
mean_ = {0.485f, 0.456f, 0.406f}
andscale_ = {1 / 0.229f, 1 / 0.224f, 1 / 0.225f}
is RGB,but, the order of picture channels is BGR. Why to process image in this way?Is it wrong?Beta Was this translation helpful? Give feedback.
All reactions