Fork me on GitHub

RAISR: rapid and accurate image super resolution

准确地说,RAISR并不是用来压缩图像的,而是用来upsample图像的。

众所周知,图片缩小到半分辨率后,在拉回原大小,会出现强烈的锯齿。从80年代开始就有很多super sampling的方法,要么从多张低分辨率的图构建出高分辨率,要么从单张“猜测”出高分辨率。本质上其实都是针对边缘搞事情。从锯齿状的边缘恢复出一条带斜率的线段。

用机器学习做这件事情,基本框架是
1. 拿到大量高分辨率的图像,对图片做分块,比如4x4。
2. 每个块都缩小到半分辨率。
3. 用半分辨率的块作为输入,全分辨率的块作为输出,训练。
4. 在Runtime,用半分辨率的块作为输入,就能预测出一个可以接受的全分辨率结果。

当然,在第三步,特征选取、调参数之类是必要的。DL嘛。

这其实Sony早就有了,X-Reality Pro芯片里就集成了一个,用来把1080p转成4k。不过不那么通用,重点是针对文字这样清晰边缘的,以处理亮度特征为主。

回到我一开始说的,为什么说RAISR不是压缩算法,而是upsample算法?因为即便是一个不存在高分辨率的图像,也可以通过这个算法得到高分辨率。
 

作者:Momenta
链接:https://www.zhihu.com/question/54889600/answer/375813735
来源:知乎
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。

对于一个低分辨率图片,我们想要得到对应的高分辨率图片,这个问题在学术界叫做Single Image Super-Resolution(SISR)问题。处理这种问题的一个基本思路是,给定大量的有对应关系的低清和高清图像训练数据,用算法去学习两者之间的对应关系(可以认为是一种滤波器)。本文即从这种思路出发,提出了一种快速生成高分辨率图像的方法,从多个角度对学习这种映射的过程进行加速。

 

考虑简单的线性SISR,可以用下式表示:

其中,z是m*n维的输入低清图像,x是Ms*Ns维的待求的高清图像,H是作用在x上的MsNs*MsNs维的线性算子,Ds是MN*MsNs维的衰减矩阵,在两个维度上分别进行尺度为s的衰减。在这样一个模型下,求解高分辨率图像就是通过已知的测量z去恢复未知的x的过程。

 

常见的从低清到高清的线性算法包括双线性差值或最近邻差值等,这些简单的线性差值算法简单易用,但是这些算法和图像本身的内容无关,因此很难处理复杂精细的图像区域,往往会有失真或过于平滑的现象。因此,近年来有许多基于数据的算法,常见的做法是,将高清图像下采样为低清图像,生成一对对低清-高清图像组合,通过大量这样的数据,去学习从低清到高清图像的映射。比较典型的有SRCNN[16],通过卷积神经网络去学习这个映射,取得了非常好的高分辨率恢复效果。当然,使用卷积神经网络往往会需要非常大的计算量。

 

在RAISR这篇文章中,作者的目标就是把高清恢复做快,快到可以用到当前主流的移动设备上。RAISR的思路是,将低分辨率图像首先进行双线性差值;然后,在双线性差值的基础上,将预训练好的滤波器作用于小图像块;为了提升图像恢复效果,有进一步使用哈希的方法将图像块聚类进行训练。

 

1.学习滤波器

学习滤波器的过程和学习高清映射的思路一致。给定一些图像对,用最小化恢复出来的图像和高清图像质检的误差的方法,学习预设的滤波器。常用的least-square损失函数可写为:

 

其中,h是我们要求的滤波器,A是从高清图像中扣取的小图像块,b是这个小图像块对用的低清像素块。这个流程可以用下图来直观表示。

 

 

 

2.图像分块

 

 

RAISR是以双线性差值为基础的。在双线性差值中,假设上采样比率为2,那么每个像素会被上采样为4个像素点(参见上图中的P1-P4)。所以作者想要先学习四种滤波器,在P1-P4的位置分别使用。相应地,在训练的过程中,训练数据也分成四个块分别训练,如下图:

 

 

 

3.聚类图像块

然而,采用上述方法进行高清恢复,只在四个预训练好的小滤波器中有少量参数,并不能很好的适应图像内容。因此,RAISR又进一步对训练数据中的图像块进行聚类,每一类分别使用不同的滤波器。在聚类的方法的选择上,作者也选用了相对快速的哈希算法。

 

 

 

4.低分辨到高分辨图像预测流程

综合以上步骤,RAISR的流程可以概括为下图:

 

 

 

