0
0
Computer Visionml~10 mins

Bounding box representation 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 create a bounding box represented by its top-left corner and width and height.

Computer Vision
bbox = {'x': 50, 'y': 100, 'width': 200, 'height': [1]
Drag options to blanks, or click blank then click option'
A100
B250
C50
D150
Attempts:
3 left
💡 Hint
Common Mistakes
Confusing width with height.
Using the x or y coordinate instead of height.
2fill in blank
medium

Complete the code to calculate the bottom-right corner coordinates of the bounding box.

Computer Vision
bottom_right_x = bbox['x'] + [1]
bottom_right_y = bbox['y'] + bbox['height']
Drag options to blanks, or click blank then click option'
Abbox['x']
Bbbox['height']
Cbbox['width']
Dbbox['y']
Attempts:
3 left
💡 Hint
Common Mistakes
Adding height instead of width to x.
Adding y coordinate instead of width.
3fill in blank
hard

Fix the error in the code to correctly compute the bounding box area.

Computer Vision
area = bbox['width'] [1] bbox['height']
Drag options to blanks, or click blank then click option'
A*
B+
C-
D/
Attempts:
3 left
💡 Hint
Common Mistakes
Adding width and height instead of multiplying.
Dividing width by height.
4fill in blank
hard

Fill both blanks to create a dictionary comprehension that maps each bounding box id to its area.

Computer Vision
areas = {box_id: bbox[1] bbox[2] for box_id, bbox in boxes.items()}
Drag options to blanks, or click blank then click option'
A['width'] *
B['height']
C['width'] +
D['height'] *
Attempts:
3 left
💡 Hint
Common Mistakes
Using addition instead of multiplication.
Mixing up width and height keys.
5fill in blank
hard

Fill all three blanks to create a function that converts bounding box from (x, y, width, height) to (x_min, y_min, x_max, y_max).

Computer Vision
def convert_bbox(bbox):
    x_min = bbox['x']
    y_min = bbox['y']
    x_max = bbox['x'] [1] bbox['width']
    y_max = bbox['y'] [2] bbox[[3]]
    return (x_min, y_min, x_max, y_max)
Drag options to blanks, or click blank then click option'
A+
B-
C'height'
D'width'
Attempts:
3 left
💡 Hint
Common Mistakes
Subtracting width or height instead of adding.
Using wrong keys for width or height.