All jobs / Data science / ML / AI

Computer Vision interview questions

Computer Vision questions a Data science / ML / AI can be asked, from first job to senior. Open one to see the strongest answer and why it works.

  1. A trained image classifier does well in the notebook and badly in the app. Both load the same weights. What preprocessing do you compare first?

    The strongest answer: Every step between file and tensor: resize method and size, channel order (RGB vs BGR), pixel range 0–255 vs 0–1, and the mean/std normalisation — the app must apply exactly what training did

    Why it works: Right — a model sees numbers, not pictures; a swapped channel order or a missing normalisation is invisible to the eye and fatal to the model.

    • Model sees numbers, not pictures.
    • Match resize, size and channel order.
    • Match pixel range and normalisation.
    • One preprocessing function, shared.
  2. Image classification, object detection and segmentation — what does each one output, and how does that change the labels you need?

    The strongest answer: Classification gives one label per image; detection gives boxes with a class and score for each object; segmentation labels every pixel — so labelling cost rises from a tag, to boxes, to full masks

    Why it works: Exactly — the output shape defines the annotation, and the annotation is most of the project’s cost.

    • Classification: one label per image.
    • Detection: boxes plus class and score.
    • Segmentation: a label per pixel.
    • Output shape sets the labelling cost.
  3. You add random flips and rotations to make your image model robust. When is that augmentation wrong, and where do you apply it?

    The strongest answer: When the transform changes the label — a rotated 6 is a 9, mirrored text or a left/right lung matter — so choose augmentations the real world produces; apply them to training data only, never to validation or test

    Why it works: Right — augmentation encodes an assumption of invariance; if the label is not invariant, you are teaching the wrong thing.

    • Augment only label-preserving transforms.
    • Ask what the camera really produces.
    • Training set only.
    • Validate on real, unaugmented images.
  4. You have 3,000 labelled images of defective parts. How do you build the classifier, and when do you unfreeze the backbone?

    The strongest answer: Start from a pretrained backbone, train a new head with the backbone frozen, then unfreeze the top layers with a small learning rate if validation says it helps — from-scratch training on 3,000 images just overfits

    Why it works: Exactly — pretrained features transfer even across domains; the freeze-then-unfreeze order protects them from being wrecked early.

    • Pretrained backbone, new head.
    • Freeze first, train the head.
    • Unfreeze top layers, small learning rate.
    • From scratch overfits small data.
  5. How do you decide whether a detector’s predicted box counts as correct, and why does a detector output several boxes for one object?

    The strongest answer: A box counts when its IoU with a same-class ground-truth box passes a threshold (0.5 is common), matched once per object; detectors propose many overlapping boxes, so non-maximum suppression keeps the top-scoring one and drops the overlaps

    Why it works: Right — IoU sets the geometry bar, one-to-one matching stops double counting, and NMS is why you see one box per object.

    • IoU threshold decides a match.
    • One match per ground-truth box.
    • NMS removes overlapping duplicates.
    • mAP summarises across thresholds and classes.
  6. Your chest X-ray classifier posts a strong AUC on the internal test set. A radiologist notices that nearly all positive cases came from one hospital’s portable scanner, which stamps a marker in the corner.

    You are asked to sign off the deployment. What do you do?

    The strongest answer: Refuse until it is tested with the shortcut removed: split by hospital and scanner, occlude or crop the marker, inspect saliency, and collect positives from other sites — a model that learned the scanner is not a diagnostic model

    Why it works: Exactly — shortcut learning is the classic vision failure; the fix is evaluation and data design, not a caveat.

    • A strong AUC can be a shortcut.
    • Split by site and scanner.
    • Occlude the artefact; inspect saliency.
    • Refuse until it is re-proven.