3
$\begingroup$

I want to train a model to recognize the different categories of food e.g. rice, burger, apple, pizza, orange and other things.

After the first training, I realized that the model is detecting other objects as food. e.g. hand as fish, phone as Chocolate, person as candies.

I get a very low loss because the testing dataset and validation must have at least a pictures of food. But when it comes to a picture of an object other than food, the model fails. How do label the dataset in a way that the model will not do any detection if there is no food on the picture?

$\endgroup$
3
  • $\begingroup$ can you show us the architecture you are using, AFAIK, you should just mark all non-food category as some number and your model should be able to classify it. May be its a problem with the architecture? $\endgroup$
    – rawwar
    Commented Jul 30, 2018 at 12:21
  • $\begingroup$ @InAFlash so you are advising to give a single label to anything that is non-food? let's say: "other" ? $\endgroup$
    – TSR
    Commented Jul 30, 2018 at 12:29
  • $\begingroup$ Yes, @TSR. just as any other label. $\endgroup$
    – rawwar
    Commented Jul 30, 2018 at 12:30

1 Answer 1

2
$\begingroup$

This highly depends on your test data. Suppose you have trained your data which all contains some kind of food. If you give it a hand at test time, it will try to find the most similarity it has with the current labels and outputs the one which is more similar than the others. The point is that your test environment is really important. If you are going to test your app near the sea, your training data set should contain data on that condition. If you are going to use it during the night, your dataset should be taken during the night. In your case, you have a simple task, for the current dataset add an entry with a zero which means you are trying to add a new class. After that, try to add new pictures that are not images of food and add one in the new entry for these images. But consider this important point. The number of images in each class should have the same distribution as the test data.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.