--- library_name: pytorch pipeline_tag: image-segmentation tags: - medical-imaging - ophthalmology - oct - choroid - segmentation - segmentation-models-pytorch - model_hub_mixin - pytorch_model_hub_mixin --- # Choroid segmentation in OCT B-scans Binary segmentation models for the **choroid** in OCT B-scans: the region between Bruch's membrane and the choroid-sclera interface. They are the first stage of the OcularRigidity pipeline: choroid segmentation, then video registration, then pulsation analysis. Each version is on its own branch. **Always load with an explicit `revision`.** Without one you get the weights of `main`, which is the first, legacy model (described below), not the current one. | Revision | Model | Training data | Status | |---|---|---|---| | [`version-3.0.0`](https://huggingface.co/ClementP/ChoroidSegmentationModule/tree/version-3.0.0) | UPerNet, ConvNeXt-Tiny encoder | Annotated in-house set (Zeiss PLEX Elite, Heidelberg Spectralis) + OIMHS | **Current.** Full model card on its branch | | [`version-2.0.0`](https://huggingface.co/ClementP/ChoroidSegmentationModule/tree/version-2.0.0) | SegFormer, MiT-B2 encoder | | Superseded | | `main` | U-Net, SE-ResNet50 encoder | OIMHS only | Legacy, kept for reproducibility | ```python from ocularrigidity.segmentation.trainer.pl_module import ChoroidSegmentationModule model = ChoroidSegmentationModule.from_pretrained( "ClementP/ChoroidSegmentationModule", revision="version-3.0.0" ).eval() ``` The registration model [`ClementP/OCTVideoRegistration`](https://huggingface.co/ClementP/OCTVideoRegistration) reads the encoder features of `version-3.0.0`, so the two must be used together. ## The model on `main` (legacy) The first model of the project, uploaded in May 2026. | | | |---|---| | Architecture | U-Net, SE-ResNet50 encoder (ImageNet init), from `segmentation_models_pytorch` | | Input | 1 channel (grayscale B-scan), normalised as `(x / 255 - 0.5) / 0.5` | | Output | 1 channel of logits; choroid = `logit > 0` | | Training data | [OIMHS](https://www.nature.com/articles/s41597-023-02675-1) only (Heidelberg Spectralis, macular-hole patients, choroid label), 80 / 20 split by patient (seed 42) | | Input scale in training | OIMHS B-scans resized from 496 × 512 to 1024 × 1024, meant to approximate the PLEX Elite pixel size | | Augmentation | Horizontal flip, scale 0.8–1.2 (lateral) and 0.75–1.25 (axial), rotation ±5°, Gaussian noise, brightness and contrast | | Loss | Dice + cross-entropy, plus thickness-smoothness (0.05) and gap-detection (0.05) terms | | Optimiser | AdamW, learning rate 1e-4, weight decay 1e-5, batch size 16, early stopping on validation Dice | | Validation Dice | 0.986, on the OIMHS validation patients only | It never saw a PLEX Elite image in training, and it was evaluated on OIMHS only. Its Dice cannot be compared with the scores of later versions, which are measured on a mixed in-house + OIMHS split. **Research use only.** This is not a medical device. ## Citation If you use these models, please cite the OcularRigidity work (reference to come) and the OIMHS dataset: ``` Ye, X., He, S., Zhong, X. et al. OIMHS: An Optical Coherence Tomography Image Dataset Based on Macular Hole Manual Segmentation. Sci Data 10, 769 (2023). https://doi.org/10.1038/s41597-023-02675-1 ```