It would be more accurate to use the INTER_AREA interpolation than the INTER_CUBIC one for the resize of the target.
Indeed, this downsampling is more natural here because it computes the weighted average of pixels.
Moreover, the rescale should be normalized with int(target.shape[0]) * int(target.shape[1])/ (int(target.shape[1]/ratio) * int(target.shape[0]/ratio)) rather than ratio**2.
It is not that minor, the current resize produces 1% of error.
It would be more accurate to use the INTER_AREA interpolation than the INTER_CUBIC one for the resize of the target. Indeed, this downsampling is more natural here because it computes the weighted average of pixels.
Moreover, the rescale should be normalized with
int(target.shape[0]) * int(target.shape[1])/ (int(target.shape[1]/ratio) * int(target.shape[0]/ratio))
rather thanratio**2
.It is not that minor, the current resize produces 1% of error.
I will make a PR for that!
Thanks