0
0
Computer Visionml~10 mins

Human pose estimation concept 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 human pose estimation model using OpenPose.

Computer Vision
import cv2
net = cv2.dnn.readNetFromCaffe('pose_deploy_linevec.prototxt', '[1]')
Drag options to blanks, or click blank then click option'
Apose_iter_100000.caffemodel
Bpose_iter_440000.caffemodel
Cpose_deploy_linevec.prototxt
Dpose_deploy.prototxt
Attempts:
3 left
💡 Hint
Common Mistakes
Using the prototxt file instead of the caffemodel file for weights.
Confusing the model structure file with the weights file.
2fill in blank
medium

Complete the code to prepare the input image blob for the pose estimation model.

Computer Vision
blob = cv2.dnn.blobFromImage(image, 1.0 / 255, (368, 368), (0, 0, 0), swapRB=True, crop=False)
net.setInput([1])
Drag options to blanks, or click blank then click option'
Ablob
Bimage
Cnet
Dinput
Attempts:
3 left
💡 Hint
Common Mistakes
Passing the original image instead of the blob to the network.
Passing the network object itself as input.
3fill in blank
hard

Fix the error in the code to extract the keypoints from the model output heatmaps.

Computer Vision
output = net.forward()
H, W = output.shape[2], output.shape[3]
points = []
for i in range(num_keypoints):
    probMap = output[0, i, :, :]
    minVal, prob, minLoc, point = cv2.minMaxLoc(probMap)
    x = (image.shape[1] * point[0]) / [1]
    y = (image.shape[0] * point[1]) / H
    if prob > threshold:
        points.append((int(x), int(y)))
    else:
        points.append(None)
Drag options to blanks, or click blank then click option'
AW
Cnum_keypoints
Dthreshold
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up height and width when scaling coordinates.
Using the wrong dimension for scaling x or y.
4fill in blank
hard

Fill both blanks to create a dictionary of keypoints with their names and coordinates.

Computer Vision
keypoints_dict = [1](name: points[i] for i, name in [2](keypoint_names))
Drag options to blanks, or click blank then click option'
Adict
Blist
Cenumerate
Drange
Attempts:
3 left
💡 Hint
Common Mistakes
Using list() instead of dict() for dictionary creation.
Using range() instead of enumerate() to get index and name.
5fill in blank
hard

Fill all three blanks to filter detected keypoints with confidence above threshold and create a list of their coordinates.

Computer Vision
filtered_points = [points[i] for i, prob in [1](output[0, :, :, :].max(axis=(1, 2))) if prob [2] threshold and points[i] is not [3]]
Drag options to blanks, or click blank then click option'
Aenumerate
B>
CNone
Drange
Attempts:
3 left
💡 Hint
Common Mistakes
Using range instead of enumerate for index and value pairs.
Using '<' instead of '>' for filtering probabilities.
Checking points[i] against wrong value instead of None.