Cervical colour segmentation with DINOv3, DPT, and WTConv
Project description
CervicalSeg
Inference-only cervical colour segmentation using DINOv3 ViT-S/16, DPT, and WTConv.
Classes are background, blue, green, and red. This package is intended for research use and
is not a clinical diagnostic device.
Local installation
pip install -e .
The source checkout automatically finds weights/model.safetensors. After the public release, an
installed wheel downloads the versioned weights from PlanetSMH/CervicalSeg automatically. A local
weights file can also be selected explicitly:
from cervicalseg import CervicalSeg
segmenter = CervicalSeg(weights_path="/path/to/model.safetensors")
result = segmenter.predict("image.jpg")
result.save_mask("mask.png")
result.save_color_mask("color_mask.png")
result.save_overlay("overlay.jpg")
result.mask is an H x W uint8 NumPy array restored to the original image size. Class indices are
0=background, 1=blue, 2=green, and 3=red.
Batch inference
results = segmenter.predict_batch(
["a.jpg", "b.jpg"],
batch_size=2,
return_probabilities=False,
)
Input may be a path, a PIL RGB image, or an H x W x 3 RGB NumPy array. Set
return_probabilities=True to populate result.probabilities with a 4 x H x W float32 array.
Command line
cervicalseg image1.jpg image2.jpg \
--weights /path/to/model.safetensors \
--output results
Hugging Face weights
Published weights are downloaded automatically and pinned to the package version:
segmenter = CervicalSeg()
# Explicit repository selection is also supported.
segmenter = CervicalSeg(repo_id="PlanetSMH/CervicalSeg", revision="v0.1.0")
Downloaded assets are cached by huggingface_hub. CERVICALSEG_WEIGHTS may be set to a local
weights path for offline use.
Build the package
python -m build
python -m twine check dist/*
The Python distributions contain inference code and license notices only. Model weights are published separately on Hugging Face Hub.
Third-party notices
The trained weights contain DINOv3 materials distributed under the DINOv3 License. WTConv-derived
code is used under the MIT License. Copies are provided in licenses/.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cervicalseg-0.1.0.tar.gz.
File metadata
- Download URL: cervicalseg-0.1.0.tar.gz
- Upload date:
- Size: 14.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a0dc4bd99f74e0a4b6900d19c84ba69547ddae099799d3e670251e882e8bb6d2
|
|
| MD5 |
f4dd84779fffe9fa2293ece5eab36ddf
|
|
| BLAKE2b-256 |
22b30b13a93126255fb6fdcefd3f2252e64c7b8a2e92da42d5f68ecb26767baa
|
File details
Details for the file cervicalseg-0.1.0-py3-none-any.whl.
File metadata
- Download URL: cervicalseg-0.1.0-py3-none-any.whl
- Upload date:
- Size: 15.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
60ab656552cda1a0e1cc621cc6237330e6f95d8242a88dd29401058539a0e43e
|
|
| MD5 |
cfad8232ef1b4330d06283edeaaca247
|
|
| BLAKE2b-256 |
162a40402469d3622d148f2da57c7df83b2f729c97116e5e74b27416055c6355
|