Skip to content
ModelListedExternal
Browse files

DepthPolyp

DepthPolyp is a lightweight pseudo-depth guided model for real-time colonoscopic polyp segmentation. Given an RGB colonoscopy frame, it jointly predicts:

KindOtherVersionRevision 671b796Bgrade

Model source

Kind
Other
File size
13.7–13.9 MB
Version
vRevision 671b796
Updated
Nov 1, 2026
Downloads
16
Source
Hugging Face

Source description

DepthPolyp: Pseudo-Depth Guided Lightweight Segmentation for Real-Time Colonoscopy

DepthPolyp is a lightweight pseudo-depth guided model for real-time colonoscopic polyp segmentation. Given an RGB colonoscopy frame, it jointly predicts:

  1. a binary polyp segmentation probability map
  2. a pseudo-depth probability map for depth-aware structural guidance

The model uses a MiT-B0 encoder and lightweight fusion/gating modules to keep deployment cost low while improving robustness under blur, illumination changes, reflections, and other real-world colonoscopy degradations.

Model Details

ItemValue
ModelDepthPolyp
EncoderMiT-B0
InputRGB image, 224 x 224
Outputssegmentation, pseudo-depth
Parameters3.57M
Complexity0.86 GMACs
Training dataKvasir-SEG with degradation-aware training
PyTorch checkpointDepthPolyp_Kvasir.pth
ONNX checkpointDepthPolyp_Kvasir.onnx

ONNX I/O names:

input: image
outputs: segmentation, depth

Intended Use

DepthPolyp is intended for research on colonoscopic polyp segmentation, lightweight medical image segmentation, robustness under endoscopic video degradation, and deployment-oriented model comparison.

This model is not a standalone medical device and is not intended for clinical diagnosis without appropriate validation, regulatory review, and expert oversight.

Quick Start: ONNX Runtime

pip install onnxruntime pillow numpy

python scripts/infer_onnx.py \
  --onnx DepthPolyp_Kvasir.onnx \
  --input samples/kvasir/images \
  --output outputs

The script writes binary masks, pseudo-depth visualizations, and mask overlays.

Quick Start: PyTorch

pip install torch torchvision pillow numpy
import torch
from PIL import Image
from torchvision import transforms

from model.depthpolyp import build_depthpolyp

device = "cuda" if torch.cuda.is_available() else "cpu"

model = build_depthpolyp(
    encoder_name="b0",
    in_channels=3,
    num_classes=2,
    decoder_channels=256,
    activation=None,
)
state_dict = torch.load("DepthPolyp_Kvasir.pth", map_location="cpu", weights_only=True)
model.load_state_dict(state_dict, strict=True)
model.to(device).eval()

image = Image.open("samples/kvasir/images/sample_01.jpg").convert("RGB")
transform = transforms.Compose([
    transforms.Resize((224, 224)),
    transforms.ToTensor(),
])
x = transform(image).unsqueeze(0).to(device)

with torch.no_grad():
    seg_prob, depth_prob = model(x)

print(seg_prob.shape)    # [1, 1, 224, 224]
print(depth_prob.shape)  # [1, 1, 224, 224]

Loading Files with huggingface_hub

from huggingface_hub import hf_hub_download

repo_id = "ReaganWZY/DepthPolyp"
pth_path = hf_hub_download(repo_id=repo_id, filename="DepthPolyp_Kvasir.pth")
onnx_path = hf_hub_download(repo_id=repo_id, filename="DepthPolyp_Kvasir.onnx")

If you publish under a different Hugging Face repo id, replace ReaganWZY/DepthPolyp with that id.

Evaluation

Paper-reported reference results:

ProtocolKvasir Dice/IoU/RecallClinicDB Dice/IoU/RecallColonDB Dice/IoU/Recall
N->C0.891 / 0.805 / 0.8850.854 / 0.748 / 0.8450.801 / 0.669 / 0.759
N->N0.853 / 0.745 / 0.8540.751 / 0.608 / 0.7590.734 / 0.582 / 0.697

Real-world robustness and deployment results from the paper:

ParamsGMACsAvg. DicePolypGen DiceiPhone FPSRaspberry Pi 4 FPS
3.57M0.860.7790.679181.544.05

Training Data and Protocol

The released checkpoint is trained on Kvasir-SEG with degradation-aware training. Pseudo-depth targets are generated with Depth-Anything v2 Small and are used only during training; depth targets are not required at inference time.

