Buckets:
| # 텍스트 기반 깊이-이미지 생성 | |
| [StableDiffusionDepth2ImgPipeline](/docs/diffusers/v0.43.0/ko/api/pipelines/stable_diffusion/depth2img#diffusers.StableDiffusionDepth2ImgPipeline)를 사용하면 텍스트 프롬프트와 초기 이미지를 전달하여 새로운 이미지 생성을 조건화할 수 있습니다. 또한 이미지 구조를 유지하기 위해 `depth_map`을 전달할 수도 있습니다. `depth_map`이 제공되지 않으면 파이프라인은 통합된 [depth-estimation model](https://github.com/isl-org/MiDaS)을 통해 깊이를 자동으로 예측합니다. | |
| [StableDiffusionDepth2ImgPipeline](/docs/diffusers/v0.43.0/ko/api/pipelines/stable_diffusion/depth2img#diffusers.StableDiffusionDepth2ImgPipeline)의 인스턴스를 생성하는 것으로 시작합니다: | |
| ```python | |
| import torch | |
| from diffusers import StableDiffusionDepth2ImgPipeline | |
| from diffusers.utils import load_image, make_image_grid | |
| pipeline = StableDiffusionDepth2ImgPipeline.from_pretrained( | |
| "stabilityai/stable-diffusion-2-depth", | |
| dtype=torch.float16, | |
| use_safetensors=True, | |
| ).to("cuda") # or "mps", "xpu", "cpu" | |
| ``` | |
| 이제 프롬프트를 pipeline에 전달합니다. 특정 단어가 이미지 생성 방식을 유도하는 것을 방지하려면 `negative_prompt`도 전달할 수 있습니다: | |
| ```python | |
| url = "http://images.cocodataset.org/val2017/000000039769.jpg" | |
| init_image = load_image(url) | |
| prompt = "two tigers" | |
| negative_prompt = "bad, deformed, ugly, bad anatomy" | |
| image = pipeline(prompt=prompt, image=init_image, negative_prompt=negative_prompt, strength=0.7).images[0] | |
| make_image_grid([init_image, image], rows=1, cols=2) | |
| ``` | |
| | 입력 | 출력 | | |
| |---------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------| | |
| | | | | |
Xet Storage Details
- Size:
- 2.11 kB
- Xet hash:
- 45dde675d2ae2f1687a6fdf557aad2a477542533c7d6b1fa3075918f5cb4da6e
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.