File size: 1,985 Bytes
79a1e19
851e779
 
 
79a1e19
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ef926ca
79a1e19
ef926ca
79a1e19
 
 
 
 
 
 
 
a6ebcc2
 
d0267aa
a6ebcc2
 
 
 
 
 
 
 
 
 
 
79a1e19
 
 
 
 
 
 
 
a6ebcc2
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
---
base_model:
- CompVis/stable-diffusion-v1-4
- RiddleHe/SD14_pathology_lora
library_name: diffusers
license: creativeml-openrail-m
inference: true
tags:
- stable-diffusion
- stable-diffusion-diffusers
- text-to-image
- diffusers
- controlnet
- diffusers-training
---

<!-- This model card has been generated automatically according to the information the training script had access to. You
should probably proofread and complete it, then remove this comment. -->


# controlnet-RiddleHe/SD14_pathology_controlnet

These are controlnet weights trained on CompVis/stable-diffusion-v1-4 with new type of conditioning.
You can find some example images below.

prompt: A histopathology image of breast cancer tissue.
![images_0)](./imgs/controlnet_validation_1.png)
prompt: An image of breast cancer histopathology with detailed cellular structures.
![images_1)](./imgs/controlnet_validation_2.png)



## Intended uses & limitations

#### How to use

```python
controlnet = ControlNetModel.from_pretrained("RiddleHe/SD14_pathology_controlnet", torch_dtype=torch.float16)
pipe = StableDiffusionControlNetPipeline.from_pretrained(
    "RiddleHe/SD14_pathology_base", controlnet=controlnet, torch_dtype=torch.float16
)
pipe.scheduler = UniPCMultistepScheduler.from_config(pipe.scheduler.config)
pipe.to('cuda')

prompt = "A histopathology image of breast cancer tissue."
mask = mask.convert("RGB")  # Provide a mask

generator = torch.Generator(device='cuda').manual_seed(42)

with torch.no_grad():
  out = pipe(prompt, image=mask, num_inference_steps=70, num_images_per_prompt=3, generator=generator).images
```

#### Limitations and bias

[TODO: provide examples of latent issues and potential remediations]

## Training details

The model is trained on 28216 image-mask pairs from the BRCA breast cancer dataset. Input is mask and output is image. 

Mask is a single channel image with integer values from 0 to 21 representing 22 classes, eg. 1 representing tumor, 2 representing stroma.