SAM
SAM, or Segment Anything Model, is a pretrained promptable computer-vision model that generates segmentation masks for objects in images.
Deep Learning with PyTorch, Second Edition
A transformer-based image segmentation model designed to generalize to many objects and support prompt-driven, zero-shot mask prediction.
- How it is used
- Introduces promptable segmentation for locating candidate nodules in CT images before classification.
- How deep it goes
- Explains the three architecture components and demonstrates pretrained automatic and point-prompted prediction without implementing SAM from scratch.
- Examples
- Uses an astronaut image for automatic masks, a dog image for point prompts, and CT slices for candidate-nodule masks.
- What you can do after
- Apply it via the Segment Anything library to generate automatic or point-prompted masks with pretrained weights.
Read how Deep Learning with PyTorch, Second Edition explains SAM →
Deep Learning with Python, Third Edition
A pretrained segmentation model available through KerasHub for prompting-based segmentation tasks.
- How it is used
- Deploys prompting-based image segmentation when labeled training data or a predefined object-class list is limiting.
- How deep it goes
- Explains the high-level architecture and demonstrates point and box inference, while deferring prompt-encoder and mask-decoder internals.
- Examples
- Demonstrates peach, banana, and mango segmentation using foreground points, alternative masks, and an approximate box.
- What you can do after
- Apply SAM through KerasHub to generate object masks from point or box prompts and inspect alternative predictions.
Read how Deep Learning with Python, Third Edition explains SAM →
Deep Learning with R, Third Edition
Segment Anything is a promptable image-segmentation model that generates segmentation masks from images and user-provided prompts.
- How it is used
- Applies pretrained promptable segmentation to objects selected by points or boxes.
- How deep it goes
- Explains inputs, embeddings, and major components while deferring prompt-encoder and mask-decoder details.
- Examples
- Demonstrates segmenting a mango with a box prompt and displaying the resulting mask.
- What you can do after
- Apply SAM via KerasHub to generate masks from images and point or box prompts.
What to know first
- computer visionComputer vision is the field of computing concerned with extracting and interpreting information from images, video, and other visual data.
- image segmentationImage segmentation is a computer-vision task that partitions an image and assigns labels to its pixels or regions to delineate objects or meaningful areas.
- segmentation maskA segmentation mask is an image-shaped array that assigns each pixel or spatial element to a class, object, region, or corresponding segmentation value.
- classifierA classifier is a predictive model that assigns an input to one or more discrete classes or categories.
Related concepts
- pretrained modelkind of · A pretrained model is a machine-learning model whose parameters were learned through prior training before it is used for inference or adapted to a later task.
- segmentation maskuses · A segmentation mask is an image-shaped array that assigns each pixel or spatial element to a class, object, region, or corresponding segmentation value.
- box promptused by · A box prompt is an image-segmentation input that specifies an approximate rectangular bounding box around a region of interest.
- image encoderhas part · An image encoder is a model component that maps an image to a numerical representation for use in comparison or further processing.
- point promptused by · A point prompt is an input specifying one or more locations in an image to guide segmentation toward relevant foreground, background, or target regions.
Questions about SAM
What is SAM?
SAM, or Segment Anything Model, is a pretrained promptable computer-vision model that generates segmentation masks for objects in images.
Which Manning books explain SAM?
Deep Learning with PyTorch, Second Edition, Deep Learning with Python, Third Edition and Deep Learning with R, Third Edition.
What should I know before learning SAM?
Manning books that teach SAM usually introduce computer vision, image segmentation, segmentation mask and classifier first.
What is SAM a kind of?
SAM is a kind of pretrained model. A pretrained model is a machine-learning model whose parameters were learned through prior training before it is used for inference or adapted to a later task.
What are the parts of SAM?
SAM includes image encoder and mask decoder.
What is SAM also called?
SAM is also called Segment Anything.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.


