Views
No views yet
diffusers format.
It can be used in combination with Stable Diffusion, such as runwayml/stable-diffusion-v1-5.
$ pip install controlnet_aux==0.3.0diffusers and related packages:$ pip install diffusers transformers accelerate1import torch
2import os
3from huggingface_hub import HfApi
4from pathlib import Path
5from diffusers.utils import load_image
6from PIL import Image
7import numpy as np
8from controlnet_aux import OpenposeDetector
9
10from diffusers import (
11 ControlNetModel,
12 StableDiffusionControlNetPipeline,
13 UniPCMultistepScheduler,
14)
15
16checkpoint = "lllyasviel/control_v11p_sd15_openpose"
17
18image = load_image(
19 "https://huggingface.co/lllyasviel/control_v11p_sd15_openpose/resolve/main/images/input.png"
20)
21
22prompt = "chef in the kitchen"
23
24processor = OpenposeDetector.from_pretrained('lllyasviel/ControlNet')
25
26control_image = processor(image, hand_and_face=True)
27control_image.save("./images/control.png")
28
29controlnet = ControlNetModel.from_pretrained(checkpoint, torch_dtype=torch.float16)
30pipe = StableDiffusionControlNetPipeline.from_pretrained(
31 "runwayml/stable-diffusion-v1-5", controlnet=controlnet, torch_dtype=torch.float16
32)
33
34pipe.scheduler = UniPCMultistepScheduler.from_config(pipe.scheduler.config)
35pipe.enable_model_cpu_offload()
36
37generator = torch.manual_seed(0)
38image = pipe(prompt, num_inference_steps=30, generator=generator, image=control_image).images[0]
39
40image.save('images/image_out.png')
41


| Model Name | Control Image Overview | Control Image Example | Generated Image Example |
|---|---|---|---|
| lllyasviel/control_v11p_sd15_canny Trained with canny edge detection | A monochrome image with white edges on a black background. | ![]() | ![]() |
| lllyasviel/control_v11e_sd15_ip2p Trained with pixel to pixel instruction | No condition . | ![]() | ![]() |
| lllyasviel/control_v11p_sd15_inpaint Trained with image inpainting | No condition. | ![]() | ![]() |
| lllyasviel/control_v11p_sd15_mlsd Trained with multi-level line segment detection | An image with annotated line segments. | ![]() | ![]() |
| lllyasviel/control_v11f1p_sd15_depth Trained with depth estimation | An image with depth information, usually represented as a grayscale image. | ![]() | ![]() |
| lllyasviel/control_v11p_sd15_normalbae Trained with surface normal estimation | An image with surface normal information, usually represented as a color-coded image. | ![]() | ![]() |
| lllyasviel/control_v11p_sd15_seg Trained with image segmentation | An image with segmented regions, usually represented as a color-coded image. | ![]() | ![]() |
| lllyasviel/control_v11p_sd15_lineart Trained with line art generation | An image with line art, usually black lines on a white background. | ![]() | ![]() |
| lllyasviel/control_v11p_sd15s2_lineart_anime Trained with anime line art generation | An image with anime-style line art. | ![]() | ![]() |
| lllyasviel/control_v11p_sd15_openpose Trained with human pose estimation | An image with human poses, usually represented as a set of keypoints or skeletons. | ![]() | ![]() |
| lllyasviel/control_v11p_sd15_scribble Trained with scribble-based image generation | An image with scribbles, usually random or user-drawn strokes. | ![]() | ![]() |
| lllyasviel/control_v11p_sd15_softedge Trained with soft edge image generation | An image with soft edges, usually to create a more painterly or artistic effect. | ![]() | ![]() |
| lllyasviel/control_v11e_sd15_shuffle Trained with image shuffling | An image with shuffled patches or regions. | ![]() | ![]() |