First measure it per class, because averaged metrics conceal rare class failures. The most effective fix is usually more targeted data for the rare classes, found by mining unlabelled footage with the current model. Then rebalance training with repeat factor sampling or loss weighting, use focal style losses in dense detectors, and copy and paste augmentation for rare instances. Set per class thresholds and test on enough rare examples to trust the result.
Why interviewers ask this
Real datasets are long tailed, and the rare classes are often the ones the product cares about most. Interviewers want to see per class measurement, a preference for targeted data collection, and knowledge of the training levers with their trade offs, such as oversampling causing memorisation. They also listen for evaluation awareness, since a test set with five examples of a class cannot tell you whether anything worked.
How to structure your answer
- Measure per class performance first.
- Mine and label more rare examples.
- Rebalance with sampling, loss weighting and augmentation.
- Use per class thresholds and a test set big enough to trust.
Example answer
I start with per class metrics, because an overall score can look healthy while a rare class is barely detected. If the rare class matters, the best fix is nearly always more of it, so I use the current model to mine unlabelled footage for likely examples, including low confidence ones, and send those for labelling. That is far more efficient than labelling random frames. On the training side, I use repeat factor sampling, which shows images containing rare classes more often, or weight the loss by class frequency. Both help, but oversampling a handful of examples leads to memorisation, so I pair it with augmentation, especially copying rare instances onto varied backgrounds. For dense detectors, a focal style loss handles the background imbalance. Then I set thresholds per class, because the rare class usually needs a lower one. On a road survey project, one type of surface crack was rare, and mining plus resampling took recall on that class from forty per cent to about seventy five. I also made sure the test set held enough examples to show the change was real.
Walking into this interview soon? GhostPilot listens to your live call, spots the question the moment it is asked, and puts a structured answer on your screen in real time. Try it on your next mock, or grab a $29 Session Pass, no subscription, for the real thing.
See how it worksFollow-up questions to expect
- When does oversampling start to hurt?
- How would you handle a class with only twenty examples?
- How do you decide whether a rare class should be merged with another?
Related computer vision engineer questions
Your interviewer will ask their own version of this. Paste your actual job description into the free Question Predictor and get the 20 questions that role is most likely to ask, with what each one is really probing.
Predict my questions