Bird
Raised Fist0
Computer Visionml~20 mins

DNN-based face detection in Computer Vision - Practice Problems & Coding Challenges

Choose your learning style10 modes available
Challenge - 5 Problems
🎖️
Face Detection Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Understanding the role of anchor boxes in DNN face detection

In deep neural network (DNN) based face detection, what is the primary purpose of anchor boxes?

ATo generate synthetic face images for training the model
BTo reduce the number of layers in the neural network for faster computation
CTo provide predefined bounding boxes at different scales and aspect ratios to help detect faces of various sizes
DTo normalize the input images before feeding them into the network
Attempts:
2 left
💡 Hint

Think about how the model predicts where faces might be in an image.

❓ Predict Output
intermediate
2:00remaining
Output shape of the final layer in a face detection DNN

Consider a DNN face detector that outputs a tensor of shape (batch_size, 8732, 7). What does the number 7 represent in this output?

AIt represents 7 different classes of objects detected including faces
BIt represents 4 coordinates for bounding box, 2 for class scores, and 1 for confidence score
CIt represents 7 different face landmarks detected per box
DIt represents 4 coordinates for bounding box, 2 for class probabilities (face or background), and 1 for an objectness score
Attempts:
2 left
💡 Hint

Recall that face detection usually involves bounding box coordinates and classification between face and background.

❓ Hyperparameter
advanced
2:00remaining
Choosing the right confidence threshold in face detection

In a DNN-based face detector, what is the effect of setting a very high confidence threshold for detected faces?

AIt reduces false positives but may increase false negatives by missing some faces
BIt increases both false positives and false negatives
CIt increases true positives but also increases false positives
DIt has no effect on detection results
Attempts:
2 left
💡 Hint

Think about what happens if the model only accepts very confident detections.

❓ Metrics
advanced
2:00remaining
Evaluating face detection with Intersection over Union (IoU)

Which statement best describes how Intersection over Union (IoU) is used to evaluate face detection models?

AIoU is used to measure the confidence score of detected faces
BIoU measures the overlap between predicted and ground truth bounding boxes to determine if a detection is correct
CIoU calculates the pixel-wise difference between input images and detected faces
DIoU counts the total number of faces detected in an image
Attempts:
2 left
💡 Hint

Think about how to check if a predicted box matches the actual face location.

🔧 Debug
expert
3:00remaining
Debugging low face detection accuracy due to input preprocessing

A DNN face detection model trained on RGB images shows very low accuracy when tested on new images. The new images are loaded as grayscale and then converted to 3 channels by repeating the grayscale channel. What is the most likely cause of the low accuracy?

AThe model expects color features from RGB images, but repeated grayscale channels lack color information, causing poor detection
BThe model requires images to be in grayscale, so RGB input causes low accuracy
CGrayscale images have different pixel value ranges, causing normalization errors in the model
DRepeating grayscale channels increases image size, causing memory errors during inference
Attempts:
2 left
💡 Hint

Consider how color information affects feature extraction in CNNs.

Practice

(1/5)
1. What is the main purpose of using a DNN-based face detection model?
easy
A. To increase the size of an image
B. To find faces in images automatically
C. To compress images for storage
D. To change the color of an image

Solution

  1. Step 1: Understand the goal of face detection

    Face detection means finding where faces are in pictures or videos.
  2. Step 2: Recognize what DNN-based models do

    DNN models learn patterns to automatically locate faces without manual rules.
  3. Final Answer:

    To find faces in images automatically -> Option B
  4. Quick Check:

    Face detection = find faces [OK]
Hint: Face detection means locating faces in images [OK]
Common Mistakes:
  • Confusing detection with image editing
  • Thinking it changes image colors
  • Mixing detection with compression
2. Which OpenCV function is used to load a pre-trained DNN face detection model?
easy
A. cv2.dnn.readNet()
B. cv2.imread()
C. cv2.resize()
D. cv2.cvtColor()

Solution

  1. Step 1: Identify the function for loading DNN models

    OpenCV's DNN module uses cv2.dnn.readNet() to load models from files.
  2. Step 2: Differentiate from other functions

    cv2.imread() loads images, cv2.resize() changes size, cv2.cvtColor() changes color space.
  3. Final Answer:

    cv2.dnn.readNet() -> Option A
  4. Quick Check:

    Load DNN model = cv2.dnn.readNet() [OK]
Hint: Use cv2.dnn.readNet() to load DNN models [OK]
Common Mistakes:
  • Using cv2.imread() to load models
  • Confusing image functions with model loading
  • Trying to resize models with cv2.resize()
3. Given this code snippet, what will be the output type of detections?
net = cv2.dnn.readNet('model.caffemodel', 'deploy.prototxt')
blob = cv2.dnn.blobFromImage(image, 1.0, (300, 300), (104, 177, 123))
net.setInput(blob)
detections = net.forward()
medium
A. A list of bounding box coordinates
B. A single integer count of faces
C. A string describing detected faces
D. A NumPy array with detection data

Solution

  1. Step 1: Understand net.forward() output

    net.forward() returns a NumPy array containing detection results with scores and box info.
  2. Step 2: Differentiate output types

    It is not a list, integer, or string but a multi-dimensional array with detection details.
  3. Final Answer:

    A NumPy array with detection data -> Option D
  4. Quick Check:

    net.forward() output = NumPy array [OK]
Hint: net.forward() returns a NumPy array of detections [OK]
Common Mistakes:
  • Thinking output is a list or count
  • Expecting a string description
  • Confusing output with input image
4. You run this code but get no faces detected. What is the likely error?
blob = cv2.dnn.blobFromImage(image, 1.0, (224, 224), (104, 177, 123))
net.setInput(blob)
detections = net.forward()
What should you fix?
medium
A. Change input size to (300, 300) to match model requirements
B. Remove mean subtraction values from blobFromImage
C. Use cv2.imread() instead of blobFromImage
D. Call net.forward() before setInput()

Solution

  1. Step 1: Check model input size requirements

    Many DNN face detectors expect input size (300, 300). Using (224, 224) causes mismatch and no detection.
  2. Step 2: Correct the input size in blobFromImage

    Changing to (300, 300) matches model and enables detection.
  3. Final Answer:

    Change input size to (300, 300) to match model requirements -> Option A
  4. Quick Check:

    Input size must match model = (300, 300) [OK]
Hint: Match blob size to model input size [OK]
Common Mistakes:
  • Using wrong input size for the model
  • Calling net.forward() before setInput()
  • Removing mean subtraction incorrectly
5. You want to improve face detection accuracy on images with multiple faces at different sizes. Which approach helps most?
hard
A. Reduce the input image size to speed up detection
B. Increase the learning rate during training
C. Use image pyramid to detect faces at multiple scales
D. Remove mean subtraction from preprocessing

Solution

  1. Step 1: Understand multi-scale detection challenge

    Faces appear at different sizes; detecting all requires checking multiple scales.
  2. Step 2: Use image pyramid technique

    Image pyramid resizes image multiple times to detect faces at various sizes, improving accuracy.
  3. Final Answer:

    Use image pyramid to detect faces at multiple scales -> Option C
  4. Quick Check:

    Multi-scale detection = image pyramid [OK]
Hint: Use image pyramid for faces at different sizes [OK]
Common Mistakes:
  • Thinking higher learning rate fixes scale issues
  • Reducing image size loses small faces
  • Skipping mean subtraction harms accuracy
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard