0
0
Computer Visionml~10 mins

DNN-based face detection in Computer Vision - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to load a pre-trained DNN face detector model.

Computer Vision
net = cv2.dnn.readNetFromCaffe('[1]', 'deploy.caffemodel')
Drag options to blanks, or click blank then click option'
Aconfig.json
Bmodel.pb
Cdeploy.prototxt
Dweights.h5
Attempts:
3 left
💡 Hint
Common Mistakes
Using the weights file instead of the prototxt file for architecture.
Confusing TensorFlow or Keras model files with Caffe files.
2fill in blank
medium

Complete the code to prepare the input blob for the DNN face detector.

Computer Vision
blob = cv2.dnn.blobFromImage(image, 1.0, ([1], [1]), (104.0, 177.0, 123.0))
Drag options to blanks, or click blank then click option'
A300
B224
C128
D512
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect input size causing detection failure.
Confusing input size with image resolution.
3fill in blank
hard

Fix the error in the code to extract confidence scores from the detections.

Computer Vision
confidence = detections[0, 0, i, [1]]
Drag options to blanks, or click blank then click option'
A1
B0
C3
D2
Attempts:
3 left
💡 Hint
Common Mistakes
Using index 1 or 3 which correspond to class or bounding box coordinates.
Confusing zero-based indexing.
4fill in blank
hard

Fill both blanks to compute bounding box coordinates from detections.

Computer Vision
box = detections[0, 0, i, 3:7] * np.array([[1], [2], [1], [2]])
Drag options to blanks, or click blank then click option'
Aw
Bh
Cimage.shape[1]
Dimage.shape[0]
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping width and height values.
Using fixed numbers instead of image dimensions.
5fill in blank
hard

Fill all three blanks to filter detections by confidence and draw rectangles.

Computer Vision
if confidence > [1]:
    (startX, startY, endX, endY) = box.astype([2])
    cv2.rectangle(image, (startX, startY), (endX, endY), [3], 2)
Drag options to blanks, or click blank then click option'
A0.5
Bint
C(0, 255, 0)
Dfloat
Attempts:
3 left
💡 Hint
Common Mistakes
Using too low or too high confidence threshold.
Not converting coordinates to int causing errors.
Using wrong color format for rectangle.