--- license: apache-2.0 tags: - image-segmentation - medical-imaging - polyp-segmentation - pytorch - malunet datasets: - cvc-clinicdb library_name: pytorch pipeline_tag: image-segmentation --- # MALUNet · CVC-ClinicDB (Polyp Segmentation) Lightweight U-shape segmentation network adapted from [jcruan519/MALUNet](https://github.com/jcruan519/MALUNet) and trained on [CVC-ClinicDB](https://www.kaggle.com/datasets/balraj98/cvcclinicdb) for binary polyp segmentation in colonoscopy frames. ## Model - Architecture: MALUNet (DGA + IEA + CAB + SAB) - Channels: `[8, 16, 24, 32, 48, 64]`, `split_att="fc"`, `bridge=True` - Input: RGB, 256×256 - Output: single-channel sigmoid mask (1 = polyp) - Parameters: ~0.18 M ## Training - Dataset: CVC-ClinicDB (612 paired image/mask frames) - Split: 80% train / 20% val (seeded by filename, `seed=42`) - Loss: BCE + Dice - Optimizer: AdamW, `lr=1e-3`, `weight_decay=1e-2` - Schedule: CosineAnnealingLR, `T_max=50`, `eta_min=1e-5` - Augmentations: random h/v flip, random rotation - Epochs: 150 ## Usage ```python import torch from huggingface_hub import hf_hub_download from infer import load_model, predict_mask # infer.py from this repo from PIL import Image model = load_model("YOUR_USERNAME/malunet-cvc") mask = predict_mask(model, Image.open("polyp.png")) Image.fromarray(mask).save("mask.png") ``` `infer.py` and `models/malunet.py` are bundled in this repo so you can also clone it and run inference without the original training code. ## Limitations - Trained on CVC-ClinicDB only (612 frames, single source). Generalization to other colonoscopy systems / patient populations is unverified. - Not a medical device. Research / demo use only.