okupyn commited on
Commit
6e22e1e
·
verified ·
1 Parent(s): 35b4dd7

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +69 -3
README.md CHANGED
@@ -1,3 +1,69 @@
1
- ---
2
- license: cc-by-nc-4.0
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ***ControlNet Head Mesh SDXL***
2
+
3
+
4
+ # ControlNet Example(Conditioned on 3D Head Mesh)
5
+ ![images_0)](./pncc_example.jpg)
6
+
7
+ # Head Mesh Processor Install
8
+
9
+ pip install git+https://github.com/KupynOrest/head_detector.git
10
+
11
+ # Code to Use Tile blur
12
+
13
+
14
+ ```python
15
+ from diffusers import ControlNetModel, StableDiffusionXLControlNetPipeline, AutoencoderKL
16
+ from diffusers import EulerAncestralDiscreteScheduler
17
+ from PIL import Image
18
+ import torch
19
+ import numpy as np
20
+ import cv2
21
+
22
+ from head_detector import HeadDetector
23
+
24
+ detector = HeadDetector()
25
+
26
+ controlnet_conditioning_scale = 1.0
27
+ prompt = "your prompt, the longer the better, you can describe it as detail as possible"
28
+ negative_prompt = 'longbody, lowres, bad anatomy, bad hands, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality'
29
+
30
+ eulera_scheduler = EulerAncestralDiscreteScheduler.from_pretrained("stabilityai/stable-diffusion-xl-base-1.0", subfolder="scheduler")
31
+
32
+
33
+ controlnet = ControlNetModel.from_pretrained(
34
+ "okupyn/head-mesh-controlnet-xl",
35
+ torch_dtype=torch.float16
36
+ )
37
+
38
+ # when test with other base model, you need to change the vae also.
39
+ vae = AutoencoderKL.from_pretrained("madebyollin/sdxl-vae-fp16-fix", torch_dtype=torch.float16)
40
+
41
+ pipe = StableDiffusionXLControlNetPipeline.from_pretrained(
42
+ "stabilityai/stable-diffusion-xl-base-1.0",
43
+ controlnet=controlnet,
44
+ vae=vae,
45
+ safety_checker=None,
46
+ torch_dtype=torch.float16,
47
+ scheduler=eulera_scheduler,
48
+ )
49
+
50
+ controlnet_img = detector("your original image path").get_pncc()
51
+ controlnet_img = Image.fromarray(controlnet_img)
52
+
53
+
54
+ images = pipe(
55
+ prompt,
56
+ negative_prompt=negative_prompt,
57
+ image=controlnet_img,
58
+ controlnet_conditioning_scale=controlnet_conditioning_scale,
59
+ num_inference_steps=30,
60
+ ).images
61
+
62
+ images[0].save(f"your image save path")
63
+
64
+ ```
65
+
66
+ ---
67
+ license: cc-by-nc-4.0
68
+ library_name: diffusers
69
+ ---