what is the difference between image reshape and resize, and when do we need to do it?
Image reshape and resize?
Hey @debjanihome, resize is the function used to change the size of the image, like an image of size 2828 needs to be carved on a bigger canvas like 100100. So here we need to use resize function.
Reshape on the other hand is used when you want to change the orientation of the matrix. Like you have a matrix of 34 and you want to change its orientation to 43, remember here that always product of initial shape elements = product of final shape elements. 34 = 12 = 43.
Hope this resolved your doubt
when would we want to change the orientation of the matrix?
Hey @debjanihome, there are certain circumstances like, some of them are described here.
-
Suppose trianing data consists of image of 28*28. You want to use linear classifier like logistic regression or support vector machines, than you need to provide input after flattening them, so you need to reshape it to (1,784)
-
On the other hand now you are given 784 pixel values as in numbers mnist data, but now you decided to implement CNN, now you need to reshape them to 28*28.
Hope this resolved your doubt.