-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlibraries.py
More file actions
28 lines (26 loc) · 745 Bytes
/
Copy pathlibraries.py
File metadata and controls
28 lines (26 loc) · 745 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
from __future__ import print_function
import os
from os import listdir
from os.path import join
from math import log10
import torch
import torch.nn as nn
import torch.optim as optim
from torch.nn import init
from torch.optim import lr_scheduler
from torch.utils.data import DataLoader
import torch.backends.cudnn as cudnn
import functools
from matplotlib import pyplot as plt
import torch.utils.data as data
import numpy as np
from PIL import Image
import torchvision.transforms as transforms
import random
# from skimage.metrics import structural_similarity
from skimage.measure import compare_ssim
import time
def tensor_to_np(tensor):
img = tensor.mul(1).byte()
img = img.cpu().numpy().squeeze(0).transpose((1, 2, 0))
return img