0
$\begingroup$

I want to use InceptionV3 on one class of image (ie. to detect one type of object/one label only). For example, to detect 'penguin' or 'no penguin'. All my images have been cropped down to mostly display the object, so there is barely any background present and the object is in clear view. I have used bottlenecking; I have frozen the top layer of Inception so that I can retrain Inception to classify my object. However, this means that I have no alternative class to train with since I only want to classify one object.

The issue is that val_accuracy is always equal to 1, implying a perfect model, which my better nature says is too good to be true. Therefore, I believe the problem is that I have only provided the model with 1 class. How can I overcome this?

Finally, I have tested with InceptionV3 and an out-of-the-box model just to check that my Inception set up was not the issue. Both yielded varying training accuracy, but again, the basic model produced val_accuracy equal to 1 every time. I have also experimented with train-test splitting such as 10% to train with and 90% for validation. To my knowledge, a benefit of transfer learning is that you can use small datasets to train with. Even so, my dataset is 3300.

$\endgroup$
7
  • $\begingroup$ What was your model's "test accuracy" with the 10% train split? $\endgroup$
    – Academic
    Aug 28, 2020 at 1:11
  • $\begingroup$ @Soumya I just used train and evaluate data, no test. $\endgroup$ Aug 28, 2020 at 14:08
  • $\begingroup$ @Soumya Again, It scored 100% $\endgroup$ Aug 28, 2020 at 14:15
  • $\begingroup$ it score a 100% on the test set?? $\endgroup$
    – Academic
    Aug 29, 2020 at 0:02
  • $\begingroup$ @Soumya yep that's right $\endgroup$ Aug 29, 2020 at 0:11

1 Answer 1

1
$\begingroup$

Since you are only using one class for training, you can't expect the network to understand what the object is not.

For example, if you want to classify cats you have to pass to the network images that are not in your main class [dogs, cars, boats, random_noise, penguins]. If you try to pass any other image to your current model it will answer with great confidence that it is a cat.

Your validation accuracy will always be 100% if you have no other classes in your dataset.

For a classification problem you need at least two classes, and your train/val/test subsets should have enough images of each class so your metrics become meaningful.

$\endgroup$
5
  • $\begingroup$ There is technically 2 classes here, cat and not cat. So While your idea is great your validation isn't justified! $\endgroup$
    – Academic
    Aug 29, 2020 at 0:03
  • $\begingroup$ @Soumya so what can I use in terms of data to represent not cat $\endgroup$ Aug 29, 2020 at 0:10
  • 1
    $\begingroup$ You don't need to. (I am assuming your data contains 2 types of images. Cat + background & Only background. $\endgroup$
    – Academic
    Aug 29, 2020 at 0:12
  • $\begingroup$ @Soumya Ahh no it doesn't actually. It only contains cat $\endgroup$ Aug 29, 2020 at 0:59
  • $\begingroup$ No wonder. Should've mentioned that in the first place!! Follow the above approach and it should work! (Do upvote this if it does) :) $\endgroup$
    – Academic
    Aug 29, 2020 at 1:14

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.