Views
No views yet


diffusers/models/unets/unet_2d.py with the unet_2d.py provided in this repository.1import torch
2from pipeline import LeafPipeline
3from PIL import Image
4
5device = torch.device("cuda")
6
7# load pipeline
8pipeline = LeafPipeline.from_pretrained("pearisli/LEAF-QaTa-COV19").to(device)
9
10# open image
11image = Image.open("image.png").convert("RGB")
12
13# run pipeline in inference
14mask = pipeline(image).prediction[0]
15
16# save segmentation mask
17mask.save("mask.png")1@InProceedings{HuaQil_LEAF_MICCAI2025,
2 author = { Huang, Qilin AND Lin, Tianyu AND Chen, Zhiguang AND Zheng, Fudan},
3 title = { { LEAF: Latent Diffusion with Efficient Encoder Distillation for Aligned Features in Medical Image Segmentation } },
4 booktitle = {proceedings of Medical Image Computing and Computer Assisted Intervention -- MICCAI 2025},
5 year = {2025},
6 publisher = {Springer Nature Switzerland},
7 volume = {LNCS 15965},
8 month = {September},
9 page = {384 -- 393}
10}1@misc{huang2025leaflatentdiffusionefficient,
2 title={LEAF: Latent Diffusion with Efficient Encoder Distillation for Aligned Features in Medical Image Segmentation},
3 author={Qilin Huang and Tianyu Lin and Zhiguang Chen and Fudan Zheng},
4 year={2025},
5 eprint={2507.18214},
6 archivePrefix={arXiv},
7 primaryClass={cs.CV},
8 url={https://arxiv.org/abs/2507.18214},
9}