--- license: other license_name: dinov3-license pipeline_tag: image-segmentation library_name: cervicalseg tags: - medical-imaging - cervical - semantic-segmentation - dinov3 - dpt - wtconv --- # CervicalSeg CervicalSeg is a four-class semantic segmentation model for cervical colposcopy images. It combines a DINOv3 ViT-S/16 backbone, a DPT decoder, and WTConv in the final two high-resolution decoder fusion stages. 宫颈阴道镜图像四分类语义分割模型,采用 DINOv3 ViT-S/16、DPT 解码器,并在最后两个高分辨率 融合阶段使用 WTConv。 ## Classes / 类别 | Index | Class | Colour | |---:|---|---| | 0 | background | black | | 1 | blue | blue | | 2 | green | green | | 3 | red | red | ## Usage / 使用方法 ```bash pip install cervicalseg ``` ```python from cervicalseg import CervicalSeg segmenter = CervicalSeg(device="auto") result = segmenter.predict("image.jpg") result.save_mask("mask.png") result.save_color_mask("color_mask.png") result.save_overlay("overlay.jpg") ``` The first call downloads `model.safetensors`; later calls reuse the Hugging Face cache. Output masks are restored to the original image size. 首次调用会下载 `model.safetensors`,后续调用复用 Hugging Face 缓存。输出 mask 会恢复到原图尺寸。 ## Evaluation / 评估结果 The data were split at the patient level to prevent patient leakage between train, validation, and test sets. 数据按患者划分,避免同一患者同时出现在训练、验证或测试集合中。 | Split | Samples | Foreground mIoU | Foreground Dice | Pixel accuracy | |---|---:|---:|---:|---:| | Validation | 221 | 0.4075 | 0.5704 | 0.9121 | | Test | 216 | 0.3633 | 0.5296 | 0.8891 | Test-set per-class metrics: | Class | Precision | Recall | Dice | IoU | |---|---:|---:|---:|---:| | blue | 0.5651 | 0.5697 | 0.5674 | 0.3961 | | green | 0.3784 | 0.4950 | 0.4289 | 0.2730 | | red | 0.6850 | 0.5219 | 0.5924 | 0.4209 | ## Intended use and limitations / 用途与限制 - Research use only. - Not a medical device and not for clinical diagnosis or treatment decisions. - Predictions require review by qualified professionals. - Performance may not generalize to devices, institutions, populations, or acquisition conditions not represented in the training data. - Green-region segmentation is the weakest class in the reported test results. - 仅用于研究。 - 不是医疗器械,不得直接用于临床诊断或治疗决策。 - 预测结果需要由具备资质的专业人员复核。 - 对训练数据未覆盖的设备、机构、人群和采集条件,模型性能可能下降。 ## License / 许可证 The CervicalSeg Python wrapper is released under the MIT License. The trained weights contain DINOv3 materials and are distributed under the DINOv3 License included as `DINOV3_LICENSE.md`. WTConv-derived code retains its MIT notice in `WTCONV_LICENSE`. CervicalSeg Python 封装代码采用 MIT License。训练权重包含 DINOv3 材料,权重分发遵循仓库中的 `DINOV3_LICENSE.md`。WTConv 衍生代码保留其 MIT 许可声明。 ## Author Shi Minghai (`PlanetSMH`)