Bird
Raised Fist0
Computer Visionml~20 mins

Why computer vision teaches machines to see - Challenge Your Understanding

Choose your learning style10 modes available

Start learning this pattern below

Jump into concepts and practice - no test required

or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
Challenge - 5 Problems
🎖️
Computer Vision Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
1:30remaining
What is the main goal of computer vision?
Computer vision helps machines understand images and videos. What is the main goal of teaching machines to see?
ATo allow machines to write text without any visual input
BTo make machines generate random images without understanding
CTo teach machines to hear sounds from images
DTo enable machines to recognize and interpret visual information like humans do
Attempts:
2 left
💡 Hint
Think about what seeing means for humans and how machines might do the same.
Predict Output
intermediate
1:30remaining
Output of image pixel normalization code
What is the output of this Python code that normalizes pixel values of an image array?
Computer Vision
import numpy as np
image = np.array([[0, 128], [255, 64]])
normalized = image / 255
print(normalized)
ATypeError: unsupported operand type(s) for /: 'list' and 'int'
B[[0, 0.5], [1, 0.25]]
C[[0.0, 0.50196078], [1.0, 0.25098039]]
D[[0, 128], [255, 64]]
Attempts:
2 left
💡 Hint
Division by 255 converts pixel values to a 0-1 range as floats.
Model Choice
advanced
2:00remaining
Best model type for object detection in images
You want to build a system that finds and labels objects in photos. Which model type is best suited for this task?
AConvolutional Neural Network (CNN) with region proposal networks
BRecurrent Neural Network (RNN) for sequence prediction
CLinear Regression model for numeric prediction
DK-Means clustering for grouping unlabeled data
Attempts:
2 left
💡 Hint
Object detection needs spatial understanding of images.
Metrics
advanced
1:30remaining
Choosing the right metric for image classification accuracy
You trained a model to classify images into categories. Which metric best shows how often the model predicts the correct category?
AMean Squared Error
BAccuracy
CSilhouette Score
DPerplexity
Attempts:
2 left
💡 Hint
Think about a metric that measures correct predictions over total predictions.
🔧 Debug
expert
2:30remaining
Why does this image preprocessing code raise an error?
What error does this code raise and why? import cv2 image = cv2.imread('photo.jpg') gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) resized = cv2.resize(gray, (100, 100)) print(resized.shape)
Computer Vision
import cv2
image = cv2.imread('photo.jpg')
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
resized = cv2.resize(gray, (100, 100))
print(resized.shape)
AAttributeError because 'image' is None if file not found
BTypeError because cv2.resize expects a list, not a numpy array
CValueError because color conversion code is invalid
DNo error, prints (100, 100)
Attempts:
2 left
💡 Hint
Check if the image file was loaded correctly before processing.

Practice

(1/5)
1. What is the main goal of computer vision in machines?
easy
A. To store large amounts of data
B. To help machines understand and interpret images and videos
C. To make machines run faster
D. To improve battery life of devices

Solution

  1. Step 1: Understand the purpose of computer vision

    Computer vision is about teaching machines to see and understand visual data like images and videos.
  2. Step 2: Identify the correct goal

    The goal is not about speed, storage, or battery but about interpreting visual information.
  3. Final Answer:

    To help machines understand and interpret images and videos -> Option B
  4. Quick Check:

    Computer vision = understanding images/videos [OK]
Hint: Think: What does 'vision' mean for machines? [OK]
Common Mistakes:
  • Confusing computer vision with hardware improvements
  • Thinking it only stores data
  • Mixing vision with battery or speed
2. Which of the following is the correct way to represent an image as data for a machine to process?
easy
A. A single number
B. A list of text descriptions
C. A matrix of pixel values
D. A sound wave

Solution

  1. Step 1: Recall how images are stored digitally

    Images are stored as grids of pixels, each with color or brightness values, forming a matrix.
  2. Step 2: Match the correct representation

    Only a matrix of pixel values correctly represents image data for machines.
  3. Final Answer:

    A matrix of pixel values -> Option C
  4. Quick Check:

    Image data = pixel matrix [OK]
Hint: Images = grids of pixels, not text or sound [OK]
Common Mistakes:
  • Choosing text descriptions instead of pixel data
  • Thinking images are single numbers
  • Confusing images with sounds
3. Given the following Python code snippet for edge detection, what will be the output shape of edges if the input image shape is (100, 100)?
import cv2
image = cv2.imread('photo.jpg', 0)
edges = cv2.Canny(image, 100, 200)
print(edges.shape)
medium
A. (50, 50)
B. (98, 98)
C. (102, 102)
D. (100, 100)

Solution

  1. Step 1: Understand Canny edge detection output size

    Canny edge detection returns an image of the same size as the input image.
  2. Step 2: Check input image shape

    The input image shape is (100, 100), so the output edges will also have shape (100, 100).
  3. Final Answer:

    (100, 100) -> Option D
  4. Quick Check:

    Canny output shape = input shape [OK]
Hint: Edge detection keeps image size same [OK]
Common Mistakes:
  • Assuming edges shrink image size
  • Thinking edges enlarge image
  • Confusing shape with number of edges
4. The following code is intended to convert an image to grayscale using OpenCV. What is the error?
import cv2
image = cv2.imread('photo.jpg')
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
cv2.imshow('Gray Image', gray)
cv2.waitKey(0)
cv2.destroyAllWindows()
medium
A. No error, code works correctly
B. cv2.imread should include flag cv2.IMREAD_GRAYSCALE
C. cv2.cvtColor is used incorrectly
D. Missing image file path

Solution

  1. Step 1: Check image reading method

    cv2.imread reads the image in color by default, which is fine for conversion.
  2. Step 2: Verify color conversion usage

    cv2.cvtColor with cv2.COLOR_BGR2GRAY correctly converts color image to grayscale.
  3. Step 3: Confirm display functions

    cv2.imshow, cv2.waitKey, and cv2.destroyAllWindows are used properly to show the image.
  4. Final Answer:

    No error, code works correctly -> Option A
  5. Quick Check:

    Correct grayscale conversion code [OK]
Hint: cv2.cvtColor with COLOR_BGR2GRAY is standard [OK]
Common Mistakes:
  • Thinking cv2.imread needs grayscale flag always
  • Misusing cv2.cvtColor parameters
  • Forgetting to call cv2.waitKey
5. You want to teach a machine to recognize handwritten digits using computer vision. Which combination of steps is best to prepare the images before training a model?
hard
A. Convert images to grayscale, normalize pixel values, and detect edges
B. Convert images to color, increase brightness, and add noise
C. Resize images to large size, convert to text, and shuffle pixels
D. Use raw images without any processing

Solution

  1. Step 1: Identify useful preprocessing steps for digit recognition

    Converting to grayscale simplifies data, normalizing scales pixel values, and edge detection highlights important features.
  2. Step 2: Evaluate other options

    Color conversion and noise addition can confuse the model; resizing too large or converting to text is not helpful; raw images may have noise and irrelevant info.
  3. Final Answer:

    Convert images to grayscale, normalize pixel values, and detect edges -> Option A
  4. Quick Check:

    Preprocessing = grayscale + normalize + edges [OK]
Hint: Simplify images and highlight features before training [OK]
Common Mistakes:
  • Using color images unnecessarily
  • Adding noise that confuses model
  • Skipping normalization
  • Ignoring edge detection benefits