목록DE/Code (18)
UOMOP
import torchimport torch.nn as nnfrom thop import profileclass Encoder(nn.Module): def __init__(self, latent_dim): super(Encoder, self).__init__() self.latent_dim = latent_dim # stride=2를 초반 레이어에 적용하고, kernel_size를 3으로 줄임 self.in1 = nn.Conv2d(3, 32, kernel_size=3, stride=2, padding=0) self.in2 = nn.Conv2d(3, 32, kernel_size=3, stride=2, padding=2) sel..
pip install fvcorepip install thop import torchimport torch.nn as nnfrom thop import profile# 수정된 Encoder 클래스class Encoder(nn.Module): def __init__(self, latent_dim): super(Encoder, self).__init__() self.latent_dim = latent_dim # stride=2를 초반 레이어에 적용하고, kernel_size를 3으로 줄임 self.in1 = nn.Conv2d(3, 32, kernel_size=5, stride=2, padding=3) self.in2 = nn.Conv2d(3..
원본 + fftimport osimport torchimport numpy as npfrom torch.utils.data import DataLoader, Datasetimport torch.nn as nnimport torch.optim as optimimport picklefrom sklearn.preprocessing import StandardScalerfrom torchvision import transformsfrom torch.utils.data import DataLoaderfrom InPainting import Loader_maker_for_InPaintingfrom tqdm import tqdmfrom utils import *# 모델 파일 로드dim = 1024snr = 40mo..
import matplotlib.pyplot as pltimport numpy as npimport torchvision.transforms as transformsimport torchvision.datasets as datasetsfrom torch.utils.data import DataLoaderfrom scipy.ndimage import sobel# CIFAR-10 데이터셋 로드transform = transforms.Compose([transforms.ToTensor()])cifar10 = datasets.CIFAR10(root='./data', train=True, download=True, transform=transform)dataloader = DataLoader(cifar10, ba..
import torchvision.transforms as transformsimport mathimport torchimport torchvisionimport torch.nn as nnimport torch.optim as optimfrom torch.utils.data import DataLoader, Datasetimport timeimport osfrom tqdm import tqdmimport numpy as npimport mathimport torchimport torchvisionfrom fractions import Fractionimport numpy as npimport torch.nn as nnimport torch.optim as optimimport torch.nn.functi..
import torchimport numpy as npimport matplotlib.pyplot as pltimport torchvision.transforms as transformsfrom torchvision.datasets import CIFAR10from torch.utils.data import DataLoaderimport torchimport numpy as npimport matplotlib.pyplot as pltfrom torchvision import datasets, transformsdef patch_importance(image, patch_size=2, type='variance', how_many=2): if isinstance(image, torch.Tensor):..