MP-SAM2

Fine-tuned models for A Multi-Prompt Transfer Learning Framework Based on Segment Anything Model 2 for Microcrack Segmentation in Engineered Cementitious Composite Images and Videos.

Source and installation · Training settings · Model architecture

MP-SAM2 combines an automatic threshold mask, SP-Box, and EDT positive/negative point prompts with progressive SAM2 transfer learning. The GitHub repository provides training, image inference, video propagation, and evaluation scripts.

Checkpoints

File Training images
mp_sam2_5.torch 5
mp_sam2_10.torch 10
mp_sam2_50.torch 50
mp_sam2_full.torch 186 (full data)

Each file is approximately 898 MB and contains the complete model state for the bundled sam2_hiera_l.yaml architecture. Each file is an individual trained model; the paper's few-shot results summarize repeated training runs. A 20-image checkpoint is not included. SHA256SUMS lists the file hashes.

Usage

Follow the source installation instructions. From the source repository root:

python scripts/download_checkpoints.py --variant full

python scripts/infer_image.py \
  --input path/to/image.png \
  --checkpoint checkpoints/mp_sam2_full.torch \
  --config configs/prompt.yaml \
  --output outputs/image

Use --variant 5, 10, 50, or all for other checkpoints. Direct downloads are also linked above. The download helper verifies MP-SAM2 file checksums.

Training and video inference also need Meta's original SAM2.1 Hiera Large checkpoint. Download it into checkpoints/ with:

python scripts/download_checkpoints.py --variant full --include-base

The transfer loader selects matching SAM2.1 tensors for the bundled MP-SAM2 architecture, excluding SAM2.1-specific spatial and pointer-projection heads. Use this repository's runtime and configuration with these weights. The files are custom PyTorch state dictionaries loaded by the MP-SAM2 scripts; a Transformers AutoModel interface is not supplied.

configs/prompt.yaml controls automatic prompts for image inference and the first video frame. configs/fewshot.yaml and configs/full.yaml control the respective training schedules. Full instructions, data layout, and evaluation commands are in the README.

Scope and license

The intended application is microcrack segmentation in engineered cementitious composite images and laboratory videos. The original Meta checkpoint is obtained from upstream.

The four fine-tuned files are distributed under Apache License 2.0. See LICENSE and the upstream SAM2 attribution in NOTICE. Citation metadata is provided in the source repository's CITATION.cff.

Downloads last month
-
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support