0
$\begingroup$

I've been messing around with an Open Set, Binary Classifier and am having trouble with it. I'm sure there are a lot of reasons for that trouble.

One thing I am struggling with is, what does the model predict if it has never seen the image before? An example would be if I'm trying to detect sheep across all background scenes. If I train a binary classification set with one class having lots of sheep in it and the other class having lots of various backgrounds, what would the model predict if it came across a background it had never seen before with no sheep in it? [mine is telling me "sheep" and I don't know why]

Thanks, Mecho

$\endgroup$
1
$\begingroup$

I am assuming the images you gave the model all contain sheep. This is what i understand from your question.

Any model that you build will be based on the data that you give (training data) and your code. In your case, if you only give images that contains sheeps, and then you test it with no sheep and a background the model hasn't seen, it will search through all of its node, derived from your training data, to see which one is closest to the image you gave. Based on the information given, the only 'route' your cnn model can take is the one with sheeps on it, because you only gave images of sheeps for it to learn.

Here are a few suggestions that i can give you:

  • Give your model images with no sheep and different backgrounds so it can handle cases where there are no sheeps
  • Or you can add a piece of code to your model that tells it to default to some value if certain conditions aren't met (If the model doesn't 'see enough' sheep and background, it defaults to 'unknown image' or whatever you choose)

You are on the right path though! Since you are playing around with a binary classifier, you should definitely feed images with and without sheeps so that it can identify the two cases. Remember, a binary classifier is optimal when you give it 2 things to look out for, such as identifying images with and without sheep.

Here are some reading materials that you can brush up on to get a better basic understanding of how CNN works, personally i found the video helpful on the second link:

Also, i find google images helps me alot in terms of visualizing binary classifier as a concept.

| improve this answer | |
$\endgroup$
  • $\begingroup$ Hi Firdaus, thank you for the information. I am currently using 2 classes in my binary (one of only "sheep" and one of "only backgrounds". Are you saying that I should have two classes, one of "sheep + backgrounds" and one of "backgrounds only"? Also, I think my original question is more of "if I feed an image to my classifier that it has never seen before (like I've never shown it an "ocean" background but now I do) what would it say, sheep or background?" $\endgroup$ – Mecho Engineer Apr 22 at 15:36
  • $\begingroup$ Your model should say 'background' because of the lack of sheep. The goal of using a binary classifier is only to identify two, and only two, distinct things. So your classes are really 'sheep' and 'no sheep', not 'sheep' and 'background'. An example would be a binary classifier to tell images of male and female, the classes would be 'male' and 'female'. Another example would be a binary classifier to tell images of empty plates and plates with food, the classes would be 'empty' and 'not empty'. See what I mean by two distinct things? Hope this helps! $\endgroup$ – Firdaus Indradhirmaya Apr 22 at 18:10
  • $\begingroup$ I'm still having a bit of trouble. Would it be better to have a set of images of only sheep (like on a black background) and then have a set of images of only backgrounds to be my two classes? Or would it be better to have sheep on background and then no sheep on background? I ask because I'm trying the later option right now and not having good luck with it. $\endgroup$ – Mecho Engineer Apr 24 at 5:33
  • $\begingroup$ For simplicity sake you should try to to have a sheep on background and no sheep on background. But ultimately, you would want to have your CNN detect objects, in this case sheep. Because your ideal model would be to give any image and detect if there are sheep or not. The article i gave might help you a bit on CNN object detection towardsdatascience.com/… $\endgroup$ – Firdaus Indradhirmaya Apr 24 at 12:35

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.