Reference training settings from the paper:

  • Input resolution: 224 x 224
  • Optimizer: AdamW
  • Learning rate: 1e-4
  • Weight decay: 1e-4
  • Batch size: 16
  • Epochs: 200
  • Schedule: 10% warm-up followed by cosine annealing

Citation

@misc{wu2026depthpolyp,
  title={DepthPolyp: Pseudo-Depth Guided Lightweight Segmentation for Real-Time Colonoscopy},
  author={Wu, Zhuoyu and Ou, Wenhui and Zhang, Lexi and Tan, Pei-Sze and Wu, Dongjun and Zhao, Junhe and Fang, Wenqi and Phan, Raphaël C.-W.},
  year={2026},
  eprint={2605.16519},
  archivePrefix={arXiv},
  primaryClass={cs.CV}
}

Sources

1 source
Hugging FacePrimaryVersion 671b796f6283bc242b8b0e20e21418af6aaae2a1
huggingface.co/ReaganWZY/DepthPolyp/tree/671b796f6283bc242b8b0e20e21418af6aaae2a1

Verified Nov 1

Download files

Repository files

File inventory only; completeness is unverified.

Model artifacts

2 artifacts

DepthPolyp_Kvasir.onnx

onnx · 13.9 MB · SHA-256 883ff8a825a5…9f5b · Hugging Face

Download file

DepthPolyp_Kvasir.pth

pth · 13.7 MB · SHA-256 2bfad787ccc2…6257 · Hugging Face

Download file

Source excerpts

3 excerpts

--- license: mit library_name: pytorch pipeline_tag: image-segmentation tags: - medical-image-segmentation - image-segmentation - semantic-segmentation - polyp-segmentation - colonoscopy - depth-estimation - pseudo-depth - real-time - onnx - pytorch - arxiv:2605.16519 metrics: - dice - iou - recall --- # DepthPolyp: Pseudo-Depth Guided Lightweight Segmentation for Real-Time Colonoscopy DepthPolyp is a lightweight pseudo-depth guided model for real-time colonoscopic polyp segmentation. Given an RGB colonoscopy frame, it jointly predicts: 1. a binary polyp segmentation probability map 2. a pseudo-depth probability map for depth-aware structural guidance The model uses a MiT-B0 encoder and lightweight fusion/gating modules to keep deployment cost low while improving robustness under blur, illumination changes, reflections, and other real-world colonoscopy degradations. - Paper: [arXiv:2605.16519](https://arxiv.org/abs/2605.16519) - Code: [github.com/ReaganWu/DepthPolyp](https://github.com/ReaganWu/DepthPolyp) - Demo: [DepthPolyp-demo](https://huggingface.co/spaces/ReaganWZY/DepthPolyp-demo) - License: MIT ## Model Details | Item | Value | | --- | --- | | Model | DepthPolyp | | Encoder | MiT-B0 | | Input | RGB image, 224 x 224 | | Outputs | segmentation, pseudo-depth | | Parameters | 3.57M | | Complexity | 0.86 GMACs | | Training data | Kvasir-SEG with degradation-aware training | | PyTorch checkpoint | `DepthPolyp_Kvasir.pth` | | ONNX checkpoint | `DepthPolyp_Kvasir.onnx` | ONNX I/O names: ```text input: image outputs: segmentation, depth ``` ## Intended Use DepthPolyp is intended for research on colonoscopic polyp segmentation, lightweight medical image segmentation, robustness under endoscopic video degradation, and deployment-oriented model comparison. This model is not a standalone medical device and is not intended for clinical diagnosis without appropriate validation, regulatory review, and expert oversight. ## Quick Start: ONNX Runtime ```bash pip install onnxruntime pillow numpy python scripts/infer_onnx.py \ --onnx DepthPolyp_Kvasir.onnx \ --input samples/kvasir/images \ --output outputs ``` The script writes binary masks, pseudo-depth visualizations, and mask overlays. ## Quick Start: PyTorch ```bash pip install torch torchvision pillow numpy ``` ```python import torch from PIL import Image from torchvision import transforms...

Source context: 16 downloads · 2 likes · Pipeline image-segmentation · Library pytorch · Repo ReaganWZY/DepthPolyp

Source context: 4 downloads · 1 likes · Pipeline image-segmentation · Library pytorch · Repo ReaganWZY/DepthPolyp