dmlc / gluon-cv

Gluon CV Toolkit
http://gluon-cv.mxnet.io
Apache License 2.0
5.79k stars 1.21k forks source link

transform_test() - bug in original image output #1777

Closed ninafiona closed 3 months ago

ninafiona commented 6 months ago

When using the function load_test() or transform_test() there is a return value origs: "a numpy ndarray as original un-normalized color image for display." (see here: https://cv.gluon.ai/_modules/gluoncv/data/transforms/presets/yolo.html)

That image does not look like the original though, because it is resized with the "area-based" interpolation method. (see here: https://cv.gluon.ai/_modules/gluoncv/data/transforms/image.html#resize_short_within) With that method, values are outside of the 0-255 range and then, when astype('uint8') is applied, the image values over/underflow:

img = timage.resize_short_within(img, short, max_size, mult_base=stride)
orig_img = img.asnumpy().astype('uint8')

When applying functions afterwards, like gluoncv.utils.viz.plot_bbox(), the image looks incorrect at some spots.

github-actions[bot] commented 3 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.