전체 글 (130) 썸네일형 리스트형 [코드] 이미지의 패치 단위 얼만큼 차지하는지 보는 코드 / 패치 별 평균 보는 방법 1. 이미지의 패치 단위 얼만큼 차지하는지 보는 코드 import matplotlib.pyplot as pltimport numpy as npfrom PIL import Imageimport requestsfrom io import BytesIO# Image dimensionsimg_size = 224patch_size = 14num_patches = 16# Function to load and resize imagedef load_and_resize_image(url, size): response = requests.get(url) img = Image.open(BytesIO(response.content)) img = img.resize((size, size)) return n.. [에러 해결] UserWarning: None of the inputs have requires_grad=True. Gradients will be None / warnings.filterwarnings UserWarning: None of the inputs have requires_grad=True. Gradients will be None UserWarning: None of the inputs have requires_grad=True. Gradients will be None위의 경고문이 너무 자주 나타나서 끄고 싶었다. 해결: import warnings; warnings.filterwarnings import warningswarnings.filterwarnings("ignore", category=UserWarning)import warningswarnings.filterwarnings("ignore", category=UserWarning) 위의 코드를 코드 맨 윗부분에 넣으면 된.. 이미지 normalize의 중요성 / clamp(0, 1) 이미지 normalize의 중요성 toy experimentimage = self.vae.decode(pred_original_sample.to(self.weight_dtype)).sample image를 vae에서 처음 추출했을 때 image 값의 범위 image의 값의 범위는 -1 ~ 1 사이에 있었다. image를 저장해보기 이 이미지를 255 값으로 바꾸고 이미지를 출력해봤을 때 이렇게 원래 이미지 색깔이 안나오는 문제가 발생한다 image normalize clamp(0,1) image = (image / 2 + 0.5).clamp(0, 1)image = (image / 2 + 0.5).clamp(0, 1) 따라서 normalize를 0~1로 해야 255 .. 이전 1 ··· 32 33 34 35 36 37 38 ··· 44 다음