Downloads · 30 days
0
MEIPork/kidney-tubule-cpsam
kidney-tubule-cpsam is a image segmentation model from MEIPork. Use it for the image segmentation task on the model card, and read the license before you ship it in a product. The card lists the license as mit.
基于 CellPose + CPSAM (SAM ViT-L) 的肾小管自动分割与近端/远端分类模型。
Downloads · 30 days
0
Access
Public
Updated Jul 3, 2026
Repo size
1.3 GB
Likes
0
Public
Click a slice to open those files.
Other1.2 GB · 96%
From the Hugging Face model README
基于 CellPose + CPSAM (SAM ViT-L) 的肾小管自动分割与近端/远端分类模型。
本仓库包含两个模型:
| 模型 | 架构 | 大小 | 用途 |
|---|---|---|---|
cpsam_v2_fold3/best_model | CPSAM (SAM ViT-L + CellPose) | 1.22 GB | 肾小管实例分割 |
classifier/cnn_classifier_fold0.pth | ResNet18 | 43 MB | 近端/远端分类 |
5-fold 交叉验证,46 张 H&E 染色肾组织图像:
| 指标 | 5-fold 均值 | 最佳 Fold (fold 3) |
|---|---|---|
| IoU | 0.844 | 0.858 |
| Dice | 0.914 | 0.923 |
| mIoU | 0.678 | 0.708 |
| [email protected] | 0.845 ± 0.017 | 0.871 |
最佳单图 [email protected]: 0.964 (Captured 32, fold 0)
conda create -n cellpose python=3.10
conda activate cellpose
pip install cellpose==4.2.1 torch opencv-python numpy huggingface_hub
huggingface-cli download MEIPork/kidney-tubule-cpsam --local-dir models/
国内网络:
export HF_ENDPOINT=https://hf-mirror.com
from cellpose import models
import cv2, numpy as np
# 加载分割模型
model = models.CellposeModel(
gpu=True,
pretrained_model='models/cpsam_v2_fold3/best_model'
)
# 推理
img = cv2.imread('kidney_section.jpg')
masks, flows, styles = model.eval(
img,
diameter=414,
flow_threshold=0.3,
cellprob_threshold=-0.5,
channels=[0, 0]
)
或使用项目配套脚本:
python predict_tubule.py \
--img_dir data/test_images \
--seg_model models/cpsam_v2_fold3/best_model \
--cls_model models/classifier/cnn_classifier_fold0.pth \
--out_dir results/output \
--flow_threshold 0.3 \
--cellprob_threshold -0.5
*_classified.png — 分割+分类叠加图(红=近端,蓝=远端)*_analysis.csv — 每实例的类别、置信度、面积、bboxsummary.json — 批次汇总| 参数 | 推荐值 | 说明 |
|---|---|---|
flow_threshold | 0.3 | 越低越敏感(更多细小结构) |
cellprob_threshold | -0.5 | 越低 mask 越大 |
diameter | 414 | 肾小管平均直径 (px) |
GitHub: MEIPork1/kidney_tubule_seg