What is Overfitting in Computer Vision

  • Home
  • blog
  • What is Overfitting in Computer Vision
blog image

Overfitting: Perception, Detection, and Avoidance when Modelling in Computer Vision

Overfitting is one of the developers’ most difficult challenges when working with computer vision and Machine Learning (ML).  Often, ML models are trained on small sets of data, and as a result, they perform exceptionally well on that data set but, in general, may not do as well on other datasets.

To understand how to avoid overfitting, we need to first define what we mean by overfitting. It is through examples of overfitted machine learning models that we can learn how to avoid it. And, to make the models less susceptible to overfitting, a few recommendations will be provided.



The Fundamentals of Overfitting

Characterizing overfitting in computer vision is the initial step to realizing the reason why we ought to keep away from it. Overfitting is a peculiarity in computer vision that happens when an AI calculation starts to remember the preparation information as opposed to learning the fundamental examples.

Thus, the calculation can’t sum up the preparation information to other datasets, bringing about a lackluster showing of new information. Overfitting is a typical issue in AI that can be brought about by a few unique elements. We frequently see such instances of profound learning models prepared explicitly for visual imperfection grouping in the assembling business.

Machine learning underfitting vs. overfitting

Overfitting and underfitting are two of the most well-known issues that can emerge during the modeling experience in ML. Overfitting happens when a model is excessively perplexing for the information it should display, though underfitting happens when a model is excessively basic. Assuming we check out intently at every one of these issues, Overfitting as opposed to Underfitting in ML to comprehend which is better, then, at that point, we discover that Overfitting is unrealistic, and Underfitting is excessively easy to make sense of the difference!

Defining Overfitting

Overfitting happens when a model turns out to be excessively intricate for the information it is intended to display. This can happen for different reasons, the most well-known of which is that the model is endeavoring to advance a lot from the information. At the point when this occurs, the model remembers the preparation information as opposed to learning generalizable examples. Accordingly, the model excels on the preparation dataset yet doesn’t perform well on new information.

Defining underfitting

Underfitting, as against overfitting, happens when a model isn’t adequately intricate. There might be a few causes yet one of the most well-known is that the model isn’t given adequate information to learn. Accordingly, the model can’t learn generalizable examples in the information and performs ineffectively on both the preparation and new data of interest. Accordingly, with lacking elements and information, an underfitted model seems, by all accounts, to be “too basic,” to possibly be a compelling model.

An overfit model has a low predisposition yet high change, though an underfit model has the inverse. It shows a high predisposition and a low difference. Be that as it may, the just workaround, until further notice, to restrict the predisposition in an excessively straightforward model is to add more highlights.

What are the signs to know whether a model is overfitting or underfitting?

All in all, how would you decide if your model is overfitting or underfitting? One technique is to inspect the way it performs on new information. Overfitting implies that your model performs well in preparing information but not so well on the test set with new information. Underfitting happens when a model performs inadequately on both the preparation and test datasets. One more method for telling is to analyze the model’s intricacy. Overfitting is almost certain on the off chance that your model is excessively perplexing. Underfitting is more probable on the off chance that your model isn’t adequately intricate.

What constitutes a good match in machine learning?

In ML, a solid match is characterized as a model that precisely predicts the result of new information. A low blunder rate depicts a decent ML model with high exactness. The objective of ML is to make models that sum up well, that is to say, have a low mistake rate on a test set with beforehand inconspicuous information.

Understanding the Key Statistical Concepts of Overfitting 

Below certain key statistical concepts are summarized to get a better understanding of overfitting.   


Unexplained and irregular variety inborn in the information (natural noise) or presented by factors of no interest is alluded to as Noise. These can be noise arising out of the procedure, including estimation mistakes, and variety at the site.


At the point when irregular examples, in preparing information, are over-learnt and are related to noise or remembrance, it is known as overfitting. Hence, when a model is overfitted, it essentially diminishes the capacity to thus sum up the new approval information.


At the point when profoundly muddled genuine issues are approximated with a more straightforward factual model, the mistake term is evaluated as Bias. High-inclination AI models tend to underfit.


The learning of an irregular design that is irrelevant to the basic genuine signal, is alluded to as Variance. Models with a high change are inclined to overfitting.

 Data Leakage 

The idea of “checking out information twice over” is alluded to as Data Leakage (Contamination). At the point when perceptions utilized for testing show up once more during the preparation cycle, overfitting happens. The model then, at that point “recollects” the fundamental affiliation as opposed to gaining from it.

