목록Main (34)
UOMOP
import torchimport torchvisionimport torchvision.transforms as transformsimport numpy as npimport matplotlib.pyplot as pltdef tensor_to_np(tensor): return tensor.numpy().transpose((1, 2, 0))def patch_importance(image, patch_size=2, type='variance', how_many=2): H, W = image.shape extended_patch_size = patch_size + 2 * how_many value_map = np.zeros((H // patch_size, W // patch_size)) ..
% 데이터 정의X = [0, 15, 30]; % SNR 값% 각 선택 메커니즘별 데이터Y_chess_odd_even_masking = [19.884, 24.182, 24.887];Y_random = [20.274, 23.126, 23.522];Y_gaussian = [18.482, 19.617, 19.743];Y_canny = [18.495, 19.641, 19.653];Y_block = [15.931, 16.089, 16.123];% 색상 및 레이블 설정colors = {'r', 'b', 'g', '#FFA500', '#800080'}; % orange와 purple을 16진수로 변경labels = {'Chessboard Selection', 'Random Selection', 'Gaussian Se..
import mathimport torchimport torchvisionfrom fractions import Fractionimport numpy as npimport torch.nn as nnimport torch.optim as optimimport torch.nn.functional as fimport matplotlib.pyplot as pltimport torchvision.transforms as trfrom torchvision import datasetsfrom torch.utils.data import DataLoader, Datasetimport timeimport osfrom params import *device = torch.device("cuda:0" if torch.cuda..
import torchimport numpy as npimport tqdmimport matplotlib.pyplot as pltimport torchvision.transforms as transformsimport torch.nn.functional as Fimport mathimport torchimport torchvisionimport torch.nn as nnimport torch.optim as optimimport torch.nn.functional as ffrom torch.utils.data import DataLoader, Datasetimport timefrom params import *import osfrom tqdm import tqdmimport numpy as npimpor..
import torchimport torchvisionimport torchvision.transforms as transformsimport matplotlib.pyplot as pltimport numpy as npimport cv2# 이미 위에서 정의된 mask_patches_chessboard 및 patch_std 함수를 사용합니다.# CIFAR-10 데이터셋 로드transform = transforms.Compose([ transforms.ToTensor() # 이미지를 텐서로 변환])# 테스트용으로 하나의 이미지만 로드testset = torchvision.datasets.CIFAR10(root='./data', train=False, download=True, transform=tra..
import matplotlib.pyplot as pltimport torchvision.transforms as transformsimport torch.nn.functional as Fimport mathimport torchimport torchvisionimport torch.nn as nnimport torch.optim as optimimport torch.nn.functional as ffrom torch.utils.data import DataLoader, Datasetimport timefrom params import *import osfrom tqdm import tqdmimport numpy as npimport cv2device = torch.device("cuda:0" if to..