STD

파이썬

[Pytorch] custom dataset의 mean, std 구하기

import numpy as np import matplotlib.pyplot as plt from pycocotools.coco import COCO import torch from torchvision import datasets from tqdm.notebook import tqdm def image_stats(data): total_images = len(data) total_pixels = 0 pixel_sum = np.zeros(3) pixel_squared_sum = np.zeros(3) for i in range(total_images): # 이미지 데이터를 numpy 객체로 변환하고 정규화(0~1) img, _ = data[i] img_np = np.asarray(img) / 255.0 ..

beomseok99
'STD' 태그의 글 목록