목록2024/08 (20)
UOMOP
import torchvision.transforms as transformsimport mathimport torchimport torchvisionimport torch.nn as nnimport torch.optim as optimfrom torch.utils.data import DataLoader, Datasetimport time#from params import *import osfrom tqdm import tqdmimport numpy as npdef patch_importance(image, patch_size=2, type='variance', how_many=2): if isinstance(image, torch.Tensor): image = image.numpy(..
import torchimport torchvisionimport torchvision.transforms as trimport numpy as npimport matplotlib.pyplot as pltfrom torchvision import datasetsfrom torch.utils.data import DataLoaderfrom skimage.feature import cannyfrom skimage.measure import shannon_entropyimport cv2# Transform 설정: 이미지 정규화 및 텐서 변환transf = tr.Compose([tr.ToTensor()])# CIFAR-10 데이터셋 불러오기trainset = torchvision.datasets.CIFAR10(..