一、源码1
import torch.nn as nn
class Net(nn.Module):
def __init__(self):
super(Net, self).__init__()
def forward(self, x):
out = nn.functional.upsample(x, size=None, scale_factor=2, mode='nearest')
return out
二、源码2
from PIL import Image
import os
def Bicubic():
path = r"source path"
save_path = r"target path of the results"
filelist = os.listdir(path)
for files in filelist:
img_path = os.path.join(path, files)
img = Image.open(img_path)
DealImage = img.resize((int(img.size[0] * 4), int(img.size[1] * 4)), Image.BICUBIC)
files = files.split('.')[0] + '.png'
img_path = os.path.join(save_path, files)
DealImage.save(img_path)
if __name__ == '__main__':
Bicubic()