How to scale a symbol


#1

guys, is there anyone know how to resize a symbol to a specific shape (h,w)?
thank you very much


#2

Your question is quite vague. So I’m going to make these assumptions: You have a symbol which represents an NDArray of shape (H, W) (for example a greyscale image) and you’d like to resize this array to (h, w). For this purpose, you can use BilinearSampler().


#3

Thanks for your help.
If we want to scale an NDArray, we can do it using mx.image.imresize(),
for a symbol object, I didn’t find any easy way to do this.
BilinearSampler() can do it ,but it’s a hard way.
So, I’m looking for a simple way to make it.


#4

imresize is not an operator on NDArray, i.e. you cannot use it as part of the computational graph (no backward()). It is meant to be used for data pre-processing.

There is also ROIPooling which can also be used for resizing images.


#5

You are right! Computational graph needs Symbols, tensorflow and caffe both can do this through resize_bilinear().
Thank you very much.