In semantic segmentation, why is it important to assign a label to every pixel in an image?
Think about how detailed understanding of an image is achieved.
Semantic segmentation assigns a class label to every pixel to fully understand the image's content. This helps the model know exactly which parts belong to which object or background.
How does semantic segmentation differ from image classification in terms of labeling?
Think about the level of detail each task provides.
Image classification gives one label for the entire image, while segmentation provides a label for each pixel, showing detailed object boundaries.
Given a segmentation model that takes an input image of shape (256, 256, 3), what is the shape of its output prediction?
import numpy as np input_shape = (256, 256, 3) # Model outputs per-pixel class probabilities for 4 classes output_shape = (256, 256, 4) print(output_shape)
Think about how many classes the model predicts per pixel.
The model outputs a probability for each class at every pixel, so the output shape matches the image height and width with a depth equal to the number of classes.
Which metric is most suitable to measure how well a segmentation model labels every pixel correctly?
Consider metrics that compare predicted and true pixel areas.
IoU measures the overlap between predicted and true pixel regions for each class, making it ideal for segmentation evaluation.
Consider this code snippet for a segmentation model output layer:
from tensorflow.keras.layers import Conv2D output = Conv2D(filters=1, kernel_size=1, activation='softmax')(input_tensor)
Why might this cause an error or incorrect output shape for multi-class segmentation?
Think about how many classes the model predicts and how softmax works.
For multi-class segmentation, the output layer must have filters equal to the number of classes to produce class probabilities per pixel. Using filters=1 outputs only one channel, which is insufficient.