sd-x2-latent-upscaler 모델로 image upscale 하기

2024. 11. 21. 10:22·Etc
728x90
반응형

diffusion을 기반으로 하는 image upscale 모델이 아주 많은데요.

많이 쓰이는 모델 중 하나인 sd-x2-latent-upscaler를 이용해 image upscale을 진행해보겠습니다.

 

전체 코드는 아래와 같습니다.

from diffusers import StableDiffusionLatentUpscalePipeline
import torch


upscaler = StableDiffusionLatentUpscalePipeline.from_pretrained("stabilityai/sd-x2-latent-upscaler", torch_dtype=torch.float16)
upscaler.to("cuda")

prompt = "(photorealistic:1.4), best quality"
generator = torch.manual_seed(42)

low_res_latents = Image.open("image.png")
upscaled_image = upscaler(
    prompt=prompt,
    image=low_res_latents,
    num_inference_steps=20,
    guidance_scale=0,
    generator=generator,
).images[0]


upscaled_image.save("result.png")

 

inference_step 은 20만 진행해주겠습니다.

 

- before

 

- after

 

기존 화질 손상 없이 잘 upscale 되었습니다.

 

 

 

 

728x90
반응형
저작자표시 (새창열림)

'Etc' 카테고리의 다른 글

[lmdb] lmdb 파일 쓰기 및 읽기  (1) 2025.01.23
safetensor 모델을 diffusers에서 사용 가능하게 변경하기  (0) 2024.11.11
[JNI] jbyte를 C++의 vector<uchar>로 변환하는 방법  (0) 2023.03.12
[JNI] JNI 사용법 및 튜토리얼 (2)  (0) 2023.03.12
[JNI] JNI 사용법 및 튜토리얼 (1)  (3) 2023.03.11
'Etc' 카테고리의 다른 글
  • [lmdb] lmdb 파일 쓰기 및 읽기
  • safetensor 모델을 diffusers에서 사용 가능하게 변경하기
  • [JNI] jbyte를 C++의 vector<uchar>로 변환하는 방법
  • [JNI] JNI 사용법 및 튜토리얼 (2)
ga.0_0.ga
ga.0_0.ga
    반응형
    250x250
  • ga.0_0.ga
    ##뚝딱뚝딱 딥러닝##
    ga.0_0.ga
  • 전체
    오늘
    어제
    • 분류 전체보기 (181)
      • Paper Review (51)
        • Video Scene Graph Generation (6)
        • Image Scene Graph Generation (18)
        • Graph Model (5)
        • Key Information Extraction (4)
        • Fake Detection (2)
        • Text to Image (1)
        • Diffusion Personalization (4)
        • etc (11)
      • AI Research (49)
        • Deep Learning (30)
        • Artificial Intelligence (15)
        • Data Analysis (4)
      • Pytorch (10)
      • ONNX (5)
      • OpenCV (2)
      • Error Note (34)
      • Linux (2)
      • Docker (3)
      • Etc (7)
      • My Study (16)
        • Algorithm (10)
        • Project (4)
        • Interview (2)
  • 블로그 메뉴

    • 홈
    • 태그
    • 방명록
  • 링크

  • 공지사항

  • 인기 글

  • 태그

    활성화 함수
    차원의 저주
    3dinput
    TypeError
    forch.nn.functional
    Inductive bias
    tensorflow
    알고리즘
    pandas
    i3d
    linear regression
    dataloader
    그래프신경망
    ONNX
    Logistic regression
    GCN
    Activation Function
    dataset
    JNI
    torch.nn
    transformer
    contiguous
    RuntimeError
    정규화
    나이브 베이즈 분류
    pytorch
    permute
    fine tuning
    오차 역전파
    HRNet
  • 최근 댓글

  • 최근 글

  • hELLO· Designed By정상우.v4.10.0
ga.0_0.ga
sd-x2-latent-upscaler 모델로 image upscale 하기
상단으로

티스토리툴바