Bird
Raised Fist0
Drone Programmingprogramming~20 mins

Why computer vision enables intelligent flight in Drone Programming - Challenge Your Understanding

Choose your learning style10 modes available
Challenge - 5 Problems
🎖️
Vision Flight Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
How does computer vision help drones avoid obstacles?

Imagine a drone flying through a forest. How does computer vision help it avoid hitting trees?

ABy pre-programming a fixed flight path without sensing surroundings
BBy relying only on GPS signals to know where trees are located
CBy using sound waves to map the environment instead of cameras
DBy using cameras to see the environment and detect obstacles in real time
Attempts:
2 left
💡 Hint

Think about how a drone can 'see' obstacles before hitting them.

❓ Model Choice
intermediate
2:00remaining
Which model type is best for real-time object detection in drone flight?

For a drone that needs to detect objects quickly while flying, which model is most suitable?

AA large transformer model designed for text processing
BA deep convolutional neural network optimized for speed like YOLO
CA simple linear regression model
DA clustering algorithm like K-means
Attempts:
2 left
💡 Hint

Consider models designed for fast image recognition.

❓ Metrics
advanced
2:00remaining
Which metric best measures a drone's object detection accuracy?

When evaluating how well a drone detects obstacles, which metric gives the best balance between detecting true obstacles and avoiding false alarms?

AF1 Score
BRecall
CPrecision
DMean Squared Error
Attempts:
2 left
💡 Hint

Think about a metric that balances both precision and recall.

🔧 Debug
advanced
2:00remaining
Why does this drone vision code fail to detect objects?

Given this simplified code snippet for object detection, why does it fail to detect any objects?

Drone Programming
def detect_objects(image):
    # supposed to return list of detected objects
    objects = []
    for pixel in image:
        if pixel > 128:
            objects.append(pixel)
    return objects

image = [50, 60, 70, 200, 210]
detected = detect_objects(image)
print(detected)
AThe code treats each pixel as an object, but pixels alone don't represent objects; detection logic is too simple
BThe loop iterates over pixels but pixels are integers, not objects; condition is valid so it detects correctly
CThe function returns an empty list because the condition pixel > 128 is never true
DThe code raises a TypeError because image is not iterable
Attempts:
2 left
💡 Hint

Think about what pixels represent versus objects in images.

❓ Predict Output
expert
2:00remaining
What is the output of this drone image classification code?

Consider this code that classifies drone images into 'clear' or 'obstacle' based on brightness. What is printed?

Drone Programming
def classify_image(brightness_values):
    avg_brightness = sum(brightness_values) / len(brightness_values)
    if avg_brightness > 100:
        return 'clear'
    else:
        return 'obstacle'

image1 = [120, 130, 110, 115]
image2 = [90, 80, 70, 60]
print(classify_image(image1))
print(classify_image(image2))
A
clear
clear
B
obstacle
clear
C
clear
obstacle
D
obstacle
obstacle
Attempts:
2 left
💡 Hint

Calculate the average brightness for each image and compare to 100.

Practice

(1/5)
1. Why is computer vision important for drones to fly intelligently?
easy
A. It helps drones see and understand their surroundings.
B. It makes drones fly faster without any sensors.
C. It allows drones to recharge their batteries mid-flight.
D. It controls the drone's motor speed directly.

Solution

  1. Step 1: Understand the role of computer vision in drones

    Computer vision lets drones capture images and interpret what they see around them.
  2. Step 2: Connect vision to intelligent flight

    By understanding surroundings, drones can avoid obstacles and navigate safely.
  3. Final Answer:

    It helps drones see and understand their surroundings. -> Option A
  4. Quick Check:

    Computer vision = understanding environment [OK]
Hint: Think: vision means 'seeing' and understanding [OK]
Common Mistakes:
  • Confusing vision with speed control
  • Thinking vision recharges batteries
  • Assuming vision replaces all sensors
2. Which Python code snippet correctly imports a library used for computer vision in drones?
easy
A. import computer_vision
B. import dronevision
C. import cv2
D. import vision.cv

Solution

  1. Step 1: Identify common computer vision libraries

    OpenCV is a popular library for computer vision, imported as cv2 in Python.
  2. Step 2: Check the import syntax

    Correct import is 'import cv2' without errors or typos.
  3. Final Answer:

    import cv2 -> Option C
  4. Quick Check:

    OpenCV import = cv2 [OK]
Hint: Remember OpenCV is imported as cv2 in Python [OK]
Common Mistakes:
  • Using non-existent library names
  • Wrong import syntax
  • Confusing module names
3. What will the following Python code print when a drone detects an obstacle using computer vision?
import cv2
obstacle_detected = True
if obstacle_detected:
    print('Stop and avoid obstacle')
else:
    print('Continue flying')
medium
A. Continue flying
B. Stop and avoid obstacle
C. Error: obstacle_detected undefined
D. No output

Solution

  1. Step 1: Check the value of obstacle_detected

    The variable obstacle_detected is set to True, meaning an obstacle is detected.
  2. Step 2: Follow the if-else logic

    Since obstacle_detected is True, the code prints 'Stop and avoid obstacle'.
  3. Final Answer:

    Stop and avoid obstacle -> Option B
  4. Quick Check:

    True condition prints stop message [OK]
Hint: True triggers first print statement [OK]
Common Mistakes:
  • Ignoring the True value and picking else output
  • Thinking variable is undefined
  • Assuming no output without print
4. The following code is meant to detect obstacles and print a warning, but it does not work as expected. What is the error?
obstacle_detected = False
if obstacle_detected = True:
    print('Obstacle ahead!')
else:
    print('Path is clear')
medium
A. Missing import statement for cv2
B. Variable obstacle_detected is not defined
C. Print statement syntax is wrong
D. Using '=' instead of '==' in the if condition

Solution

  1. Step 1: Identify the if condition syntax

    The code uses '=' which is assignment, not comparison. It should use '==' to compare values.
  2. Step 2: Understand why this causes error

    Using '=' in if condition causes a syntax error, stopping the code from running.
  3. Final Answer:

    Using '=' instead of '==' in the if condition -> Option D
  4. Quick Check:

    Comparison needs '==' not '=' [OK]
Hint: Use '==' for comparison in if statements [OK]
Common Mistakes:
  • Confusing assignment '=' with comparison '=='
  • Thinking import is needed for this error
  • Assuming print syntax is wrong
5. A drone uses computer vision to detect obstacles and decide its flight path. Which approach best enables the drone to avoid collisions while following a moving target?
hard
A. Use a camera to detect obstacles and a tracking algorithm to follow the target.
B. Fly randomly and hope to avoid obstacles by chance.
C. Only use GPS data without any vision sensors.
D. Disable obstacle detection to increase speed.

Solution

  1. Step 1: Understand the need for obstacle detection

    To avoid collisions, the drone must see obstacles using a camera or sensors.
  2. Step 2: Combine obstacle detection with target tracking

    Following a moving target requires tracking algorithms that work with vision data.
  3. Step 3: Evaluate other options

    Random flying or ignoring obstacles risks crashes; GPS alone lacks obstacle info.
  4. Final Answer:

    Use a camera to detect obstacles and a tracking algorithm to follow the target. -> Option A
  5. Quick Check:

    Vision + tracking = safe, smart flight [OK]
Hint: Combine vision for obstacles and tracking for targets [OK]
Common Mistakes:
  • Ignoring obstacle detection
  • Relying only on GPS
  • Flying randomly without control
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard