A Model for Super-Resolution
Author
Wolfram Research, Inc.
Title
A Model for Super-Resolution
Description
In this example we use a neural network with an architecture inspired by VGG in order to create super-resolution images.
Category
Essays, Posts & Presentations
Keywords
neural net, deep neural net, machine learning, DNN, CNN, convolutional neural net, computer vision, net training, net evaluation, net repo, Wolfram net repository, machine vision, image net encode, image net decode, super resolution, high resolution, low resolution, image resizing, image upsampling, VGG
URL
http://www.notebookarchive.org/2021-11-b2ekdfe/
DOI
https://notebookarchive.org/2021-11-b2ekdfe
Date Added
2021-11-24
Date Last Modified
2021-11-24
File Size
770.65 kilobytes
Supplements
Rights
Redistribution rights reserved
Download
Open in Wolfram Cloud
A Model for Super-Resolution
A Model for Super-Resolution
In this example we use a neural network with an architecture inspired by VGG in order to create super-resolution images. It takes an interpolated low-resolution image and refines the details to create a sharp upsampling.
Get this network from the Wolfram Neural Net Repository. See details about this specific network here.
In[]:=
net=NetModel["Very Deep Net for Super-Resolution"]
Out[]=
This network performs the refinement on the Y channel in the YCbCr color space. Here is an evaluation function that must be used to pre- and post-process the input.
In[]:=
netevaluate[img_,imgScale_]:=Block{interpolated,ycbcr,channels,resizedNet,diff},interpolated=ImageResize[img,Scaled[imgScale],Resampling"Cubic"];ycbcr=
@interpolated;resizedNet=NetReplacePartnet,"Input"
;channels=ColorSeparate[ycbcr];diff=Image[resizedNet[First[channels]]];ycbcr=ColorCombine[channels+{diff,0,0}];
@ycbcr
RGBtoYCbCr |
NetEncoder[ ] |
YCbCrtoRGB |
Evaluate the network on a small image to double its size.
In[]:=
small=
;
In[]:=
refined=netevaluate[small,2]
Out[]=
Compare with the unrefined resampling using the same cubic kernel used to produce the net input and a high-quality OMOMS kernel.
In[]:=
upsampledCubic=ImageResize[small,Scaled[2],Resampling"Cubic"];upsampledOMOMS=ImageResize[small,Scaled[2],Resampling->{"OMOMS",7}];TableForm[Image[ImageTrim[#,{{{200,20},{380,200}},{{200,200},{300,300}}}],ImageSize130]&/@{upsampledCubic,upsampledOMOMS,refined},TableHeadings{Text/@{"Cubic","OMOMS","DNN"},None}]
Out[]//TableForm=
Cite this as: Wolfram Research, Inc., "A Model for Super-Resolution" from the Notebook Archive (2022), https://notebookarchive.org/2021-11-b2ekdfe
Download