Views
No views yet

| Model Name | Control Image Overview | Control Image Example | Generated Image Example |
|---|---|---|---|
| lllyasviel/sd-controlnet-canny Trained with canny edge detection | A monochrome image with white edges on a black background. | ![]() | ![]() |
| lllyasviel/sd-controlnet-depth Trained with Midas depth estimation | A grayscale image with black representing deep areas and white representing shallow areas. | ![]() | ![]() |
| lllyasviel/sd-controlnet-hed Trained with HED edge detection (soft edge) | A monochrome image with white soft edges on a black background. | ![]() | ![]() |
| lllyasviel/sd-controlnet-mlsd Trained with M-LSD line detection | A monochrome image composed only of white straight lines on a black background. | ![]() | ![]() |
| lllyasviel/sd-controlnet-normal Trained with normal map | A normal mapped image. | ![]() | ![]() |
| lllyasviel/sd-controlnet_openpose Trained with OpenPose bone image | A OpenPose bone image. | ![]() | ![]() |
| lllyasviel/sd-controlnet_scribble Trained with human scribbles | A hand-drawn monochrome image with white outlines on a black background. | ![]() | ![]() |
| lllyasviel/sd-controlnet_seg Trained with semantic segmentation | An ADE20K's segmentation protocol image. | ![]() | ![]() |
diffusers and related packages:$ pip install diffusers transformers accelerate1from transformers import pipeline
2from diffusers import StableDiffusionControlNetPipeline, ControlNetModel, UniPCMultistepScheduler
3from PIL import Image
4import numpy as np
5import torch
6from diffusers.utils import load_image
7
8depth_estimator = pipeline('depth-estimation')
9
10image = load_image("https://huggingface.co/lllyasviel/sd-controlnet-depth/resolve/main/images/stormtrooper.png")
11
12image = depth_estimator(image)['depth']
13image = np.array(image)
14image = image[:, :, None]
15image = np.concatenate([image, image, image], axis=2)
16image = Image.fromarray(image)
17
18controlnet = ControlNetModel.from_pretrained(
19 "lllyasviel/sd-controlnet-depth", torch_dtype=torch.float16
20)
21
22pipe = StableDiffusionControlNetPipeline.from_pretrained(
23 "runwayml/stable-diffusion-v1-5", controlnet=controlnet, safety_checker=None, torch_dtype=torch.float16
24)
25
26pipe.scheduler = UniPCMultistepScheduler.from_config(pipe.scheduler.config)
27
28# Remove if you do not have xformers installed
29# see https://huggingface.co/docs/diffusers/v0.13.0/en/optimization/xformers#installing-xformers
30# for installation instructions
31pipe.enable_xformers_memory_efficient_attention()
32
33pipe.enable_model_cpu_offload()
34
35image = pipe("Stormtrooper's lecture", image, num_inference_steps=20).images[0]
36
37image.save('./images/stormtrooper_depth_out.png')

