0
0
Computer Visionml~10 mins

Annotation quality 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 calculate the Intersection over Union (IoU) between two bounding boxes.

Computer Vision
def iou(boxA, boxB):
    xA = max(boxA[0], boxB[0])
    yA = max(boxA[1], boxB[1])
    xB = min(boxA[2], boxB[2])
    yB = min(boxA[3], boxB[3])

    interArea = max(0, xB - xA) * max(0, yB - yA)

    boxAArea = (boxA[2] - boxA[0]) * (boxA[3] - boxA[1])
    boxBArea = (boxB[2] - boxB[0]) * (boxB[3] - boxB[1])

    iou = interArea / [1]
    return iou
Drag options to blanks, or click blank then click option'
AboxAArea + boxBArea - interArea
BboxAArea - boxBArea
CinterArea
DboxAArea + boxBArea
Attempts:
3 left
💡 Hint
Common Mistakes
Using only the sum of areas without subtracting the intersection area.
Dividing by intersection area instead of union area.
2fill in blank
medium

Complete the code to compute the precision of an object detection model given true positives and false positives.

Computer Vision
def precision(true_positives, false_positives):
    return true_positives / [1]
Drag options to blanks, or click blank then click option'
Afalse_positives
Btrue_positives + false_negatives
Ctrue_positives + false_positives
Dtrue_positives
Attempts:
3 left
💡 Hint
Common Mistakes
Using false negatives in the denominator instead of false positives.
Dividing by only true positives.
3fill in blank
hard

Fix the error in the code to calculate recall given true positives and false negatives.

Computer Vision
def recall(true_positives, false_negatives):
    return true_positives / [1]
Drag options to blanks, or click blank then click option'
Afalse_negatives
Btrue_positives + false_negatives
Ctrue_positives + false_positives
Dtrue_positives
Attempts:
3 left
💡 Hint
Common Mistakes
Using false positives in the denominator instead of false negatives.
Dividing by only true positives.
4fill in blank
hard

Fill both blanks to create a dictionary comprehension that maps image IDs to their annotation counts, but only for images with more than 5 annotations.

Computer Vision
annotation_counts = {img_id: [1] for img_id, annotations in dataset.items() if [2]
Drag options to blanks, or click blank then click option'
Alen(annotations)
Blen(annotations) > 5
Clen(annotations) < 5
Dannotations
Attempts:
3 left
💡 Hint
Common Mistakes
Using the annotations list directly instead of its length.
Using the wrong comparison operator in the if condition.
5fill in blank
hard

Fill all three blanks to create a list comprehension that extracts labels from annotations only if the confidence score is above 0.8.

Computer Vision
high_conf_labels = [ann[1] for ann in annotations if ann[2] > [3]]
Drag options to blanks, or click blank then click option'
A['label']
B['confidence']
C0.8
D['score']
Attempts:
3 left
💡 Hint
Common Mistakes
Using the wrong key for confidence score.
Using dot notation instead of square brackets for dictionary keys.
Using a wrong threshold value.