2
$\begingroup$

Lately, there are lots of posts on one-shot learning. I tried to figure out what it is by reading some articles. To me, it looks like similar to transfer learning, in which we can use pre-trained model weights to create our own model. Fine-tuning also seems a similar concept to me.

Can anyone help me and explain the differences between all three of them?

$\endgroup$
4
$\begingroup$

They are all related terms.

From top to bottom:

One-shot learning aims to achieve results with one or very few examples. Imagine an image classification task. You may show an apple and a knife to a human and no further examples are needed to continue classifying. That would be the ideal outcome, but for algorithms.

In order to achieve one-shot learning (or close) we can rely on knowledge transfer, just like the human in the example would do (we are trained to be amazing at image processing, but here we would also exploit other knowledge like abstract reasoning abilities, and so on).

This brings us to transfer learning. Generally speaking, transfer learning is a machine learning paradigm where we train a model on one problem and then try to apply it to a different one (after some adjustments, as we'll see in a second).

In the example above, classifying apples and knives is not at all trivial. However, if we are given a neural network that already excels at image classification, with super-human results in over 1000 categories... perhaps it is easy to adapt this model to our specific apples vs knives situation.

This "adapting", those "adjustments", are essentially what we call fine-tuning. We could say that fine-tuning is the training required to adapt an already trained model to the new task. This is normally much less intensive than training from scratch, and many of the characteristics of the given model are retained.

Fine-tuning usually covers more steps. A typical pipeline in deep learning for computer vision would be this:

  1. Get trained model (image classifier champion)
  2. Note the head of our model does not match our needs (there's probably one output per category, and we only need two categories now!)

  3. Swap the very last layer(s) of the model, so that the output matches our needs, but keeping the rest of the architecture and already trained parameters intact.

  4. Train (fine-tune!) our model on images that are specific to our problem (only a few apples and knives in our silly example). We often only allow the last layers to learn at first, so they "catch up" with the rest of the model (in this case we talk about freezing and unfreezing and discriminative learning rates, but that's a bit beyond the question).

Note that some people may sometimes use fine-tuning as a synonym for transfer learning, so be careful about that!

| improve this answer | |
$\endgroup$
  • 2
    $\begingroup$ The TensorFlow tutorial on transfer learning https://www.tensorflow.org/tutorials/images/transfer_learning also explains transfer learning quite well. It uses the term transfer learning to refer to the situation where you freeze all convolutional layers, added new dense trainable layers for the new classification task, then train the new architecture. It uses the term fine-tuning for the scenario where you train some of the convolution layers (typically, not all of them, but only the last ones) and the classifier (dense) layers. $\endgroup$ – nbro Jun 11 at 12:44
  • $\begingroup$ It makes sense. I would argue that even if you train all layers (not only the last ones) we should talk about fine tuning, as learning is not starting from scratch and will normally not need nearly as many epochs as if you do start from scratch. But it's good to know the minor differences in use of these terms to avoid confusion! $\endgroup$ – Pablo Jun 11 at 15:35

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.