01Chapter 1: What image segmentation is and why it mattersImage segmentation assigns a label to every pixel in an image. A classifier says "this photo contains a dog." A detector says "there is a dog inside this box." A segmentation model says "these exact pixels are the dog, and these other pixels are grass." This chapter defines the task, separates its t6 min read
02Chapter 2: Representing segmentation: label maps and mask stacksThis chapter assumes you know basic Python and NumPy, and that you know what a convolutional network outputs for classification and detection. Every later chapter on models, losses, and metrics depends on how a segmentation result is stored. A model, a metric, or a dataset loader can be correct and 5 min read
03Chapter 3: Things versus stuffThis chapter assumes you know what a segmentation label map is (an integer class per pixel) and can run Python with NumPy and SciPy. The previous chapter showed how masks are stored. Here you learn the distinction that decides which kind of segmentation a class can take part in. Every later chapter 5 min read
04Chapter 4: Semantic segmentation: one class per pixelThis chapter assumes you know basic Python and NumPy, how a convolutional network classifies a whole image, and how a loss function drives gradient-based training. Mask formats, IoU, and the encoder-decoder design each get their own chapter. Here the focus is the task: what a semantic segmentation m5 min read
05Chapter 5: Instance segmentation: separating individual objectsThis chapter assumes you know basic Python and NumPy, how convolutional networks classify images, and how object detectors produce boxes and confidence scores. It also assumes you have read the earlier chapters on label maps and mask stacks, and on things versus stuff.4 min read
06Chapter 6: Panoptic segmentation: a unified outputThis chapter assumes you know the semantic and instance segmentation outputs from the earlier chapters. You should also be comfortable with NumPy arrays and with the difference between things and stuff.5 min read
07Chapter 7: Measuring overlap: IoU and mean IoUThis chapter assumes you can read NumPy code and know what a label map is (an integer class ID for every pixel). It also assumes you know what a confusion matrix is in classification. Here you learn to score a segmentation by how well predicted regions overlap ground-truth regions.4 min read
08Chapter 8: Encoder-decoder networks and upsamplingThis chapter assumes you can read PyTorch code and know how convolution, stride, padding and pooling change a feature map's size. It also assumes you know what a classification backbone such as a ResNet produces. The chapter shows how to turn that backbone into a model that predicts a class for ever5 min read
09Chapter 9: Dilated convolutions and multi-scale contextThis chapter assumes you know how a convolution works, what stride and padding do, and the encoder-decoder pattern for segmentation from the previous chapter. You should be comfortable reading PyTorch code.4 min read
10Chapter 10: Training losses: cross-entropy and DiceA segmentation loss turns a predicted mask and a ground-truth mask into one number that gradient descent can reduce. This chapter covers the two losses you will meet most often: pixel-wise cross-entropy and Dice. It also covers why they behave differently when one class covers little of the image, a5 min read
11Chapter 11: Mask R-CNN: detect, then segmentThis chapter assumes you know how two-stage object detectors such as Faster R-CNN work, including bounding boxes, confidence scores, and non-maximum suppression (NMS). It also assumes you can read PyTorch and NumPy code. Mask R-CNN is the standard example of a detect-then-segment instance segmentati5 min read
12Chapter 12: Evaluating instances with mask APThis chapter assumes you know IoU on label maps, bounding-box detection with confidence scores, and precision and recall. It builds on the Mask R-CNN chapter, because mask AP is the standard score for models like it.4 min read
13Chapter 13: Merging semantic and instance predictions into panoptic outputThis chapter assumes you can read basic NumPy, know what a label map and a stack of binary instance masks are, and have seen output from a semantic model and a detect-then-segment model such as Mask R-CNN. Here you will combine the two outputs into one panoptic result. In that result every pixel has4 min read
14Chapter 14: Scoring panoptic results with PQ, SQ, and RQThis chapter assumes you know IoU and mean IoU, the idea of things versus stuff classes, and how a panoptic ID map stores one segment per pixel. Mean IoU suits semantic segmentation and mask AP suits instance segmentation. Neither scores a panoptic result, which mixes both kinds of class in one outp4 min read
15Chapter 15: Unified mask classification with transformersThis chapter assumes you know how Mask R-CNN and per-pixel semantic segmentation work, and that you are comfortable with attention and the Hungarian algorithm at a high level. It covers MaskFormer and Mask2Former, which handle semantic, instance, and panoptic segmentation with one model and one loss4 min read
16Chapter 16: Datasets and annotation formatsThis chapter assumes you know what label maps and mask stacks are, and that you have met IoU, mask AP, and PQ. Here you will see how real datasets store those masks on disk, how to decode them, and where the formats cause silent errors.5 min read
17Chapter 17: Promptable segmentation modelsEarlier chapters covered models trained to predict a fixed set of classes. A promptable segmentation model works differently. You give it an image and a hint about what you want, and it returns a mask for that thing. This chapter assumes you know the following:4 min read
18Chapter 18: Common pitfalls and practical checksThis chapter assumes you can read the label maps, mask stacks, and panoptic outputs from earlier chapters. It also assumes you know IoU, mask AP, and PQ, and can run PyTorch and NumPy code. Segmentation bugs rarely crash. They produce a model that trains, reports a plausible number, and is quietly w5 min read