specifically, numpy.unique(label) here would only output [-1 ,0], where more classes should be preserved after the resize.
The offending test case is added in this PR as test_resize_labels, in which an array of int type is passed to the resize method.
The fix is to use the defaultmode specified by PIL which will determine the mode automatically from the given data.
You may also decide to accept only float types for the resize method. In that case the PSP example needs a bug fix like transforms.resize(labels.astype(np.float32), and I would assert against violating types in the resize method.
Hello I think this is a cool project.
I came across what looked like a bug when I was running the example for PSP:
https://github.com/chainer/chainercv/blob/b4647d3960d3e1e66834036c9f386a964813d5a6/examples/pspnet/train_multi.py#L96
specifically,
numpy.unique(label)
here would only output[-1 ,0]
, where more classes should be preserved after the resize.The offending test case is added in this PR as
test_resize_labels
, in which an array ofint
type is passed to the resize method.The fix is to use the default
mode
specified by PIL which will determine the mode automatically from the given data.You may also decide to accept only
float
types for the resize method. In that case the PSP example needs a bug fix liketransforms.resize(labels.astype(np.float32)
, and I would assert against violating types in theresize
method.