0
0
Computer Visionml~10 mins

Face detection with deep learning 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 the pre-trained face detection model.

Computer Vision
net = cv2.dnn.readNetFromCaffe('[1]', 'res10_300x300_ssd_iter_140000.caffemodel')
Drag options to blanks, or click blank then click option'
Aconfig.pbtxt
Bdeploy.prototxt.txt
Cface_detector.prototxt
Dmodel.caffemodel
Attempts:
3 left
💡 Hint
Common Mistakes
Using the weights file instead of the architecture file.
Using a TensorFlow config file instead of Caffe prototxt.
2fill in blank
medium

Complete the code to prepare the input blob for the 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
D256
Attempts:
3 left
💡 Hint
Common Mistakes
Using 224 which is common for classification but not this detector.
Using different width and height values.
3fill in blank
hard

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

Computer Vision
confidence = detections[0, 0, i, [1]]
Drag options to blanks, or click blank then click option'
A2
B4
C3
D1
Attempts:
3 left
💡 Hint
Common Mistakes
Using index 1 which is class id.
Using index 3 or 4 which are bounding box coordinates.
4fill in blank
hard

Fill both blanks to compute bounding box coordinates from detection.

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
Using width for both x and y coordinates.
Using height for both x and y coordinates.
5fill in blank
hard

Fill all three blanks to draw rectangles around detected faces with confidence above threshold.

Computer Vision
if confidence > [1]:
    (startX, startY, endX, endY) = box.astype(int)
    cv2.rectangle(image, (startX, startY), (endX, endY), [2], [3])
Drag options to blanks, or click blank then click option'
A0.5
B(0, 255, 0)
C2
D0.75
Attempts:
3 left
💡 Hint
Common Mistakes
Using a confidence threshold too low or too high.
Using wrong color format or thickness type.