All models

sam2_hiera_small

Segment Anything Model 2: promptable masks for images and video, mostly traced here as its Hiera encoder.

Segmentation · 598 operations Checked

100%

Showing the top corner; full diagram not loaded yetShowing a small copy; full diagram not loaded yetLarge diagram, not loaded yet

Open SVG

Loading diagram (33 KB)

Open in a new tab

Click or tap a spot to read it up close. Scroll or drag inside the diagram to move through it. Zoom with + and − or Ctrl and scroll. Press 0 for the whole graph. Swipe inside the diagram to move through it. Use + and − to zoom.

At a glance

Family
sam2
Parameters
33.9M
Operations
598
Framework
PyTorch
Recurrent
No
Published
2024
License
Apache-2.0
Checked
Passed: the trace was replayed operation by operation and matched the model's own output for this input.

Files

The diagram is a drawing of a TorchLens trace of the source code. It contains no code or weights.

Details
Stable ID
m9015
Graph hash
eb802442fd3f1d7dae8b827d5fb57e82c05ebee9beb754d7a85269480b86a4df
Skeleton hash
743dbc26c1cd6038895d952f437ae067aaedb63a9d84713aab76aeba4315e505
Architecture hash
8301dc4a5f4e2634f78d33445d65a75b0cff5772ed51eadff6755d9574f86271
Diagram SHA-256
1c2cd6a94abdebc42090c40e4863516561537e33e782dbc94e39a6e0125435e1
TorchLens version
2.35.3
Renderer
graphviz 2.43.0+pyvips 3.2.0+libvips 8.18.7+render-opts@06c1f0d3
Check
Forward pass replayed in PyTorch

How this diagram was made

timm.create_model('sam2_hiera_small', pretrained=False)

What it is

About this model's family

SAM2, the Segment Anything Model 2, is a foundation model for promptable visual segmentation in images and videos. Given an image or video plus input points or bounding boxes, it predicts segmentation masks for any object of interest.

The architecture is a simple transformer with streaming memory for real-time video processing, trained on a dataset collected with a data engine that improves model and data through user interaction. The paper reports better video segmentation accuracy with 3x fewer interactions than prior approaches, and image segmentation that is more accurate and 6x faster than the original Segment Anything Model.

The Transformers port exposes the pieces separately: a Sam2HieraDetModel image encoder, a Sam2VisionModel, and the full Sam2Model with its prompt encoder and mask decoder. Most of the members traced here are that Hiera encoder alone, as timm packages it; one member is the full Sam2Model built from a default configuration.

Key idea. Promptable segmentation extended from images to video with a streaming-memory transformer and a data engine.

  • sam2
  • sam 2
  • sam2.1
  • segment anything model 2
  • segment anything
  • segment anything in images and videos
  • promptable segmentation
  • hiera
  • hieradet
  • sam2_hiera_tiny
  • sam2_hiera_large
  • mask generation
  • video segmentation
  • meta

AI-written summary, based on the model's documentation and checked automatically against it; not reviewed by a person. Corrections welcome.