Closed jianchao-li closed 6 years ago
I read the function TransformImgAndSeg, which has the following codes.
// perform scaling if (scale_factors_.size() > 0) { int scale_ind = Rand(scale_factors_.size()); Dtype scale = scale_factors_[scale_ind]; if (scale != 1) { img_height *= scale; img_width *= scale; ...
scale is a random scale_factor defined in transform_param, used to scale the size of the image. This makes perfect sense.
scale
scale_factor
transform_param
However, I noticed that the scale is also used to scale the pixel values in the same function.
if (has_mean_file) { int mean_index = (c * img_height + h_off + h) * img_width + w_off + w; transformed_data[top_index] = (pixel - mean[mean_index]) * scale; } else { if (has_mean_values) { transformed_data[top_index] = (pixel - mean_values_[c]) * scale; } else { transformed_data[top_index] = pixel * scale; } }
I think we should scale the pixel values using the scale in transform_param instead of this random scale_factor, right?
I misunderstood the codes. The correct scale is defined in the outer scope which is used to scale the pixel values.
I read the function TransformImgAndSeg, which has the following codes.
scale
is a randomscale_factor
defined intransform_param
, used to scale the size of the image. This makes perfect sense.However, I noticed that the
scale
is also used to scale the pixel values in the same function.I think we should scale the pixel values using the
scale
intransform_param
instead of this randomscale_factor
, right?