목록분류 전체보기 (295)
UOMOP
def patch_importance(image, patch_size=2, type='variance', how_many=2, noise_scale=0): if isinstance(image, torch.Tensor): image = image.numpy() H, W = image.shape[-2:] extended_patch_size = patch_size + 2 * how_many value_map = np.zeros((H // patch_size, W // patch_size)) for i in range(0, H, patch_size): for j in range(0, W, patch_size): start_i = max(i ..
import torchimport torch.nn as nnimport torchvision.transforms as transformsimport torchvision.datasets as datasetsfrom torch.utils.data import DataLoaderimport mathfrom params import *import torchvisionimport timedevice = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")def count_parameters(model): return sum(p.numel() for p in model.parameters() if p.requires_grad)def psnr(img1..
import torchimport torch.nn as nnimport torchvision.transforms as transformsimport torchvision.datasets as datasetsfrom torch.utils.data import DataLoaderimport mathfrom params import *import torchvisionimport timedevice = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")def count_parameters(model): return sum(p.numel() for p in model.parameters() if p.requires_grad)def psnr(img1..
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 npfrom skimage.metrics import structural_similar..
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 skimage.metrics import structural_similarity as ssimfrom pa..
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 skimage.metrics import structural_similarity as ssimfrom pa..