Replace colour model with binary lesion model v0.2.0
Browse filesFinal 51-epoch model trained on all 1,465 images; outputs background/lesion only.
Files changed (3)
- README.md+32-36
- config.json+20-10
- model.safetensors+2-2
5 unmodified lines678991011121 unmodified line1415161718191718192021212222232425262627282829303129303132333436353637394041424338394041424950434445464748495550515253545559606162565764585960616266676869636465667167686970737475767771727374757677787980818682838485868788895 unmodified linestags: - medical-imaging - cervical - semantic-segmentation - binary-segmentation - dinov3 - dpt - wtconv1 unmodified line
# CervicalSeg
CervicalSeg is a four-class semantic segmentation model for cervical colposcopy images. It combinesa DINOv3 ViT-S/16 backbone, a DPT decoder, and WTConv in the final two high-resolution decoderfusion stages.CervicalSeg is a binary lesion segmentation model for cervical colposcopy images. It combines aDINOv3 ViT-S/16 backbone, a DPT decoder, and WTConv in the final two high-resolution decoder fusionstages. It predicts the lesion region only and does not classify red, blue, or green annotationcategories.
宫颈阴道镜图像四分类语义分割模型,采用 DINOv3 ViT-S/16、DPT 解码器,并在最后两个高分辨率融合阶段使用 WTConv。CervicalSeg 是宫颈阴道镜图像二分类病灶分割模型,采用 DINOv3 ViT-S/16、DPT 解码器,并在最后两个高分辨率融合阶段使用 WTConv。模型只预测病灶区域,不再区分红、蓝、绿标注类别。
## Classes / 类别
| Index | Class | Colour || Index | Class | Meaning ||---:|---|---|| 0 | background | black || 1 | blue | blue || 2 | green | green || 3 | red | red || 0 | background | non-lesion region / 非病灶区域 || 1 | lesion | lesion region / 病灶区域 |
## Usage / 使用方法
```bashpip install cervicalsegpip install "cervicalseg>=0.2.0"```
Use `cervicalseg>=0.1.1` for compatibility with both Transformers 4.56+ and 5.x DINOv3 modulelayouts.
请使用 `cervicalseg>=0.1.1`,以兼容 Transformers 4.56+ 与 5.x 的两种 DINOv3 模块命名。
```pythonfrom 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.mask contains only 0=background and 1=lesion.result.save_mask("mask.png") # binary PNG containing 0 and 255result.save_overlay("overlay.jpg")```
The first call downloads `model.safetensors`; later calls reuse the Hugging Face cache. Output masksare restored to the original image size.are restored to the original image size. The single overlay colour is for visualization only and isnot a lesion subtype.
首次调用会下载 `model.safetensors`,后续调用复用 Hugging Face 缓存。输出 mask 会恢复到原图尺寸。叠加图中的单一颜色仅用于显示病灶范围,不代表病灶类别。
## Evaluation / 评估结果
The data were split at the patient level to prevent patient leakage between train, validation, andtest sets.## Training and evaluation / 训练与评估
数据按患者划分,避免同一患者同时出现在训练、验证或测试集合中。The public v0.2.0 checkpoint was trained for 51 epochs on all 1,465 available images: 1,028 from theoriginal training split, 221 from validation, and 216 from test. All non-background annotations weremerged into one lesion label. Because all samples were used to fit the final model, no held-out testmetric applies to this public checkpoint.
| Split | Samples | Foreground mIoU | Foreground Dice | Pixel accuracy ||---|---:|---:|---:|---:|| Validation | 221 | 0.4075 | 0.5704 | 0.9121 || Test | 216 | 0.3633 | 0.5296 | 0.8891 |公开的 v0.2.0 权重使用全部 1,465 张图像训练 51 个 epoch,其中原 train/val/test 分别为1,028/221/216 张。所有非背景标注合并为一个病灶标签。由于最终模型使用了全部样本训练,因此该公开权重没有独立测试集指标。
Test-set per-class metrics:For model-development reference only, the separate patient-level validation experiment at epoch 51obtained lesion IoU 0.5847 and lesion Dice 0.7379. These are development results, not an independentevaluation of the all-data public checkpoint.
| 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 |仅供模型开发参考:按患者划分的独立验证实验在第 51 个 epoch 得到病灶 IoU 0.5847、病灶 Dice0.7379;这些结果不是对全量训练公开权重的独立测试。
## 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.- The model detects lesion extent but does not predict lesion grade, pathology, or colour category.- 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 / 许可证122345678678963 unmodified lines7374757879808182837677787980818283848586878889909192939495{ "format_version": 1, "format_version": 2, "model": { "class_names": [ "background", "blue", "green", "red" "lesion" ], "image_size": [ 576,63 unmodified lines }, "checkpoint": { "filename": "model.safetensors", "size_bytes": 96876480, "sha256": "2fdec883d6a94b7a3478a750f6943bb41b60abcb8316649bd8a050f9bd3e5f4d", "training_epoch": 66, "best_validation_miou_foreground": 0.40750709018075176, "test_miou_foreground": 0.3633164423801378, "test_mean_dice_foreground": 0.5295766998594339 "size_bytes": 96875968, "sha256": "2322f48bf36f0fdf77f090c5621c8d31aa6892b51000d40e42f7f43b23c29b98", "training_epoch": 51, "checkpoint_selection": "final_epoch", "training_splits": [ "train", "val", "test" ], "training_sample_counts": { "train": 1028, "val": 221, "test": 216 }, "training_samples_total": 1465, "final_training_loss": 0.08957859227885158, "development_validation_foreground_iou_epoch_51": 0.5847087461680525, "development_validation_foreground_dice_epoch_51": 0.7379384351628312 }}12323version https://git-lfs.github.com/spec/v1oid sha256:2fdec883d6a94b7a3478a750f6943bb41b60abcb8316649bd8a050f9bd3e5f4dsize 96876480oid sha256:2322f48bf36f0fdf77f090c5621c8d31aa6892b51000d40e42f7f43b23c29b98size 96875968README.md+32-36
config.json+20-10
model.safetensors+2-2