pip install -U diffusers transformers accelerate
import torch
from diffusers import DiffusionPipeline
# switch to "mps" for apple devices
pipe = DiffusionPipeline.from_pretrained("LexieK/COIN", dtype=torch.bfloat16, device_map="cuda")
prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k"
image = pipe(prompt).images[0]Model Card for COIN
What is COIN?
COIN (Cytology generative fOundatIoN model) is a controllable foundation model for cytology image generation, developed to address the long-standing challenges of data scarcity and privacy constraints in computational cytology.
COIN is trained on 112,226 cytology imageβreport pairs from 16 anatomical sites, enabling it to generate high-fidelity, text-controllable cytology images that preserve both morphological and diagnostic realism.
It supports a wide range of downstream applications, including AI model data augmentation, diagnostic model pretraining, and content-based image retrieval, making it the first foundation model to provide scalable synthetic data generation for cytopathology.
Usage
Install the conch repository using pip:
pip install git+https://github.com/LexieK7/COIN.git
After succesfully requesting access to the weights:
from diffusers import DiffusionPipeline
import torch
import os
sdxl_base_model = "./sd_xl_1-0"
lora_model_path = "MODEL PATH"
save_folder = "./generated_images"
prompt = "No intraepithelial lesion or malignancy (NILM)."
guidance_scale = 7.5
num_inference_steps = 50
pipe = DiffusionPipeline.from_pretrained(sdxl_base_model)
pipe.to("cuda")
pipe.load_lora_weights(lora_model_path)
save_path = os.path.join(save_folder, "example.jpg")
image = pipe(prompt, num_inference_steps=num_inference_steps, guidance_scale=guidance_scale).images[0]
image.save(save_path)
π Citation
If you find this work useful, please cite us:
@article{zheng2026generative,
title={A Generative Foundation Model for Scalable Cytology Image Synthesis in AI-Powered Diagnostics},
author={Zheng, Ke and Zheng, Xueyi and Wang, Jue and Zhang, Xinke and Chen, Shiping and Chen, Qunxi and Fu, Sha and Xie, Dan and Wang, Ruixuan and Lai, Junpeng and others},
journal={Clinical Cancer Research},
pages={OF1--OF12},
year={2026},
publisher={American Association for Cancer Research}
}
- Downloads last month
- 2
Model tree for LexieK/COIN
Base model
stabilityai/stable-diffusion-xl-base-1.0
# Gated model: Login with a HF token with gated access permission hf auth login