I'm starting a project where the task is to identify sneaker types from images. I'm currently reading into TensorFlow and Torch implementations. My question is: how many images per class are required to reach a reasonable classification performance?

  • $\begingroup$ Define "reasonable"? Is your goal to get to an accuracy that could be used in a production system? Is your goal some other thing? How many classes are there?There are some variations in pre-training and semi-supervised training that could save you effort, so could you clarify whether your concern is in the effort labelling images, or simply sourcing any image. Finally, how clean and simple are your target images? Images where lighting and pose are fixed will be easier to train than "real world" photographs with the sneakers being worn. $\endgroup$ Aug 4 '16 at 13:27
  • $\begingroup$ Yes, this will be used in production. I currently don't know how many classes there will be since I don't know how many different sneaker types there are in the image library. My best guess would be on the order of 50-100, but the courser the description of the sneaker, the less the classes (e.g. air-jordan vs. air-jordan-ultrafit). Unfortunately, the image library is a mix of sneakers being worn and sneakers posed as fixed items with a white backdrop. $\endgroup$
    – Feynman27
    Aug 4 '16 at 14:18

From How few training examples is too few when training a neural network? on CV:

It really depends on your dataset, and network architecture. One rule of thumb I have read (2) was a few thousand samples per class for the neural network to start to perform very well. In practice, people try and see.

A good way to roughly assess to what extent it could be beneficial to have more training samples is to plot the performance of the neural network based against the size of the training set, e.g. from (1):

enter image description here


The best approach is to collect as much data as you comfortably can. Then get started with the project and make a data model.

Now you can evaluate your model to see if it has High Bias or High Variance.

High Variance : In this situation you will see that Cross-Validation error is higher than Training error after convergence.There is a significant gap if you plot the same against training data size.

High Bias: In this situation Cross-Validation error is slightly higher than training error which itself is high when plotted against training data size.By plotting against training data size I mean ,you can input subsets of training data you have and keep incrementing subset size and plot errors.

If you see your model has high variance(overfit), adding more data will usually help in contrast to high bias(underfit) model where adding new training data doesn't help.

Also per class you must try to get same number of images otherwise datasets can become skewed(more of one kind).

Also I suggest if you are using TensorFlow ,read more about GOOGLE's INCEPTION Image Classifier. It is already trained classifier on google's image database and you can use it for your images, that way requirements for number of images comes down drastically.

  • $\begingroup$ I have already performed a quick test using TensorFlow's Inception-v3. The best it could do is give me a very course classification, such as "running shoe," but I need something a little more granular, such as "air-jordan-ultrafit." This is why I'm building a new training set to use with Inception. $\endgroup$
    – Feynman27
    Aug 4 '16 at 14:23
  • $\begingroup$ That is a strange definition of “a little more granular”. $\endgroup$
    – Jivan
    Feb 22 '20 at 21:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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