I am training a CNN that detects if a there is a pot of boiling water vs if there is a pot of boiling water with pasta inside. My hypothesis is that having the same background for both a positive and negative class image will improve model accuracy because it will force it to look exclusively at the foreground for hints. Is this hypothesis reasonable?


1 Answer 1


You're not wrong, but you're also missing a couple of risky aspects that makes the idea not the best.

The part you're right are:

  • forcing a model to focus on specific regions of interest of an image will improve a model performance.

The points you should pay attention to are:

  • using the same background for every image will make your dataset biased, i.e. you won't be able to use your model in any real application cause the model will work only on images with specific backgrounds.
  • the power of deep learning relies in the fact that models learn features automatically. Many times these features capture correlations that are totally invisible to us, correlations that might involve part of the background as well. So before jumping to conclusions an inspection of feature maps and maybe feature importance using some explainable ai tool is always required.
  • feature extraction is always a good practice (if we can help a model with some prior knowledge, why not?) but it should aim at adding information rather than removing it. So I would personally try other roads. For example testing different color spaces where the color of the pasta become more visible from the water/pot ones, or use some form of attention and let the model learn where to focus.
  • $\begingroup$ Your suggestions seem valid to me. I would also differentiate between training "performance" (which is somehow a vague term and might refer to the accuracy) and generalisation, which you mention implicitly in the first point. For the last point, you may also mention data augmentation. $\endgroup$
    – nbro
    Mar 18 at 9:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .