0
0
Drone Programmingprogramming~10 mins

Object detection from aerial view in Drone Programming - 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 an aerial image for object detection.

Drone Programming
image = cv2.imread([1])
Drag options to blanks, or click blank then click option'
Aimage.jpg
Bimg.png
Cload_image()
D'aerial_view.jpg'
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting quotes around the filename.
Using a function call instead of a filename string.
2fill in blank
medium

Complete the code to convert the aerial image to grayscale for processing.

Drone Programming
gray_image = cv2.cvtColor(image, [1])
Drag options to blanks, or click blank then click option'
Acv2.COLOR_BGR2GRAY
Bcv2.COLOR_BGR2RGB
Ccv2.COLOR_RGB2GRAY
Dcv2.COLOR_GRAY2BGR
Attempts:
3 left
💡 Hint
Common Mistakes
Using COLOR_BGR2RGB instead of grayscale conversion.
Using COLOR_GRAY2BGR which is the reverse conversion.
3fill in blank
hard

Fix the error in the code to detect objects using a pre-trained model.

Drone Programming
detections = model.[1](gray_image)
Drag options to blanks, or click blank then click option'
Atransform
Bdetect
Cfit
Dpredict
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'predict' which is common in classification but not detection.
Using 'fit' which is for training, not detection.
4fill in blank
hard

Fill both blanks to filter detected objects by confidence and draw bounding boxes.

Drone Programming
for obj in detections:
    if obj.confidence [1] 0.5:
        cv2.rectangle(image, obj.bbox[[2]], obj.bbox[2], (0,255,0), 2)
Drag options to blanks, or click blank then click option'
A>
B<
C0
D1
Attempts:
3 left
💡 Hint
Common Mistakes
Using less than instead of greater than for confidence.
Using wrong bounding box index causing errors.
5fill in blank
hard

Fill all three blanks to create a dictionary of detected object labels and their counts.

Drone Programming
counts = {}
for obj in detections:
    label = obj.[1]
    counts[label] = counts.get(label, [2]) + [3]
Drag options to blanks, or click blank then click option'
Alabel
B0
C1
Dconfidence
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'confidence' instead of 'label' for dictionary keys.
Starting counts at 1 instead of 0 causing wrong counts.