Model Selection 

The iterative cycle that utilizes resampling in the preparation set, similar to k-overlay cross-approval, to fit various models is known as Model Selection.

Model Assessment

The evaluation of a model’s out-of-sample performance is known as Model Assessment. This should be ideally carried out on a separate test set of data that should not be used for training or model selection. It is recommended to use multiple performance measures (AUC, F1 Score, etc.).

The assessment of a model’s out-of-test execution is known as Model Assessment. This ought to be unmistakably completed on a different test set of information that should not be utilized for preparing or model determination. It is prescribed to utilize various execution measures (AUC, F1 Score, and so on.).


Resampling techniques fit a model on various subsets of the preparation information on different occasions. K-fold cross-validation and bootstrap are famous strategies that are often employed.

k-Fold Cross-Validation k-Fold Cross-Validation

This is utilized to separate the information into k similarly estimated folds/sets. Iteratively, k − 1 information is utilized for preparing and assessed on the excess concealed overlay. Each overlay is utilized for testing once.

LOOCV (leave-one-out cross-validation) LOOCV (leave-one-out cross-validation)

This is a variety of cross-validation. Every examination is left out once, and the model is prepared on the excess information and afterward assessed on the held-out examination.


Bootstrap permits assessing the vulnerability related to some random model. In the regular 1’000 to 10’000 cycles, bootstrapped tests are tediously drawn with substitutions from the first information, and the prescient model is iteratively fitted and assessed.

Hyperparameter Tuning

Hyperparameter Tuning manages hyperparameters that decide how a factual model learns and should be indicated before training. They are model explicit and could incorporate regularization boundaries disciplining the complexity of the model (ridge, lasso), number of trees and their profundity (random forest), and more. Iteratively tuning the hyperparameters improves the chance to find the model that performs best especially when the given data could be highly complex.

Causes of overfitting of a machine learning model

There are several causes of overfitting.

1.       Scarcity of training examples: if the model is trained only using a small sample it is bound to overfit.

2.       Too many features utilized: If trained on too many features, the model picks up irrelevant data and skews the results, and generalizes when other input data is added.

3.       Too much Complexity: Often due to the inherent complexity in the trained data, the ML algorithms overfit as they continue to learn irrelevant information.

However, a few common mistakes are known to drive overfitting:

1.       Absence of Data Pre-processing: Data pre-processing is essential for any ML project.  If this is not considered, the ML algorithm will obviously not give the expected results.

2.       Algorithms used inappropriately:  Since each ML algorithm solves a specific problem, an inappropriate algorithm used for a different problem will result in undesirable results.

3.       Feature engineering: If any wrong step is taken when the process of feature engineering is being done, the ML algorithm will overfit.

4.       Segmentation bias: If there is bias when selecting the sample data and it is not representative of the entire data, then the ML algorithm will not show the desired results.

Understanding how the ML process works is very crucial when training models in Computer Vision 

 Detecting overfitting in computer vision:  

1.       Pattern commonalities in the training set

2.       Assess cross-validation of the data set

3.       Investigate the coefficient of determination (R-squared).

Preventing Overfitting in Computer Vision

The More the Merrier: Using more training data sets helps the model learn to generalize patterns

Less Features the better: To facilitate the model to focus better, a few features should be part of the training data set. Too many features will then lead to irrelevant information.

Simple is always the Best: A complex data set on which the model is trained will lead to overfitting given the irrelevant details that will detract from the relevant details

Standardizing ML algorithms: Using the most common Lasso and Ridge method, can help the model achieve a better prediction performance. These methods lessen the complexity of an overfitted model thereby forcing it to learn just what is relevant for the outcome.

Training Data Augmentation: Augmenting the data set artificially, especially when dealing with minimal data, helps the model learn and improve accuracy and predictions.

Ensembling: Ensembling reduces overfitting. During the ML process, it is encouraged to use more than one model to make a prediction. When ensembling is employed, the predictions become more robust.

When deep learning models are employed to solve complex Object detection tasks like image recognition systems, overfitting can become an issue and skew the results.

Overfitting can cause the AI model to turn out to be extremely off base and yield output data with false positive or false negative detections.


Overfitting is a common issue in ML and can often cause a model to be ineffectual. Forestalling overfitting by expanding the number of tests, keeping the data set simple rather than using complex training sets, and using well-designed models can help make robust predictions. 

Leave a Reply

Your email address will not be published. Required fields are marked *