I am a beginner to Deep Learning and have read some tutorials. Now I want to try something like LeNet on my own data, but I do not know how I should prepare it as a suitable training input for LeNet. Currently, all of the images in my dataset have been stored in a folder and I have an excel file that contains the information about the label of each image. I am confused in what format/data type I should store all the N images and the output (label) vector?

I know that the output should be a [Nx1] vector of the labels of images, but not sure if I should have a similar [NxP] matrix for the input images where each row of the vector represents an image ( width: w, height:h; P=wxh).

Furthermore, do images have to have the same size?

Thank you in advance.


2 Answers 2


In case you're more concerned about having a model than learning the intricacies of deep learning a good idea could be to follow this tensorflow tutorial, using python as your tag mentions. Between installing tensorflow and following the tutorial it will probably take you around 2-3 hours, you will not have to code anything.

Under the hood this does the following:

  • First a huge network is trained on ImageNet (a very big dataset of images) and the network learns lots of interesting features in its intermediate layers.
  • Then it chops of the last layer of the network (which is useful only for that particular dataset).
  • It adds a new layer on top of the chopped network to predict your examples.
  • Using your images it trains the weights of this last layer.

You end up having a very powerful model even if you have very few images (you probably need at least 100). It also handles the different resolutions for you.


Yes, images should be of the same size.

If you will be using convolutional neural network like LeNet you should store each image in matrix (WxHxColorChannel).

For simple algorithms like kNN images are reshaped to single column vector.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.