CoolFace
Modelpublic

AImageLab-Zip/US_Cond-UNet

sourceHugging Faceupdated 19d agoView on Hugging Face
0likes97downloads
Model Card

Cond-UNet Attention for Ultrasound Segmentation

Cond-UNet Attention is a binary ultrasound segmentation model based on an attention-conditioned U-Net. It was trained to predict a foreground mask from an RGB ultrasound image.

Model Details

Attention-conditioned U-Net for binary ultrasound segmentation: depth 5, base width 16, 512 x 512 input, 8px patches, and 768-dimensional attention embeddings. It has one foreground logit per pixel. Organ conditioning is optional; omitted IDs use the unknown token (-1). DWT and shape conditioning are disabled.

Usage

This repository contains custom Transformers code. Pass trust_remote_code=True when loading it.

python
from transformers import pipeline

segmenter = pipeline(
    "image-segmentation",
    model="AImageLab-Zip/US_Cond-UNet",
    trust_remote_code=True,
)

result = segmenter("ultrasound.png")
mask = result["mask"]

When organ metadata is known, pass its integer class ID:

python
result = segmenter("ultrasound.png", organ_id=3)

If organ_id is not provided, the model automatically uses -1, matching the unknown-organ conditioning used in training.

Use the following IDs when organ metadata is available:

Organ`organ_id`
Appendix0
Breast1
Cardiac2
Thyroid3
Fetal / Fetal HC4
Kidney5
Liver6
Testicle7
Unknown-1

Results and Citation

The model results are reported in the BMVC 2026 paper.

If you use this model, please cite:

bibtex
@inproceedings{morelli2026new,
  title={A New Multicenter Testicular US Dataset and a Lightweight Cond-UNet for Generalization in US Segmentation},
  author={Morelli, Nicola and Marchesini, Kevin and Santi, Daniele and Grana, Costantino and Bolelli, Federico and others},
  booktitle={Proceedings of the British Machine Vision Conference},
  year={2026}
}