PlanetSMH commited on
Commit
1d79699
·
verified ·
1 Parent(s): f2244a2

Release CervicalSeg v0.1.0 weights and model card

Browse files
Files changed (6) hide show
  1. DINOV3_LICENSE.md +66 -0
  2. LICENSE +21 -0
  3. README.md +99 -0
  4. WTCONV_LICENSE +21 -0
  5. config.json +85 -0
  6. model.safetensors +3 -0
DINOV3_LICENSE.md ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # DINOv3 License
2
+
3
+ *Last Updated: August 19, 2025*
4
+
5
+ **“Agreement”** means the terms and conditions for use, reproduction, distribution and modification of the DINO Materials set forth herein.
6
+
7
+ **“DINO Materials”** means, collectively, Documentation and the models, software and algorithms, including machine-learning model code, trained model weights, inference-enabling code, training-enabling code, fine-tuning enabling code, and other elements of the foregoing distributed by Meta and made available under this Agreement.
8
+
9
+ **“Documentation”** means the specifications, manuals and documentation accompanying
10
+ DINO Materials distributed by Meta.
11
+
12
+ **“Licensee”** or **“you”** means you, or your employer or any other person or entity (if you are entering into this Agreement on such person or entity’s behalf), of the age required under applicable laws, rules or regulations to provide legal consent and that has legal authority to bind your employer or such other person or entity if you are entering in this Agreement on their behalf.
13
+
14
+ **“Meta”** or **“we”** means Meta Platforms Ireland Limited (if you are located in or, if you are an entity, your principal place of business is in the EEA or Switzerland) or Meta Platforms, Inc. (if you are located outside of the EEA or Switzerland).
15
+
16
+ **“Sanctions”** means any economic or trade sanctions or restrictions administered or enforced by the United States (including the Office of Foreign Assets Control of the U.S. Department of the Treasury (“OFAC”), the U.S. Department of State and the U.S. Department of Commerce), the United Nations, the European Union, or the United Kingdom.
17
+
18
+ **“Trade Controls”** means any of the following: Sanctions and applicable export and import controls.
19
+
20
+ By clicking “I Accept” below or by using or distributing any portion or element of the DINO Materials, you agree to be bound by this Agreement.
21
+
22
+ ## 1. License Rights and Redistribution.
23
+
24
+ a. <ins>Grant of Rights</ins>. You are granted a non-exclusive, worldwide, non-transferable and royalty-free limited license under Meta’s intellectual property or other rights owned by Meta embodied in the DINO Materials to use, reproduce, distribute, copy, create derivative works of, and make modifications to the DINO Materials.
25
+
26
+ b. <ins>Redistribution and Use</ins>.
27
+
28
+ i. Distribution of DINO Materials, and any derivative works thereof, are subject to the terms of this Agreement. If you distribute or make the DINO Materials, or any derivative works thereof, available to a third party, you may only do so under the terms of this Agreement and you shall provide a copy of this Agreement with any such DINO Materials.
29
+
30
+ ii. If you submit for publication the results of research you perform on, using, or otherwise in connection with DINO Materials, you must acknowledge the use of DINO Materials in your publication.
31
+
32
+ iii. Your use of the DINO Materials must comply with applicable laws and regulations, including Trade Control Laws and applicable privacy and data protection laws.
33
+
34
+ iv. Your use of the DINO Materials will not involve or encourage others to reverse engineer, decompile or discover the underlying components of the DINO Materials.
35
+
36
+ v. You are not the target of Trade Controls and your use of DINO Materials must comply with Trade Controls. You agree not to use, or permit others to use, DINO Materials for any activities subject to the International Traffic in Arms Regulations (ITAR) or end uses prohibited by Trade Controls, including those related to military or warfare purposes, nuclear industries or applications, espionage, or the development or use of guns or illegal weapons.
37
+
38
+ ## 2. User Support.
39
+
40
+ Your use of the DINO Materials is done at your own discretion; Meta does not process any information nor provide any service in relation to such use. Meta is under no obligation to provide any support services for the DINO Materials. Any support provided is “as is”, “with all faults”, and without warranty of any kind.
41
+
42
+ ## 3. Disclaimer of Warranty.
43
+
44
+ UNLESS REQUIRED BY APPLICABLE LAW, THE DINO MATERIALS AND ANY OUTPUT AND RESULTS THEREFROM ARE PROVIDED ON AN “AS IS” BASIS, WITHOUT WARRANTIES OF ANY KIND, AND META DISCLAIMS ALL WARRANTIES OF ANY KIND, BOTH EXPRESS AND IMPLIED, INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. YOU ARE SOLELY RESPONSIBLE FOR DETERMINING THE APPROPRIATENESS OF USING OR REDISTRIBUTING THE DINO MATERIALS AND ASSUME ANY RISKS ASSOCIATED WITH YOUR USE OF THE DINO MATERIALS AND ANY OUTPUT AND RESULTS.
45
+
46
+ ## 4. Limitation of Liability.
47
+
48
+ IN NO EVENT WILL META OR ITS AFFILIATES BE LIABLE UNDER ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, TORT, NEGLIGENCE, PRODUCTS LIABILITY, OR OTHERWISE, ARISING OUT OF THIS AGREEMENT, FOR ANY LOST PROFITS OR ANY DIRECT OR INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL, EXEMPLARY OR PUNITIVE DAMAGES, EVEN IF META OR ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF ANY OF THE FOREGOING.
49
+
50
+ ## 5. Intellectual Property.
51
+
52
+ a. Subject to Meta’s ownership of DINO Materials and derivatives made by or for Meta, with respect to any derivative works and modifications of the DINO Materials that are made by you, as between you and Meta, you are and will be the owner of such derivative works and modifications.
53
+
54
+ b. If you institute litigation or other proceedings against Meta or any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the DINO Materials, outputs or results, or any portion of any of the foregoing, constitutes infringement of intellectual property or other rights owned or licensable by you, then any licenses granted to you under this Agreement shall terminate as of the date such litigation or claim is filed or instituted. You will indemnify and hold harmless Meta from and against any claim by any third party arising out of or related to your use or distribution of the DINO Materials.
55
+
56
+ ## 6. Term and Termination.
57
+
58
+ The term of this Agreement will commence upon your acceptance of this Agreement or access to the DINO Materials and will continue in full force and effect until terminated in accordance with the terms and conditions herein. Meta may terminate this Agreement if you are in breach of any term or condition of this Agreement. Upon termination of this Agreement, you shall delete and cease use of the DINO Materials. Sections 3, 4 and 7 shall survive the termination of this Agreement.
59
+
60
+ ## 7. Governing Law and Jurisdiction.
61
+
62
+ This Agreement will be governed and construed under the laws of the State of California without regard to choice of law principles, and the UN Convention on Contracts for the International Sale of Goods does not apply to this Agreement. The courts of California shall have exclusive jurisdiction of any dispute arising out of this Agreement.
63
+
64
+ ## 8. Modifications and Amendments.
65
+
66
+ Meta may modify this Agreement from time to time; provided that they are similar in spirit to the current version of the Agreement, but may differ in detail to address new problems or concerns. All such changes will be effective immediately. Your continued use of the DINO Materials after any modification to this Agreement constitutes your agreement to such modification. Except as provided in this Agreement, no modification or addition to any provision of this Agreement will be binding unless it is in writing and signed by an authorized representative of both you and Meta.
LICENSE ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Shi Minghai
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
README.md ADDED
@@ -0,0 +1,99 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: other
3
+ license_name: dinov3-license
4
+ pipeline_tag: image-segmentation
5
+ library_name: cervicalseg
6
+ tags:
7
+ - medical-imaging
8
+ - cervical
9
+ - semantic-segmentation
10
+ - dinov3
11
+ - dpt
12
+ - wtconv
13
+ ---
14
+
15
+ # CervicalSeg
16
+
17
+ CervicalSeg is a four-class semantic segmentation model for cervical colposcopy images. It combines
18
+ a DINOv3 ViT-S/16 backbone, a DPT decoder, and WTConv in the final two high-resolution decoder
19
+ fusion stages.
20
+
21
+ 宫颈阴道镜图像四分类语义分割模型,采用 DINOv3 ViT-S/16、DPT 解码器,并在最后两个高分辨率
22
+ 融合阶段使用 WTConv。
23
+
24
+ ## Classes / 类别
25
+
26
+ | Index | Class | Colour |
27
+ |---:|---|---|
28
+ | 0 | background | black |
29
+ | 1 | blue | blue |
30
+ | 2 | green | green |
31
+ | 3 | red | red |
32
+
33
+ ## Usage / 使用方法
34
+
35
+ ```bash
36
+ pip install cervicalseg
37
+ ```
38
+
39
+ ```python
40
+ from cervicalseg import CervicalSeg
41
+
42
+ segmenter = CervicalSeg(device="auto")
43
+ result = segmenter.predict("image.jpg")
44
+ result.save_mask("mask.png")
45
+ result.save_color_mask("color_mask.png")
46
+ result.save_overlay("overlay.jpg")
47
+ ```
48
+
49
+ The first call downloads `model.safetensors`; later calls reuse the Hugging Face cache. Output masks
50
+ are restored to the original image size.
51
+
52
+ 首次调用会下载 `model.safetensors`,后续调用复用 Hugging Face 缓存。输出 mask 会恢复到原图尺寸。
53
+
54
+ ## Evaluation / 评估结果
55
+
56
+ The data were split at the patient level to prevent patient leakage between train, validation, and
57
+ test sets.
58
+
59
+ 数据按患者划分,避免同一患者同时出现在训练、验证或测试集合中。
60
+
61
+ | Split | Samples | Foreground mIoU | Foreground Dice | Pixel accuracy |
62
+ |---|---:|---:|---:|---:|
63
+ | Validation | 221 | 0.4075 | 0.5704 | 0.9121 |
64
+ | Test | 216 | 0.3633 | 0.5296 | 0.8891 |
65
+
66
+ Test-set per-class metrics:
67
+
68
+ | Class | Precision | Recall | Dice | IoU |
69
+ |---|---:|---:|---:|---:|
70
+ | blue | 0.5651 | 0.5697 | 0.5674 | 0.3961 |
71
+ | green | 0.3784 | 0.4950 | 0.4289 | 0.2730 |
72
+ | red | 0.6850 | 0.5219 | 0.5924 | 0.4209 |
73
+
74
+ ## Intended use and limitations / 用途与限制
75
+
76
+ - Research use only.
77
+ - Not a medical device and not for clinical diagnosis or treatment decisions.
78
+ - Predictions require review by qualified professionals.
79
+ - Performance may not generalize to devices, institutions, populations, or acquisition conditions
80
+ not represented in the training data.
81
+ - Green-region segmentation is the weakest class in the reported test results.
82
+
83
+ - 仅用于研究。
84
+ - 不是医疗器械,不得直接用于临床诊断或治疗决策。
85
+ - 预测结果需要由具备资质的专业人员复核。
86
+ - 对训练数据未覆盖的设备、机构、人群和采集条件,模型性能可能下降。
87
+
88
+ ## License / 许可证
89
+
90
+ The CervicalSeg Python wrapper is released under the MIT License. The trained weights contain
91
+ DINOv3 materials and are distributed under the DINOv3 License included as `DINOV3_LICENSE.md`.
92
+ WTConv-derived code retains its MIT notice in `WTCONV_LICENSE`.
93
+
94
+ CervicalSeg Python 封装代码采用 MIT License。训练权重包含 DINOv3 材料,权重分发遵循仓库中的
95
+ `DINOV3_LICENSE.md`。WTConv 衍生代码保留其 MIT 许可声明。
96
+
97
+ ## Author
98
+
99
+ Shi Minghai (`PlanetSMH`)
WTCONV_LICENSE ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Shahaf Finder, Roy Amoyal, Eran Treister, Oren Freifeld
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
config.json ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "format_version": 1,
3
+ "model": {
4
+ "class_names": [
5
+ "background",
6
+ "blue",
7
+ "green",
8
+ "red"
9
+ ],
10
+ "image_size": [
11
+ 576,
12
+ 768
13
+ ],
14
+ "image_mean": [
15
+ 0.485,
16
+ 0.456,
17
+ 0.406
18
+ ],
19
+ "image_std": [
20
+ 0.229,
21
+ 0.224,
22
+ 0.225
23
+ ],
24
+ "padding_color": [
25
+ 124,
26
+ 116,
27
+ 104
28
+ ],
29
+ "hidden_state_indices": [
30
+ 3,
31
+ 6,
32
+ 9,
33
+ 12
34
+ ],
35
+ "dpt_features": 64,
36
+ "dpt_channels": [
37
+ 48,
38
+ 96,
39
+ 192,
40
+ 384
41
+ ],
42
+ "wt_kernel_size": 5,
43
+ "wt_levels": 2,
44
+ "wt_type": "db1",
45
+ "backbone": {
46
+ "model_type": "dinov3_vit",
47
+ "architectures": [
48
+ "DINOv3ViTModel"
49
+ ],
50
+ "attention_dropout": 0.0,
51
+ "drop_path_rate": 0.0,
52
+ "hidden_act": "gelu",
53
+ "hidden_size": 384,
54
+ "image_size": 224,
55
+ "initializer_range": 0.02,
56
+ "intermediate_size": 1536,
57
+ "key_bias": false,
58
+ "layer_norm_eps": 1e-05,
59
+ "layerscale_value": 1.0,
60
+ "mlp_bias": true,
61
+ "num_attention_heads": 6,
62
+ "num_channels": 3,
63
+ "num_hidden_layers": 12,
64
+ "num_register_tokens": 4,
65
+ "patch_size": 16,
66
+ "pos_embed_jitter": null,
67
+ "pos_embed_rescale": 2.0,
68
+ "pos_embed_shift": null,
69
+ "proj_bias": true,
70
+ "query_bias": true,
71
+ "rope_theta": 100.0,
72
+ "use_gated_mlp": false,
73
+ "value_bias": true
74
+ }
75
+ },
76
+ "checkpoint": {
77
+ "filename": "model.safetensors",
78
+ "size_bytes": 96876480,
79
+ "sha256": "2fdec883d6a94b7a3478a750f6943bb41b60abcb8316649bd8a050f9bd3e5f4d",
80
+ "training_epoch": 66,
81
+ "best_validation_miou_foreground": 0.40750709018075176,
82
+ "test_miou_foreground": 0.3633164423801378,
83
+ "test_mean_dice_foreground": 0.5295766998594339
84
+ }
85
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2fdec883d6a94b7a3478a750f6943bb41b60abcb8316649bd8a050f9bd3e5f4d
3
+ size 96876480