Same problem here. I have custom trained model, but the issue is, if I present an image of trees for example, it has confidence 1.0 for cats...Is there a way to implement two coreML models and run the classification in sequence? Something like:
let genericModel = Inceptionv3.mlmodel
let specificModel = CatsNDogs.mlmodel (custom)
stage 1 - use genericModel to determine if picture has cat or dog in it
stage 2 - if answer is NO - present message "Nothing recognised"
- if YES - use specificModel to determine the cats or dog species (for example)
- present message - "I see Golden Retriever"
Is there a such way to accomplish the result using primary and secondary models?
@HelloWorldYyx @alessign Please take a look at the related issue #575.
When you train a classifier with two classes, the classifier has to place its probability so that it sums to 100%. If you show it a tree, even if you would like it to say 0% cat and 0% dog, this is simply not possible the way the problem is formulated. A result of 50% cat and 50% dog would be better, but this is not how the models typically behave unfortunately.
As I wrote in the other issue, it is possible to train such a classifier by introducing a third "other" class. This should make it much more robust to samples outside your named classes, and allow for predictions such as "0% cat, 0% dog, (100% other)".
I hope my previous answer resolved this question, so I'm closing this issue now. Let me know if anything is still unclear!
Most helpful comment
@HelloWorldYyx @alessign Please take a look at the related issue #575.
When you train a classifier with two classes, the classifier has to place its probability so that it sums to 100%. If you show it a tree, even if you would like it to say 0% cat and 0% dog, this is simply not possible the way the problem is formulated. A result of 50% cat and 50% dog would be better, but this is not how the models typically behave unfortunately.
As I wrote in the other issue, it is possible to train such a classifier by introducing a third "other" class. This should make it much more robust to samples outside your named classes, and allow for predictions such as "0% cat, 0% dog, (100% other)".