5

I need to train a convolutional neural network to classify snake images. The problem is that I have only a small number of images available for some snake types.

So, what is the best approach to train a neural network for image classification using a small data set?

nbro
  • 39,006
  • 12
  • 98
  • 176

2 Answers2

4

Use Fine Tuning

You can simply use a pre-trained model on ImageNet, as this data set has multiple snakes classes.

Then you can fine tune the model with your own small data set and outputs. See this for further understanding : Fine Tuning in Keras

(if you don't use Keras, there are other tutorials on the internet using other Machine Learning framework)

The idea is just removing the last layer (1000 outputs if you use a model pre-trained with ImageNet) and adding a layer of your choice with random weights and a custom number of outputs (number of your classes).

Then your retrain your network, in general we retrained only the last layers (as first layers have more general features).

Oliver Mason
  • 5,322
  • 12
  • 32
Jérémy Blain
  • 515
  • 3
  • 14
3

Besides using transfer learning described in other answer, you should consider using siamese network. This type of network is used in cases when one does not posess many examples of objects he wants to distinguish. General idea is that instead of "telling" the network "This is a cobra", you provide information like: "This is a cobra, and that is a rattlesnake, learn the difference".

There is a whole subject dedicated to your problem and it is called one shot learning.

Take a look at this tutorial: https://hackernoon.com/one-shot-learning-with-siamese-networks-in-pytorch-8ddaab10340e

don_pablito
  • 333
  • 1
  • 11
  • This is what I learned on Andrew Ng's Deep Learning course at Coursera, and I recommend the course if the OP wants to learn about it. – Blaszard Aug 02 '18 at 01:37