0
0
PyTorchml~10 mins

Why detection localizes objects in PyTorch - Test Your Understanding

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

Complete the code to create a bounding box tensor for an object detection model.

PyTorch
bbox = torch.tensor([[1], 50, 150, 200])
Drag options to blanks, or click blank then click option'
A30
B'30'
C(30)
D[30]
Attempts:
3 left
💡 Hint
Common Mistakes
Using quotes around numbers, which makes them strings.
Using list or tuple instead of a number.
2fill in blank
medium

Complete the code to calculate the Intersection over Union (IoU) between two boxes.

PyTorch
iou = intersection_area / [1]
Drag options to blanks, or click blank then click option'
Abox1_area
Bintersection_area
Cunion_area
Dbox2_area
Attempts:
3 left
💡 Hint
Common Mistakes
Dividing by intersection area instead of union area.
Using only one box's area.
3fill in blank
hard

Fix the error in the code that extracts predicted bounding boxes from model output.

PyTorch
pred_boxes = outputs['boxes'][1]
Drag options to blanks, or click blank then click option'
A(0)
B[0]
C{0}
D<0>
Attempts:
3 left
💡 Hint
Common Mistakes
Using parentheses instead of brackets for indexing.
Using curly braces or angle brackets.
4fill in blank
hard

Fill both blanks to complete the code that filters detections by confidence score.

PyTorch
filtered = [box for box in detections if box['score'] [1] [2]]
Drag options to blanks, or click blank then click option'
A>
B0.5
C<
D1.0
Attempts:
3 left
💡 Hint
Common Mistakes
Using less than instead of greater than.
Using threshold 1.0 which is too strict.
5fill in blank
hard

Fill all three blanks to complete the code that creates a dictionary of detected object labels and their bounding boxes.

PyTorch
results = [1]((label, [2]) for label, box in zip(labels, [3]))
Drag options to blanks, or click blank then click option'
Adict
Bbox
Cboxes
Dlist
Attempts:
3 left
💡 Hint
Common Mistakes
Using list instead of dict.
Using wrong variable names for boxes.