# When to use Multi-class CNN vs. one-class CNN

I'm building an object detection model with convolutional neural networks (CNN) and I started to wonder when should one use either multi-class CNN or a single-class CNN. That is, if I'm making e.g. a human detector from image data and a cat detector also from image data, then when should I have a specific model for each task, and when should I just combine all the data into one and use just one general multi-class CNN?

I've understood from the No-Free-Lunch-Theorem and generally from estimation theory, that there there does not, in theory, exist a model which is simultaneously optimal for every problem. In other words, case specific models should, in general, beat the "all-purpose"-models in the same task.

I have a difference in opinion with a colleague of mine whether to use one-class of a multi-class CNN and I would like to hear the communities opinion on this.

I am not really a fan of the One vs All approach.

From my experience it is never convenient to transform a multi-class classification problem with, say, $$N$$ possible classes to a bunch of binary classification problems.

## Reason #1

The number of binary classifiers you need to train scales linearly with the number of classes. Hence, you can easily find yourselves training lots of binary classifiers. What if each one of them has a huge number of neurons? As you can understand, the computational burden here is quite a problem.

## Reason #2

With a small $$N$$, the computation is less of a problem, but still.. why would you do that? By doing things like this, you can easily end up in awkward situations such as two or more of your binary classifiers give a positive outcome, or none activates. How do you handle these issues?

However, there exists a very specific setup where you might want to use a set of binary classifiers, and this is when you're facing a Continual Learning(CL) problem. In a Continual Learning setting you don't have access to all the classes at training time, therefore, sometimes you might want to act at a architectural level to control catastrophic forgetting, by adding new classifiers to train. However, even in CL there exist other methods that work better.

To conclude, I wouldn't recommend anyone go for this option. You can train a multi-class classifier much more easily and avoid all the aforementioned issues.

• Hi @danin thank you for your reply. If I've understood correctly from your answer, this seems to be a bit of an engineering and computational complexity issue? Not really about the theoretical perfomance? Sep 30 at 15:23
• We would be interested in selecting the approach which has the best performance. I would suspect, a general multi-class classifier cannot reach the same performance as a specialized one-class model, even though computationally more easier approach, unless we have a huge amount of data. Still, I would suspect case specific models should, in theory always beat the general purpose models. Or am I mistaken? Anyway, I'm in no big favor of either approaches, it depends on the problem we are solving. Sep 30 at 15:32
• It is always difficult to speak about theoretical performance for machine learning models. The reason is that there's no well established theory on the choice of the model architecture. Thus, we can't really know whether one model would perform better than the other. Still, I would expect multi-class models to generalise better to unknown samples. From my experience with one-class models (not very experienced to be honest), I've always seen that they tend to overfit more than general-purpose models. I'd recommend you try training both models and see which one gives the best test result :-) Sep 30 at 19:13
• Okay, thank you for your comment! :) Good point, yeah it's not that trivial always. Have to give this some more thought. Sep 30 at 19:57