목록분류 전체보기 (295)
UOMOP
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..
import matplotlib.pyplot as plt import torchvision.transforms as transforms import torch.nn.functional as F import math import torch import torchvision import torch.nn as nn import torch.optim as optim import torch.nn.functional as f from torch.utils.data import DataLoader, Dataset import time from params import * import os from tqdm import tqdm import numpy as np import cv2 device = torch.devic..
import matplotlib.pyplot as plt import torchvision.transforms as transforms import torch.nn.functional as F import math import torch import torchvision import torch.nn as nn import torch.optim as optim import torch.nn.functional as f from torch.utils.data import DataLoader, Dataset import time from params import * import os from tqdm import tqdm import numpy as np import cv2 device = torch.devic..
import numpy as np import cv2 import torch import torch.nn.functional as F import torchvision.transforms as transforms import torchvision.datasets as datasets from torch.utils.data import DataLoader import matplotlib.pyplot as plt def patch_std(image, patch_size=2): # Calculate the standard deviation within each patch H, W = image.shape std_map = np.zeros((H // patch_size, W // patch_size)) for ..