How to use from the
Use from the
sam2 library
# Gated model: Login with a HF token with gated access permission
hf auth login
# Use SAM2 with images
import torch
from sam2.sam2_image_predictor import SAM2ImagePredictor

predictor = SAM2ImagePredictor.from_pretrained("Inseop97/mp-segmentation-models")

with torch.inference_mode(), torch.autocast("cuda", dtype=torch.bfloat16):
    predictor.set_image(<your_image>)
    masks, _, _ = predictor.predict(<input_prompts>)
# Use SAM2 with videos
import torch
from sam2.sam2_video_predictor import SAM2VideoPredictor

predictor = SAM2VideoPredictor.from_pretrained("Inseop97/mp-segmentation-models")

with torch.inference_mode(), torch.autocast("cuda", dtype=torch.bfloat16):
    state = predictor.init_state(<your_video>)

    # add new prompts and instantly get the output on the same frame
    frame_idx, object_ids, masks = predictor.add_new_points(state, <your_prompts>)

    # propagate the prompts to get masklets throughout the video
    for frame_idx, object_ids, masks in predictor.propagate_in_video(state):
        ...

You need to agree to share your Hugging Face information to access this model

This repository is publicly accessible, but you have to accept the conditions to access its files and content.

Log in or Sign Up to review the conditions and access this model content.

Microplastic segmentation models

This access-controlled repository stores the YOLO checkpoints used by the microplastic microscopy pipeline in https://github.com/Inseop97/mp-segmentation.

Deployment checkpoint

yolo11n_detector/model_deployment.pt

The deployment detector was trained on all curated detection data after model selection. It localizes particles as a single class. During inference, each box is passed to SAM2 as a prompt; circularity, aspect ratio, and normalized width are then extracted from the mask and classified with the Logistic Regression model distributed in the GitHub repository.

Deployment-training metrics are diagnostic and must not be reported as generalization performance.

Manuscript checkpoints

paper_checkpoints/
β”œβ”€β”€ yolo11n_seg/fold0..fold4/
└── yolo11n_detector_sam/fold0..fold4/

Each fold directory contains best.pt and eval_summary.json. These held-out fold checkpoints reproduce the manuscript comparison between the YOLO11n-seg baseline and the YOLO11n detector β†’ box-prompted SAM2 pipeline.

Download the deployment checkpoint:

python scripts/download_models.py

Download all manuscript checkpoints:

python scripts/download_models.py --paper-checkpoints

Authenticate first with hf auth login using an account that has access.

Intended use and limitations

These checkpoints are intended for microscopy images prepared consistently with the study protocol. Performance can degrade for very small, blurred, overlapping, or strongly out-of-distribution particles. The morphology-based PS, PP, and PET output does not replace chemical polymer identification.

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