Multi-label classification for images that contain a mixture of two classes
11:38 05 Mar 2026

I am working on an image classification problem where some classes can appear individually, but they can also appear together in the same image.

For example, imagine a simplified dataset with three categories:

Class A (e.g. olive pizza)

Class B (e.g. mushroom pizza)

Class C (images that contain both A and B)

However, conceptually C is not really a separate class, it is simply an image that contains both A and B.

My real problem is similar:

some images contain structure A, some contain structure B, and some contain both structures at the same time.

So the desired behavior is:

Image with only A → output: A

Image with only B → output: B

Image with both A and B → output: A + B

In other words, the model should be able to say:

this image contains both A and B

instead of forcing it into a single class.

How to handle images that contain multiple classes (A, B, or both) in image classification?

machine-learning deep-learning computer-vision image-classification