Does simple Convolutional Neural Network learn features with only one class?

5 views (last 30 days)
I have read about one-class classification problems using SVM as discriminator to detect anomalous data. But, couldn't find much with CNN deep networks. I am working on a classification problem where I want to extract features from CNN network. I am providing image dataset from one class only and after training the model for 50 epochs, I am extracting the features for further classification using another model.
I am getting very fine results. However, I am confused how my CNN model is learning features when I am providing data from one class only. Is it even learning or not. I tried to analyze activations after each convolution layer (4 in my model) for 1, 50 and 100 epochs. I can see subtle changes, however I need a solid explanation as to what actually is happening after each epoch cycle.
for epoch 1 and conv layer 1,2 ,3 and 4 , strongest activations in each layer is as shown below:
after 50 epochs and conv layer 1,2 ,3 and 4, strongest activations in each layer is as shown below:

Accepted Answer

Zenin Easa Panthakkalakath
Yes, simple convolution neural networks do learn features with only one class. When there exist only one class, the problem is effectively a binary classification, i.e. whether the class is present or not.
However, it is a fact that larger the number of classes, the network would try to learn more complex features.
In cases where the features required to make a classification is simple, the network may learn it pretty quickly. If the training data isn't diverse enough, then the network may assume find a feature which may not be the right one, but works for the given training data and make a classification based on that.
  3 Comments
Zenin Easa Panthakkalakath
The loss is calculated based on which function you are using in the network. If you're using mean squared error and the y_net represents the network output, y_train represents the training data output value, then
Error = 0.5 * (y_net - y_train)^2
Note that the output layer has a value of either 0 or 1. Use an indicator function for the activation of the final layer.
From what you have tried to explain eariler, I got a hint that you are trying to train a CNN based network and you would like to output it as a feature vector. In that case, train it using a binary output layer, then either export the weights to a new network or modify the existing network by changing the final activation layer to either linear, sigmoid or any other function that you prefer.
Something similar has been done using AlexNet in one of our articles linked below. Only difference is that AlexNet is already trained and we already have the values, whereas here you will have to train your own network.
Please also take a look into the research paper on AlexNet, which is mentioned as a reference in the article above.
Suvidha Tripathi
Suvidha Tripathi on 24 Sep 2018
Yes, that's what I finally understood after reading that what I was doing was the wrong approach. Since, a network trained from scratch with only one class won't learn. You are right about pre-trained networks for feature extraction and I have reverted to this only.
Thanks again for your answer.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!