Deep LearningInsights & OpinionMachine Learning

One Shot Learning: Solution to your low data problem

The fact that machines are successful in replicating human intelligence is mind-boggling. However, this is only possible if machines are fed with correct mix of algorithms, huge collection of data, and most importantly the training given to it, which in turn leads to faster prediction or recognition of objects within the images. On the other hand, when you train humans to recognize a car for example, you simply have to show them a live car or an image. The next time they see any vehicle, it would be easy for them to distinguish a car among-st other vehicles.

In a similarly way, can machines learn with single training example like humans do?

Computers or machines lack a key part that distinguishes them from humans, and that is, ‘Memory’. Machines cannot remember; hence it requires millions of data to be fed in order to understand the object detection, be it from any angle. In order to reduce this supplement of training data and enabling machines to learn with less data at hand, One shot learning is brought to its assistance.

What is one shot learning and how is it different from other learning?

Deep Neural network models outperform various tasks such as image recognition, speech recognition and so on. However, such tasks are possible only due to extensive, incremental training on large data sets. In cases when there is a smaller dataset or fewer training examples, a traditional model is trained on the data that is available. During this process, it relearns new parameters and incorporates new information, and completely forgets the one previously learned. This leads to poor training or catastrophic inference. One shot learning proves to be a solution here, as it is capable of learning with one, or a minimal number of training samples, without forgetting. The reason for this is, they posses meta-learning; a capability often seen in neural network that has memory.

How One shot learning works?

One shot learning strengthens the ability of the deep learning models without the need of a huge dataset to train on. Implementation of One shot learning can be seen in a Memory Augmented Neural Network (MANN) model. A MANN has two parts, a controller and an external memory model. The controller is either a feed forward neural network or an LSTM (Long Short Term Memory) network, which interacts with the external memory module using number of read/write heads. These heads fetch or place representations to and fro the memory. LSTMs are proficient in long term storage through slow updates of weights and short term storage via the external memory module. They are trained to meta-learn; i.e. it can rapidly learn unseen functions with fewer data samples.Thus, MANNs are said to be capable of metalearning.

The MANN model is later trained on datasets that include different classes with very few samples. For instance, the Omniglot dataset, a collection of handwritten samples of different languages, with very few samples of each language. After continuously training the model with thousands of iterations by using few samples, the model was able to recognize never-seen-before image samples, taken from a disjoint sample of the Omniglot dataset. This proves that MANN models are able to outperform various object categorization tasks with minimal data samples.  

Similarly, One shot learning can also be achieved using Neural Turing Machine and Active One shot learning.

Therefore, learning with a single attempt/one shot actually involves meta-learning. This means, the model gradually learns useful representations from the raw data using certain algorithms, for instance, the gradient descent algorithm. Using these learnings as a base knowledge, the model can rapidly cohere never seen before information with a single or one-shot appearance via an external memory module.

Use cases of One shot learning

Image Recognition: Image representations are learnt using supervised metric based approach. For instance,  siamese neural network, an identical sister network, discriminates between the class-identity of an image pair. Features of this network are reused for one-shot learning without the need for retraining.

Object Recognition within images: One shot learning allows neural network models to recognize known objects and its category within an image. For this, the model learns to recognize the object with a few set of training samples. Later it compares the probability of the object to be present within the image provided. Such a model trained on one shot can recognize objects in an image despite the clutter, viewpoint, and lighting changes.  

Predicting accurate drugs: The availability of datasets for a drug discovery are either limited or expensive. The molecule found during a biological study often does not end up being a drug due to ethical reasons such as toxicity, low-solubility and so on. Hence, a less amount of data is available about the candidate molecule. Using one shot learning, an iterative LSTM combined with Graph convolutional neural network is used to optimize the candidate molecule. This is done by finding similar molecules with increased pharmaceutical activity and lesser risks to patients. A detailed explanation of how using low data, accurate drugs can be predicted is discussed in a research paper published by the American Chemical Society(ACS).

One shot learning is in its infancy and therefore use cases can be seen in familiar applications such as image and object recognition. As the technique will advance with time and the rate of adoption, other applications of one shot learning will come into picture.


One shot learning is being applied in instances of machine learning or deep learning models that have less data available for their training. A plus point in future is, that organizations will not have to collect huge amount of data for their ML models to be trained, only a few training samples would do the job! Large number of organizations are looking forward to adopt one shot learning within their deep learning models. It would be exciting to see how one shot learning will glide through being the base of every neural network implementation.



Savia Lobo

A Data science fanatic. Loves to be updated with the tech happenings around the globe. Loves singing and composing songs. Believes in putting the art in smart.

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *