File size: 1,990 Bytes
c6df920
 
ef133fb
 
 
 
c6df920
 
ef133fb
c6df920
ef133fb
c6df920
 
ef133fb
c6df920
088292f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c6df920
ef133fb
c6df920
ef133fb
 
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
63
64
65
66
67
---
library_name: diffusers
license: apache-2.0
language:
- en
pipeline_tag: image-to-image
---

# Fake-QRcode ControlNet

These are ControlNet checkpoints trained on runwayml/stable-diffusion-v1-5 to generate recognizable AIGC QRcode image.

## Model Details
Details will be added soon...

## Use with diffusers

See the snippet below for usage with diffusers:
```python
import cv2
import numpy as np
import torch
import os, sys

from diffusers import StableDiffusionControlNetPipeline, ControlNetModel, AutoencoderKL, EulerAncestralDiscreteScheduler
from PIL import Image

controlnet = ControlNetModel.from_pretrained("ghoskno/Fake-Qrcode")
pipe = StableDiffusionControlNetPipeline.from_pretrained(
  "runwayml/stable-diffusion-v1-5", controlnet=controlnet, torch_dtype=torch.float16
)
pipe.scheduler = DDIMScheduler.from_config(pipe.scheduler.config)
pipe.enable_model_cpu_offload()

generator = torch.manual_seed(412052000)

qrcode = cv2.imread('path_to_qrcode.png')
qrcode = cv2.resize(255 - qrcode, (1024, 1024))

image = pipe(
  "Blooming chinese chrysanthemum, green leaves growing wantonly, flowers, Complex patterns on the border, Masterpiece Art, Beauty, 8K,  Unreal Engine",
  Image.fromarray(qrcode),
  generator=generator,
  num_inference_steps=37,
  guidance_scale=7,
  controlnet_conditioning_scale=1.85
).images[0]
```

## Some examples

**input qrcode image**
<img src="./ghoskno.png"  style="zoom: 33%;" />

**prompt**: Blooming chinese chrysanthemum, green leaves growing wantonly, flowers, Complex patterns on the border, Masterpiece Art, Beauty, 8K,  Unreal Engine

<img src="./1.jpg"  style="zoom: 33%;" />

**prompt**: Plum blossoms in the snow, pink stamens, green leaves and branches growing wantonly, flowers, Complex patterns on the border, Masterpiece Art, Beauty, 8K,  Unreal Engine

<img src="./2.jpg"  style="zoom: 33%;" />

## Limitations and Bias

- No strict control by input prompt
- Sometimes generate confusion or generate unrecognizable QRcode images