I am trying to determine the right approach to take for an image classification problem which involves 10 classes and only 1900 samples. The images (1288 x 964 resolution) are of industrial parts whereby each class of part differs by its serial number as well as other features. I've considered using a CNN but am wondering if this may be infeasible due to insufficient quantity of data; or is this not the case? Otherwise from my research I've determined that the more traditional KNN or SVM may work better due to less data but am in need of some expert guidance. Thank you.

  • $\begingroup$ Try transfer learning on a CNN that is pretrained on ImageNet or similar. At 190 samples per class it might do allright $\endgroup$
    – Jon Nordby
    Commented Feb 3, 2019 at 23:18
  • $\begingroup$ +1 for transfer learning. Suitable data augmentation will also help. In practice, the more one can standardize how the photos are taken (i.e. if this is e.g. sorting parts, then ensuring consistent lightning etc. Likely helps). $\endgroup$
    – Björn
    Commented Feb 4, 2019 at 4:06

1 Answer 1


While it depends on the data you have and the distribution of it over the classes, it sounds that you can use a pre-trained model that was trained on a large dataset (preferably somehow similar to yours). As it was mentioned by @johnor you can use one transfer learning technique for example to 'Freeze' all parts of the model and train only the last fully connected layer with your new classes. The idea behind it, is that the pre-trained model have learned good representations of an image, and therefore it can be used to represent any new image.
Depends on the language and library you chose to use, you can find several good pre-trained models on the web (for example ResNet that was trained on ImageNet)

Basically the idea is to use the pre-trained model to attain a vector representation of the image, we can refer to it as the encoder of the image.
And then, train only the decoder to classify the encoded vector to classify it to the relevant class.

There are several more techniques that can be used, you can read more about it in this article:


As I've mentioned in the beginning of my answer, it depends on the data you have.
It might be that for your specific data a more classic ML algorithm (such as RandomForest) can give sufficient results


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.