资源简介

图像超分辨率技术源码; 基于深度学习的图像超分辨率重建的流程如下[2]: 1.首先找到一组原始图像Image1; 2.将这组图片降低分辨率为一组图像Image2 3.通过各种神经网络结构,将Image2超分辨率重建为Image3(Image3和Image1分辨率一样) 4.通过PSNR等方法比较Image1和Image3,验证超分辨率重建的效果,根据效果调节神经网络中的节点和参数 5.反复执行以上直到第4步的结果比较满意 The process of image super-resolution reconstruction based on deep learning is as follows [2]: 1. First find a set of original images image1; 2. Reduce the resolution of this group of pictures to a group of image2 3. Through various neural network structures, the super-resolution of image2 is reconstructed into image3 (the resolution of image3 is the same as that of image1) 4. Compare image1 and image3 by PSNR and other methods to verify the effect of super-resolution reconstruction, and adjust the nodes and parameters of neural network according to the effect 5. Repeat the above until the result of step 4 is satisfactory)

资源截图

代码片段和文件信息

import os
import sys
import glob
import numpy as np
from PIL import Image
import pdb

# Artifically expands the dataset by a factor of 19 by scaling and then rotating every image
def main():
  if len(sys.argv) == 2:
    data = prepare_data(sys.argv[1])
  else:
    print(“Missing argument: You must specify a folder with images to expand“)
    return

  for i in xrange(len(data)):
    scale(data[i])
    rotate(data[i])

def prepare_data(dataset):
  filenames = os.listdir(dataset)
  data_dir = os.path.join(os.getcwd() dataset)
  data = glob.glob(os.path.join(data_dir “*.bmp“))

  return data

def scale(file):
  image = Image.open(file)
  width height = image.size

  scales = [0.9 0.8 0.7 0.6]
  for scale in scales:
    new_width new_height = int(width * scale) int(height * scale)
    new_image = image.resize((new_width new_height) Image.ANTIALIAS)
    new_path = ‘{}-{}.bmp‘.format(file[:-4] scale)
    new_image.save(new_path)

def rotate(file):
  image = Image.open(file)

  rotations = [90 180 270]
  for rotation in rotations:
    new_image = image.rotate(rotation expand=True)
    new_path = ‘{}-{}.bmp‘.format(file[:-4] rotation)
    new_image.save(new_path)

if __name__ == ‘__main__‘:
  main()
  

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       1228  2019-06-06 13:37  图像超分辨率\expand_data.py

     文件       1763  2019-06-06 13:37  图像超分辨率\main.py

     文件       8973  2019-06-06 13:43  图像超分辨率\model.py

     文件       9726  2019-06-06 13:45  图像超分辨率\utils.py

     目录          0  2019-06-06 13:39  图像超分辨率

----------- ---------  ---------- -----  ----

                21690                    5


评论

共有 条评论