Domain shift in computer vision: bias and representativeness
How to tell whether an image dataset covers the conditions and people a model will face, where a mismatch between training and deployment images comes from, and how a slice-by-slice breakdown finds the weak spots a single average score hides.
Domain shift is a mismatch between the images a model was trained on and the images it gets once it is in use. The camera, the place or the people in front of the camera can all differ. It lowers the model's accuracy even when the labels and the model stay the same, and the usual test score does not show it, because the test set came from the same data as the training set.
Representativeness
Representativeness is whether a dataset covers the people, places and devices the model will face, in roughly the right proportions. A dataset can be large and still have far too few images of the conditions the model sees most in use.
What tends to be thin is variation in lighting, clothing and viewpoint. Night scenes, unusual poses and crowds are often thin too, and rare high-stakes cases can be missing entirely.
For example, the chart below compares a dataset's share of images in each condition with the share the model will face once deployed. Daytime images are 40 percent of the dataset and only 15 percent of what the model will see. Night scenes are the other way round, 5 percent of the dataset and 25 percent of deployment.

Where domain shift comes from
A model learns from the images it was given. When deployment images differ from those in a systematic way, the model meets inputs unlike the ones it learned from. Common sources of the mismatch:
- Camera: a different camera model, lens or position, such as a phone photo instead of a mounted camera.
- Sensor: the chip that records light, which affects the noise and color of the images.
- Environment: different lighting, weather, background or season.
- Population: different people, objects or products in front of the camera.
- Workflow: a different way of taking the photos, such as another distance or framing.
The plot below draws this as two distributions. The training images cover one region of possible images, and the deployment images cover a region that only partly overlaps it.

Uneven data becomes uneven errors
A model tends to make more mistakes on the kinds of images it saw least. Uneven data leads to shortcuts, where the model relies on something that happens to go with the label in the training images. It also leads to false-alarm rates that differ by condition, and to weak results on rare classes.
When people, homes or communities are represented unevenly, error rates differ across groups of people too. In the chart below, groups A to D have error rates under 10 percent. Groups E and F, the groups the training data had the fewest images of, have error rates around 40 percent. The average error is about 15 percent, because most test images come from groups A to D. A system can work well on average and fail for the groups it saw least.

Break results down by slice
A slice is a subset of the test set that shares one condition, such as low light or small faces. Reporting the score for each slice next to the overall average shows where the model is weak.
For example, here is one face-detection model on one test set. Recall is the share of real faces the model finds.
| Slice | Images | Recall |
|---|---|---|
| overall | 10000 | 0.88 |
| bright, frontal | 6000 | 0.98 |
| low light | 1500 | 0.79 |
| heavy occlusion | 1200 | 0.72 |
| small faces (< 40 px) | 1300 | 0.68 |
The overall recall is the average of the slices, weighted by how many images each slice has:
$$\frac{6000 \cdot 0.98 + 1500 \cdot 0.79}{10000}$$
$$+ \frac{1200 \cdot 0.72 + 1300 \cdot 0.68}{10000} = 0.88$$
The 6,000 bright, front-facing images at 0.98 make up most of that 0.88. The three harder slices sit 9 to 20 points below the average, and the average alone hides all three.

Break results down by camera, location and condition, and by class and by group of people. A slice far below the average is a sign of domain shift or thin coverage, and it tells you which images to collect more of.
Common mistakes
- Reporting one average score. A 0.88 average hid a 0.68 on small faces.
- Testing only on data from the same source as training. The test set then shares the training set's gaps, so the score cannot show the shift.
- Counting images without checking what they show. A large dataset can still have 5 percent night scenes when deployment has 25 percent.
- Leaving out group-level results. A system that works on average can still fail the groups it saw least.
Related concepts
Synthetic images can fill a thin slice when real photos of it are rare or dangerous to collect, and they bring their own mismatch with real photos. Synthetic data for computer vision shows how to measure it. A dataset's known biases and limits also belong in its documentation, which how to version and document an image dataset covers.
QuiddityML teaches bias, representativeness and domain shift in the vision data unit of its Computer Vision track, with multiple-choice questions on what a single average score hides (QuiddityML).