Computer Vision practice questions with answers
Practise computer vision questions at your own pace: CNNs, convolution maths, OpenCV, detection, segmentation and transfer learning. Pick an answer to see whether you are right and why. Nothing is timed or ranked here; for that, play the Daily Quiz at 4 PM IST.
What does a grayscale image have per pixel?
easy
- Three values
- One intensity value
- Four values
- No values
Answer: B. One intensity value
Explanation: Usually 0 (black) to 255 (white) for 8-bit images. Colour images have three channels.
Which task assigns one label to a whole image?
easy
- Object detection
- Image classification
- Segmentation
- Pose estimation
Answer: B. Image classification
Explanation: "Cat" for the whole image is classification; boxes around each cat is detection.
Which OpenCV function converts a BGR image to grayscale?
easy
- cv2.imread
- cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
- cv2.resize
- cv2.threshold
Answer: B. cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
Explanation: cvtColor converts between colour spaces, e.g. BGR to RGB, HSV or grayscale.
What is OCR?
easy
- Object counting and recognition
- Optical character recognition: reading text from images
- Image compression
- Colour correction
Answer: B. Optical character recognition: reading text from images
Explanation: It turns scanned documents, photos of signs or number plates into machine-readable text.
What does the Canny algorithm detect?
medium
- Faces
- Edges
- Colours
- Text
Answer: B. Edges
Explanation: It smooths the image, finds intensity gradients, thins edges and links them using two thresholds.
What does "same" padding do in a convolution with stride 1?
medium
- Doubles the output size
- Pads the input so the output has the same height and width as the input
- Removes the border
- Pads with ones
Answer: B. Pads the input so the output has the same height and width as the input
Explanation: For a 3 × 3 kernel that means one pixel of padding on each side. "Valid" padding uses none and shrinks the output.
Why normalise pixel values (e.g. to 0–1 or by mean and standard deviation) before training a CNN?
medium
- To save disk space
- It keeps inputs on a stable scale, which makes training faster and more stable
- It removes colour
- It is needed to display images
Answer: B. It keeps inputs on a stable scale, which makes training faster and more stable
Explanation: When fine-tuning a pretrained model, use the same normalisation it was trained with.
What does a U-Net architecture do well?
medium
- Text generation
- Image segmentation: an encoder–decoder with skip connections that keep fine spatial detail
- Sorting images
- Audio classification
Answer: B. Image segmentation: an encoder–decoder with skip connections that keep fine spatial detail
Explanation: It was designed for biomedical images and is also the denoising backbone of many diffusion models.
What are anchor boxes in object detection?
hard
- Boxes drawn by annotators
- Predefined box shapes and sizes at each location that the detector adjusts and scores
- The final output boxes
- Boxes for text
Answer: B. Predefined box shapes and sizes at each location that the detector adjusts and scores
Explanation: Some newer detectors are anchor-free and predict box centres and sizes directly.
What is the receptive field of a neuron in a CNN?
hard
- The number of its weights
- The region of the input image that can influence that neuron's value
- Its activation function
- The batch size
Answer: B. The region of the input image that can influence that neuron's value
Explanation: It grows with depth, pooling and stride, letting deep layers respond to large structures.
Why does batch normalisation help train deep CNNs?
hard
- It adds more layers
- It normalises layer inputs over each mini-batch, stabilising and speeding up training and allowing higher learning rates
- It removes the need for labels
- It reduces image size
Answer: B. It normalises layer inputs over each mini-batch, stabilising and speeding up training and allowing higher learning rates
Explanation: At inference it uses running averages collected during training. Small batches can make its statistics noisy.
Which help a vision model trained on a small dataset? (Select all that apply)
hard
- Transfer learning from a pretrained backbone
- Data augmentation
- Training a very large model from scratch
- Freezing early layers at first
Answer: A. Transfer learning from a pretrained backbone; B. Data augmentation; D. Freezing early layers at first
Explanation: Pretrained features and augmentation make up for limited data. A large model from scratch would overfit.
From past Daily Quizzes
Predicted box A and ground-truth box B each have area 100 and overlap by 50. What is their IoU?
Computer Vision · medium
- 0.25
- 0.33
- 0.5
- 0.67
Answer: B. 0.33
Explanation: IoU = intersection / union = 50 / (100 + 100 − 50) = 50 / 150 ≈ 0.33.
How many values describe one pixel of a standard RGB image?
Computer Vision · easy
- 1
- 3
- 4
- 8
Answer: B. 3
Explanation: Red, green and blue, usually each 0–255 (8 bits). RGBA adds a fourth alpha channel for transparency.
Why is data augmentation (flips, crops, colour jitter) used when training vision models?
Computer Vision · easy
- To shrink the dataset
- To create realistic variations so the model generalises better
- To speed up inference
- To label images automatically
Answer: B. To create realistic variations so the model generalises better
Explanation: It teaches invariance (a cat flipped left-to-right is still a cat) and reduces overfitting. Choose augmentations that keep the label valid.
How does a Vision Transformer (ViT) feed an image to a Transformer?
Computer Vision · hard
- Pixel by pixel as tokens
- It splits the image into fixed-size patches (e.g. 16 × 16), linearly embeds each one and adds position embeddings
- It runs a CNN and discards the result
- It converts the image into a caption first
Answer: B. It splits the image into fixed-size patches (e.g. 16 × 16), linearly embeds each one and adds position embeddings
Explanation: A 224 × 224 image gives (224/16)² = 196 patch tokens plus a [CLS] token. Without convolution’s built-in locality, ViTs need lots of data or pretraining.
How does CLIP learn to connect images and text?
Computer Vision · hard
- By generating captions word by word
- With a contrastive objective: matching image–caption pairs get similar embeddings and mismatched pairs in the batch get dissimilar ones
- By training on ImageNet labels only
- With a diffusion loss
Answer: B. With a contrastive objective: matching image–caption pairs get similar embeddings and mismatched pairs in the batch get dissimilar ones
Explanation: Separate image and text encoders are trained on hundreds of millions of pairs. The shared embedding space enables zero-shot classification: compare an image with prompts like “a photo of a dog”.
A 32 × 32 input passes through a 5 × 5 convolution with stride 1 and no padding. What is the output size?
Computer Vision · medium
- 32 × 32
- 28 × 28
- 27 × 27
- 30 × 30
Answer: B. 28 × 28
Explanation: Output = (N − K + 2P) / S + 1 = (32 − 5 + 0) / 1 + 1 = 28.
What is the difference between semantic and instance segmentation?
Computer Vision · medium
- There is none
- Semantic labels each pixel’s class; instance also separates individual objects of the same class
- Instance only works on video
- Semantic segmentation draws boxes
Answer: B. Semantic labels each pixel’s class; instance also separates individual objects of the same class
Explanation: Semantic: all people pixels are “person”. Instance (e.g. Mask R-CNN): person 1, person 2 and person 3 get separate masks.
Why does transfer learning from an ImageNet-pretrained CNN work well on a small custom dataset?
Computer Vision · medium
- ImageNet contains every class
- Early and middle layers learn general features (edges, textures, shapes) that carry over, so only the top layers need much new data
- It removes the need for labels
- It makes the model smaller
Answer: B. Early and middle layers learn general features (edges, textures, shapes) that carry over, so only the top layers need much new data
Explanation: Freeze or slowly fine-tune the backbone and train a new head. You need far fewer labelled images than training from scratch.