You could also do first training with 2 classes of interest (say, cats and dogs), and once you have your classifier ready, take a validation set of cats and dogs, and add to it images of other things. Then you will have to tune 2 thresholds t0<0.5< t1. If cat=0 and dog=1, then you output cat if the estimated probability is < t0, output dog if the estimated probability is >t2, and you output “other” otherwise. The hyper-parameters t1, t2 can be tuned to optimize a meaningful metric on the validation set. I