1

I have been working on MNIST dataset to learn how to use Tensorflow and Python for my deep learning course.

I could read the data internally/externally and also train it in softmax and cnn thanks to tensorflow tutorial at website. At the end, I could get >%90 in softmax, >%98 in cnn, accuracy.

My problem is that I want to resize all images on MNIST as 14x14 and train it again, also to augment all (noising, rotating etc.) and train again. At the end, I want to be able to compare the accuracies of these three different dataset.

Could you please help me to solve it? How to resize all images and how the model should change.

Thanks!

Viper
  • 23
  • 1
  • 5

2 Answers2

0

One way to resize images is using the scipy resize function:

from scipy.misc import imresize
img = imresize(yourimage, (14, 14))

But my real advice to you is that should take a look at the Kadenze course "Creative applications of deep learning". This is a notebook for lecture two: https://github.com/pkmital/CADL/blob/master/session-2/lecture-2.ipynb

This course is really good at helping you understand using images and Tensorflow.

rmeertens
  • 4,383
  • 3
  • 17
  • 42
0

What you need is some image processing library like OpenCV, PIL etc. If you are using the dataset downloaded from tensorflow, it will be a 3d array( array of 2d arrays(every image)) or have more dimensions depending on how it's stored (I'm not sure) you can treat numpy arrays as images and use them with any image processing library you like but make sure what datatype they are in and if it's compatible with the libraries you are using.

Also, tensorflow also has such functions if you want to keep it all in tensorflow.

this post has an accepted answer.

SajanGohil
  • 960
  • 13
  • 26