Some of my recent clients are interested in image classification using limited learning data. A major use case is in detecting defective products on the manufacturing line. Defective products are normally caught by human operators watching the production line. It requires constant concentration and effort so if this can be automated it will bring a lot of productivity boost to manufacturers.
One method to overcome this issue is by creating a network to compare input images with the training dataset. For defective products, the images will look different from the passing products.
Experiments
For this experiment, I used a Siamese Network to generate embeddings for images of Pokemon. The Pokemon has 4 classes, Pikachu, Squirtle, Bulbasaur and Charmander. The images are scraped from the internet using the Bing API.
The images in the training dataset is trained to find the set of weights that will clearly separate the 4 classes. If a new image which is not included in the 4 classes is used, the resulting distance (difference) will be large enough to separate it with the 4 available classes.
The Siamese network trains triplets of Anchor, Positive and Negative images, and I generated some hard batches to improve the training accuracy. For details look into the original article in Credits section.
Results
The best result I got was AUC 84%.
And the image tests with this set of weights are as follows
Discussions
As we can see in the second row, the input image of Bulbasaur is wrongly classified as Squirtle. This error can happen when the input image of Bulbasaur has the same color tone as Squirtle. Therefore, we can conclude that although One-Shot learning can be useful for classification with minimal data because it only measures the distance between images, it can also produce errors when the images are similar to each other. For all use cases, it will depend on the data available, and if the images have enough distance (sufficiently different).
Credit
This experiment was created by modifying the original pipeline found here:
https://medium.com/@crimy/one-shot-learning-siamese-networks-and-triplet-loss-with-keras-2885ed022352
Comments
Post a Comment