使用keras进行图像多分类

时间:2018-09-22 18:39:39

标签: python neural-network keras multilabel-classification

所以如果我有两个标签“ dogs”和“ cats”,我想创建多分类神经网络。

现在,如果我提供了不是狗或猫的新随机图像,有没有办法让我教分类器告诉我该图像不是狗或猫,而不是说它可能占百分之几猫还是狗?

1 个答案:

答案 0 :(得分:1)

The best way to accomplish this is to create a new class in addition to dog and cat to handle images you have no interest in. So now, your labels would be ["dogs", "cats", "other"].

In your current architecture, your model is forced to predict a random image as either a dog or cat as those are the only two options it has. Adding a new class to deal with other images is generally the easiest way to make your classifier more robust to incorrect predictions.