0
0
Computer Visionml~20 mins

Image as numerical data (pixels, channels) in Computer Vision - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Image Data Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
Predict Output
intermediate
1:30remaining
What is the shape of the image array after loading?
Consider a color image loaded as a NumPy array with shape (height, width, channels). If the image is 128 pixels high, 256 pixels wide, and has 3 color channels (RGB), what will be the shape of the array?
Computer Vision
import numpy as np
image = np.zeros((128, 256, 3))
print(image.shape)
A(128, 256, 3)
B(3, 128, 256)
C(256, 128, 3)
D(128, 3, 256)
Attempts:
2 left
💡 Hint
Remember the shape format is (height, width, channels) for most image arrays.
🧠 Conceptual
intermediate
1:00remaining
Why do images have multiple channels?
Why do color images have multiple channels instead of just one?
ABecause channels represent different image file formats.
BBecause multiple channels store different image resolutions.
CBecause channels are used to store image metadata.
DBecause each channel represents a different color component like Red, Green, and Blue.
Attempts:
2 left
💡 Hint
Think about how colors are combined on screens.
Hyperparameter
advanced
2:00remaining
Choosing the right input shape for a CNN
You want to train a convolutional neural network (CNN) on 64x64 RGB images. What should be the correct input shape for the model?
A(64, 64, 3)
B(3, 64, 64)
C(64, 3, 64)
D(64, 64)
Attempts:
2 left
💡 Hint
Most deep learning libraries expect images with height, width, and channels in that order.
Metrics
advanced
1:30remaining
Calculating total pixels in a batch of images
You have a batch of 32 grayscale images, each of size 28x28 pixels. How many total pixel values are there in the batch?
A784
B25088
C896
D1024
Attempts:
2 left
💡 Hint
Multiply the number of images by pixels per image.
🔧 Debug
expert
2:30remaining
Why does this image normalization code fail?
You try to normalize an image array with pixel values from 0 to 255 by dividing by 255. But the output array remains integers. Why?
Computer Vision
import numpy as np
image = np.array([[0, 128, 255]], dtype=np.uint8)
normalized = image / 255
print(normalized)
print(normalized.dtype)
ABecause dividing uint8 by int returns uint8, so decimals are lost.
BBecause the division operator does not work on NumPy arrays.
CBecause the image array needs to be converted to float before division.
DBecause 255 is treated as zero in this context.
Attempts:
2 left
💡 Hint
Check the data type before and after division.