Davide Biraghi
Davide Biraghi

Reputation: 636

Obtain negative results from a machine learning algorithm

I have a set of images of a particular object. I want to find if some of these has anomalies with a machine learning algorithm. For example if I have many photos of glasses I want to find if one of these is broken or has something anomalous. Something like this:

GOOD!! enter image description here

BAD!! enter image description here

(Obviously I will use the same kind of glasses...)

The problem is that I don't know every negative situation, so, for training, I have only positive images.

In other words I want an algorithm that recognize if an image has something different from the dataset. Do you have any suggestion?

In particular is there a way to use convolutional neural network?

Upvotes: 4

Views: 231

Answers (3)

Humberto
Humberto

Reputation: 33

Another option that might work is to use an autoencoder. Autoencoders are unsupervised neural networks with bottleneck architecture that try to reconstruct its own input. We could train a deep convolutional autoencoder with examples of good glasses so that it gets specialized in reconstructing those type of images. You don't need to train autoencoder with bad glasses.

Therefore I would expect the trained autoencoder to produce low error rate for good glasses and high error rate for bad glasses. Error rate could be measured with MSE based on the difference between the reconstructed and original values (pixels).

From the trained autoencoder you can plot the MSEs for good vs bad glasses to help you define the right threshold. Or you can also try statistic thresholds such as: avg + 2*std, median + 2*MAD, etc.

  • Autoencoder details:

http://ufldl.stanford.edu/tutorial/unsupervised/Autoencoders/

  • Deep autoencoder for images:

https://cds.cern.ch/record/2209085/files/Outlier%20detection%20using%20autoencoders.%20Olga%20Lyudchick%20(NMS).pdf

Upvotes: 0

Raff.Edward
Raff.Edward

Reputation: 6534

What you are looking for is usually called anomaly, outlier, or novelty detection. You have lots of examples of what your data should look like, and you want to know when something doesn't look like your data.

A good approach for this problem, since you are using images, you can get a feature vectorized version using a pre-trained CNN on image net. Then you can use an anomaly detector on that feature set. The isolation forest should be an easier one to get working.

Upvotes: 5

Jeru Luke
Jeru Luke

Reputation: 21223

This is a typical Classification problem. I do not understand why you need CNN for this ......

  1. My suggestion would be to build/train a classification model comprising of only GOOD images of glass. Here you would possibly have all kinds of glasses that are intact with a regular shape.
  2. If the model encounters anything other than GOOD images, it will classify those as BAD images. This so called BAD images may include cracked/broken glasses having an irregular shape.

Upvotes: 2

Related Questions