首先,对低清图像进行简单的双线性差值;然后,使用哈希算法快速将图像块分到不同的类别(bucket)中;对于每个类别,分别使用四个预先训练好的滤波器进行线性滤波;将不同的图像块的结果融合起来,得到最终的恢复结果。

 

从这篇文章中我们可以看到,移动端应用需求会催生各种加速的方法。对于高分辨率恢复的问题,本文作者采用了多种机智的方法累加的方式,如分块计算、哈希加速等。然而我们认为,做应用算法的加速,不仅可以考虑本类似文中的多种机智方法的融合,也可以考虑在一个方法上“死磕”优化。比如,针对卷积神经网络如何小型化快速化,可以从硬件、底层代码、网络结构等多个角度进行优化。对于这些更多的优化技巧,我们以后见。

 

该文为Momenta Paper Reading 第一季第五期回顾,始发于2017年3月27日。
PPT下载链接: 密码: 8has

<div class="List-item"><div class="ContentItem AnswerItem" data-za-index="3" data-zop="{&quot;authorName&quot;:&quot;叛逆者&quot;,&quot;itemId&quot;:141689844,&quot;title&quot;:&quot;Google开发的RAISR算法利用机器学习压缩图片,提高分辨率,实际应用怎么样?&quot;,&quot;type&quot;:&quot;answer&quot;}" name="141689844" itemprop="suggestedAnswer" itemtype="http://schema.org/Answer" itemscope="" data-za-detail-view-path-module="AnswerItem" data-za-detail-view-path-index="3" data-za-extra-module="{&quot;card&quot;:{&quot;has_image&quot;:false,&quot;has_video&quot;:false,&quot;content&quot;:{&quot;type&quot;:&quot;Answer&quot;,&quot;token&quot;:&quot;141689844&quot;,&quot;upvote_num&quot;:30,&quot;comment_num&quot;:2,&quot;publish_timestamp&quot;:null,&quot;parent_token&quot;:&quot;54889600&quot;,&quot;author_member_hash_id&quot;:&quot;0b21747b1fec79ad8af7e68a2b1ff681&quot;}}}"><div class="ContentItem-meta"><div class="AuthorInfo AnswerItem-authorInfo AnswerItem-authorInfo--related" itemprop="author" itemscope="" itemtype="http://schema.org/Person"><meta itemprop="name" content="叛逆者"><meta itemprop="image" content="https://pic4.zhimg.com/ab952a4f1312716c6163c524fdbebdae_is.jpg"><meta itemprop="url" content="https://www.zhihu.com/people/minmin.gong"><meta itemprop="zhihu:followerCount" content="140871"><span class="UserLink AuthorInfo-avatarWrapper"><div class="Popover"><div id="Popover28-toggle" aria-haspopup="true" aria-expanded="false" aria-owns="Popover28-content"><a class="UserLink-link" data-za-detail-view-element_name="User" target="_blank" href="//www.zhihu.com/people/minmin.gong"><img class="Avatar AuthorInfo-avatar" width="38" height="38" src="https://pic4.zhimg.com/ab952a4f1312716c6163c524fdbebdae_xs.jpg" srcset="https://pic4.zhimg.com/ab952a4f1312716c6163c524fdbebdae_l.jpg 2x" alt="叛逆者"></a></div></div></span><div class="AuthorInfo-content"><div class="AuthorInfo-head"><span class="UserLink AuthorInfo-name"><div class="Popover"><div id="Popover29-toggle" aria-haspopup="true" aria-expanded="false" aria-owns="Popover29-content"><a class="UserLink-link" data-za-detail-view-element_name="User" target="_blank" href="//www.zhihu.com/people/minmin.gong">叛逆者</a></div></div><a class="UserLink-badge" data-tooltip="优秀回答者" href="https://www.zhihu.com/question/48509984" target="_blank"><span style="display: inline-flex; align-items: center;">​<svg class="Zi Zi--BadgeGlorious" fill="currentColor" viewBox="0 0 24 24" width="18" height="18"><g fill="none" fill-rule="evenodd"><path fill="#FF9500" d="M2.64 13.39c1.068.895 1.808 2.733 1.66 4.113l.022-.196c-.147 1.384.856 2.4 2.24 2.278l-.198.016c1.387-.122 3.21.655 4.083 1.734l-.125-.154c.876 1.084 2.304 1.092 3.195.027l-.127.152c.895-1.068 2.733-1.808 4.113-1.66l-.198-.022c1.386.147 2.402-.856 2.279-2.238l.017.197c-.122-1.388.655-3.212 1.734-4.084l-.154.125c1.083-.876 1.092-2.304.027-3.195l.152.127c-1.068-.895-1.808-2.732-1.66-4.113l-.022.198c.147-1.386-.856-2.4-2.24-2.279l.198-.017c-1.387.123-3.21-.654-4.083-1.733l.125.153c-.876-1.083-2.304-1.092-3.195-.027l.127-.152c-.895 1.068-2.733 1.808-4.113 1.662l.198.02c-1.386-.147-2.4.857-2.279 2.24L4.4 6.363c.122 1.387-.655 3.21-1.734 4.084l.154-.126c-1.083.878-1.092 2.304-.027 3.195l-.152-.127z"></path><path fill="#FFF" d="M12.034 14.959L9.379 16.58c-.468.286-.746.09-.617-.449l.721-3.025-2.362-2.024c-.417-.357-.317-.681.236-.725l3.1-.249 1.195-2.872c.21-.507.55-.512.763 0l1.195 2.872 3.1.249c.547.043.657.365.236.725l-2.362 2.024.721 3.025c.128.534-.144.738-.617.449l-2.654-1.621z"></path></g></svg></span></a></span></div><div class="AuthorInfo-detail"><div class="AuthorInfo-badge"><div class="AuthorInfo-badgeText"><span><span><a href="/people/minmin.gong/creations/19613730">计算机图形学</a>、</span><span><a href="/people/minmin.gong/creations/19584970">C++</a> </span>话题</span>的优秀回答者</div></div></div></div></div><div class="LabelContainer"></div><div class="AnswerItem-extraInfo"><span class="Voters"><button type="button" class="Button Button--plain">30 人赞同了该回答</button></span></div></div><meta itemprop="image" content=""><meta itemprop="upvoteCount" content="30"><meta itemprop="url" content="https://www.zhihu.com/question/54889600/answer/141689844"><meta itemprop="dateCreated" content="2017-01-18T19:19:26.000Z"><meta itemprop="dateModified" content="2017-01-18T19:19:26.000Z"><meta itemprop="commentCount" content="2"><div class="RichContent RichContent--unescapable"><div class="RichContent-inner"><span class="RichText ztext CopyrightRichText-richText" itemprop="text"><p>准确地说,RAISR并不是用来压缩图像的,而是用来upsample图像的。</p><p>众所周知,图片缩小到半分辨率后,在拉回原大小,会出现强烈的锯齿。从80年代开始就有很多super sampling的方法,要么从多张低分辨率的图构建出高分辨率,要么从单张“猜测”出高分辨率。本质上其实都是针对边缘搞事情。从锯齿状的边缘恢复出一条带斜率的线段。</p><p>用机器学习做这件事情,基本框架是<br>1. 拿到大量高分辨率的图像,对图片做分块,比如4x4。<br>2. 每个块都缩小到半分辨率。<br>3. 用半分辨率的块作为输入,全分辨率的块作为输出,训练。<br>4. 在Runtime,用半分辨率的块作为输入,就能预测出一个可以接受的全分辨率结果。</p><p>当然,在第三步,特征选取、调参数之类是必要的。DL嘛。</p><p>这其实Sony早就有了,X-Reality Pro芯片里就集成了一个,用来把1080p转成4k。不过不那么通用,重点是针对文字这样清晰边缘的,以处理亮度特征为主。</p>回到我一开始说的,为什么说RAISR不是压缩算法,而是upsample算法?因为即便是一个不存在高分辨率的图像,也可以通过这个算法得到高分辨率。</span></div><div><div class="ContentItem-time"><a target="_blank" href="/question/54889600/answer/141689844"><span data-tooltip="发布于 2017-01-19 03:19">发布于 2017-01-19</span></a></div></div><div class="ContentItem-actions"><span><button aria-label="赞同" type="button" class="Button VoteButton VoteButton--up"><span style="display: inline-flex; align-items: center;">​<svg class="Zi Zi--TriangleUp VoteButton-TriangleUp" fill="currentColor" viewBox="0 0 24 24" width="10" height="10"><path d="M2 18.242c0-.326.088-.532.237-.896l7.98-13.203C10.572 3.57 11.086 3 12 3c.915 0 1.429.571 1.784 1.143l7.98 13.203c.15.364.236.57.236.896 0 1.386-.875 1.9-1.955 1.9H3.955c-1.08 0-1.955-.517-1.955-1.9z" fill-rule="evenodd"></path></svg></span>赞同 30</button><button aria-label="反对" type="button" class="Button VoteButton VoteButton--down"><span style="display: inline-flex; align-items: center;">​<svg class="Zi Zi--TriangleDown" fill="currentColor" viewBox="0 0 24 24" width="10" height="10"><path d="M20.044 3H3.956C2.876 3 2 3.517 2 4.9c0 .326.087.533.236.896L10.216 19c.355.571.87 1.143 1.784 1.143s1.429-.572 1.784-1.143l7.98-13.204c.149-.363.236-.57.236-.896 0-1.386-.876-1.9-1.956-1.9z" fill-rule="evenodd"></path></svg></span></button></span><button type="button" class="Button ContentItem-action Button--plain Button--withIcon Button--withLabel"><span style="display: inline-flex; align-items: center;">​<svg class="Zi Zi--Comment Button-zi" fill="currentColor" viewBox="0 0 24 24" width="1.2em" height="1.2em"><path d="M10.241 19.313a.97.97 0 0 0-.77.2 7.908 7.908 0 0 1-3.772 1.482.409.409 0 0 1-.38-.637 5.825 5.825 0 0 0 1.11-2.237.605.605 0 0 0-.227-.59A7.935 7.935 0 0 1 3 11.25C3 6.7 7.03 3 12 3s9 3.7 9 8.25-4.373 9.108-10.759 8.063z" fill-rule="evenodd"></path></svg></span>2 条评论</button><div class="Popover ShareMenu ContentItem-action"><div class="ShareMenu-toggler" id="Popover70-toggle" aria-haspopup="true" aria-expanded="false" aria-owns="Popover70-content"><button type="button" class="Button Button--plain Button--withIcon Button--withLabel"><span style="display: inline-flex; align-items: center;">​<svg class="Zi Zi--Share Button-zi" fill="currentColor" viewBox="0 0 24 24" width="1.2em" height="1.2em"><path d="M2.931 7.89c-1.067.24-1.275 1.669-.318 2.207l5.277 2.908 8.168-4.776c.25-.127.477.198.273.39L9.05 14.66l.927 5.953c.18 1.084 1.593 1.376 2.182.456l9.644-15.242c.584-.892-.212-2.029-1.234-1.796L2.93 7.89z" fill-rule="evenodd"></path></svg></span>分享</button></div></div><button type="button" class="Button ContentItem-action Button--plain Button--withIcon Button--withLabel"><span style="display: inline-flex; align-items: center;">​<svg class="Zi Zi--Star Button-zi" fill="currentColor" viewBox="0 0 24 24" width="1.2em" height="1.2em"><path d="M5.515 19.64l.918-5.355-3.89-3.792c-.926-.902-.639-1.784.64-1.97L8.56 7.74l2.404-4.871c.572-1.16 1.5-1.16 2.072 0L15.44 7.74l5.377.782c1.28.186 1.566 1.068.64 1.97l-3.89 3.793.918 5.354c.219 1.274-.532 1.82-1.676 1.218L12 18.33l-4.808 2.528c-1.145.602-1.896.056-1.677-1.218z" fill-rule="evenodd"></path></svg></span>收藏</button><button type="button" class="Button ContentItem-action Button--plain Button--withIcon Button--withLabel"><span style="display: inline-flex; align-items: center;">​<svg class="Zi Zi--Heart Button-zi" fill="currentColor" viewBox="0 0 24 24" width="1.2em" height="1.2em"><path d="M2 8.437C2 5.505 4.294 3.094 7.207 3 9.243 3 11.092 4.19 12 6c.823-1.758 2.649-3 4.651-3C19.545 3 22 5.507 22 8.432 22 16.24 13.842 21 12 21 10.158 21 2 16.24 2 8.437z" fill-rule="evenodd"></path></svg></span>感谢</button><div class="Popover ContentItem-action"><button aria-label="更多" type="button" id="Popover71-toggle" aria-haspopup="true" aria-expanded="false" aria-owns="Popover71-content" class="Button OptionsButton Button--plain Button--withIcon Button--iconOnly"><span style="display: inline-flex; align-items: center;">​<svg class="Zi Zi--Dots Button-zi" fill="currentColor" viewBox="0 0 24 24" width="1.2em" height="1.2em"><path d="M5 14a2 2 0 1 1 0-4 2 2 0 0 1 0 4zm7 0a2 2 0 1 1 0-4 2 2 0 0 1 0 4zm7 0a2 2 0 1 1 0-4 2 2 0 0 1 0 4z" fill-rule="evenodd"></path></svg></span></button></div></div></div></div></div>

posted @ 2019-01-16 21:07  stardsd  阅读(1670)  评论(0编辑  收藏  举报