Challenge - 5 Problems
Image Data Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate1: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)
Attempts:
2 left
💡 Hint
Remember the shape format is (height, width, channels) for most image arrays.
✗ Incorrect
The shape of the image array is (128, 256, 3) because the first dimension is height (rows), second is width (columns), and third is the number of color channels (RGB).
🧠 Conceptual
intermediate1:00remaining
Why do images have multiple channels?
Why do color images have multiple channels instead of just one?
Attempts:
2 left
💡 Hint
Think about how colors are combined on screens.
✗ Incorrect
Color images have multiple channels to represent different color components. Typically, Red, Green, and Blue channels combine to create the full color image.
❓ Hyperparameter
advanced2: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?
Attempts:
2 left
💡 Hint
Most deep learning libraries expect images with height, width, and channels in that order.
✗ Incorrect
The input shape for CNNs usually follows (height, width, channels) for RGB images, so (64, 64, 3) is correct.
❓ Metrics
advanced1: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?
Attempts:
2 left
💡 Hint
Multiply the number of images by pixels per image.
✗ Incorrect
Each image has 28x28 = 784 pixels. For 32 images, total pixels = 32 * 784 = 25088.
🔧 Debug
expert2: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)
Attempts:
2 left
💡 Hint
Check the data type before and after division.
✗ Incorrect
NumPy keeps the data type during division if the array is integer type, causing truncation. Converting to float before division preserves decimals.