图像修复神器

Image Impainting for Irregular Holes

https://arxiv.org/pdf/1804.07723.pdf

在这篇之下 Adobe 的contexual Attenction显得十分鸡肋

https://arxiv.org/pdf/1801.07892.pdf

Existing deep learning based image inpainting methods use a standard convolutional network over the corrupted image, using convolutional filter responses conditioned on both valid pixels as well as the substitute values in the masked holes (typically the mean value).

Postprocessing is usually used to reduce such artifacts, but are expensive and may fail. We propose the use of partial convolutions, where the convolution is masked and renormalized to be conditioned on only valid pixels.

We further include a mechanism to automatically generate an updated mask for the next layer as part of the forward pass. Our model outperforms other methods for irregular masks. We show qualitative and quantitative comparisons with other methods to validate our approach.


现有的基于深度学习的图像修复方法在损坏的图像上使用一个标准卷积网络,使用有效像素以及被掩盖(mask)孔中的替代值(通常是平均值)条件下的卷积滤波器响应。 这个通常导致诸如颜色差异和模糊的伪像。 

后处理通常用于减少这种伪像,但是昂贵且可能会失败。 我们提出使用部分卷积,这其中卷积被掩盖并重新正规化以使用有效像素作为仅有的条件。

我们还包含一个机制来自动生成一个更新掩模作为前向传播的一部分的下一层。 我们的模型胜过其他方法为不规则的面具。 我们展示质化和量化与其他方法比较以验证我们的方法。


图像修复,填充图像中的孔的任务,可以用于许多应用。例如,它可以用于图像编辑以去除不需要的图像内容,同时用合理的图像填充结果空间。以前的深度学习方法主要集中在位于图像中心附近的矩形区域,并且通常依赖于昂贵的后期处理。这项工作的目标是提出一种图像修复模型,该模型可以在不规则孔模式下稳健运行(见图1),并产生语义上有意义的预测,与图像的其余部分平滑结合,而不需要任何额外的后处理或混合操作。最近的图像修复方法不使用深度学习,而使用图像剩余图像的统计数据填入孔中。 PatchMatch [3],最先进的方法之一,它迭代搜索最适合的补丁来填充在孔里。虽然这种方法通常会产生平滑的结果,但它受可用图像统计量的限制,并没有视觉语义学的概念。例如,在图2(b)中,PatchMatch能够使用来自周围阴影和墙壁的图像补丁平滑地填充绘画的缺失组件,但是语义感知方法将使用绘画中的补丁代替。

深度神经网络以端到端的方式学习语义先验和有意义的隐藏表示,已经用于最近的图像修复工作。这些网络在图像上使用卷积滤波器,用固定值替换已删除的内容。因此,这些方法受到初始孔值的依赖,


As a result, these approaches suffer from dependence on the initial hole values, which often manifests itself as lack of texture in the hole regions, obvious color contrasts, or artificial edge responses surrounding the hole. Examples using a U-Net architecture with typical convolutional layers with various hole value initialization can be seen in Figure 2(e) and 2(f). (For both, the training and testing share the same initalization scheme). Conditioning the output on the hole values ultimately results in various types of visual artifacts that necessitate expensive post-processing. For example, Iizuka et al. [1] uses fast marching [4] and Poisson image blending [5], while Yu et al. [2] employ a following-up refinement network to refine their raw network predictions.However, these refinement cannot resolve all the artifacts shown as 2(c) and 2(d).

结果,这些方法受到依赖于初始孔值的影响,这通常表现为孔区缺乏纹理,明显的颜色对比或人为的边缘响应。在图2(e)和2(f)中可以看到使用具有各种孔值初始化的典型卷积层的U-Net架构的例子。(对于这两者,训练和测试共享相同的初始化计划)。调整孔值的输出最终导致各种类型的视觉伪象,这需要昂贵的后处理。例如,Iizuka等人[1]使用快速前进[4]和泊松图像混合[5],而余等人。 [2]采用后续改进网络来改进其原始网络预测。


However, these refinement cannot resolve all the artifacts shown as 2(c) and 2(d).Our work aims to achieve well-incorporated hole predictions independent of the hole initialization values and without any additional post-processing. Another limitation of many recent approaches is the focus on rectangular shaped holes, often assumed to be center in the image. We find these limitations may lead to overfitting to the rectangular holes, and ultimately limit the utility of these models in application. Pathak et al. [6] and Yang et al. [7] assume 64 × 64 square holes at the center of a 128×128 image. Iizuka et al. [1] and Yu et al. [2] remove the centered hole assumption and can handle irregular shaped holes, but do not perform an extensive quantitative analysis on a large number of images with irregular masks (51 test images in [8]). In order to focus on the more practical irregular hole use case, we collect a large benchmark of images with irregular masks of varying sizes. In our analysis, we look at the effects of not just the size of the hole, but also whether the holes are in contact with the image border.


然而,这些细化并不能解决所有2(c)和2(d)显示的伪像。我们的工作旨在实现独立于孔的有良好适应性的孔预测,并且不需要任何额外的后处理。许多最近的方法的另一个限制是矩形通常被认为是图像中心这个关注点。我们发现这些限制可能导致过拟合矩形孔,并最终限制了实用性这些模型在应用中。 Pathak等人[6]和杨等人。 [7]假设128×128图像中心的64×64方孔。 Iizuka等人[1]和余等人。 [2]去除中心孔的假设,并可以处理不规则形状但是不要对大量不规则掩模的图像进行广泛的定量分析([8]中的51个测试图像)。为了专注于更实用的不规则孔使用案例,我们收集了大量的图像基准与不规则的大小不同的Mask。在我们的分析中,我们看看效果不只是孔的大小,而且孔是否与图像边界接触。


To properly handle irregular masks, we propose the use of a Partial Convolutional Layer, comprising a masked and re-normalized convolution operation followed by a mask-update step. The concept of a masked and re-normalized convolution is also referred to as segmentation-aware convolutions in [9] for the image segmentation task, however they did not make modifications to the input mask. Our use of partial convolutions is such that given a binary mask our convolutional results depend only on the non-hole regions at every layer. Our main extension is the automatic mask update step, which removes any masking where the partial convolution was able to operate on an unmasked value.Given sufficient layers of successive updates, even the largest masked holes will eventually shrink away, leaving only valid responses in the feature map. The partial convolutional layer ultimately makes our model agnostic to placeholder hole values.

为了正确处理不规则的蒙版,我们建议使用部分卷积层,包含一个掩蔽(mask)和重新归一化的卷积操作接着是Mask更新步骤。Mask和重新规范化的概念卷积在[9]中也被称为图像分割任务的分割感知卷积,但是他们没有对输入进行修改Mask。我们使用的局部卷积是这样的:给定一个二进制掩码卷积结果仅取决于每一层的非孔区域。我们的主要扩展是自动Mask更新步骤,它可以删除任何Mask局部卷积能够在未Mask的值上进行操作。如果有足够的连续更新层次,即使是最大的Mask孔也最终会缩小,只在特征映射中留下有效的响应。该局部卷积层最终使我们的模型对占位符不可知孔值。

(让我相当Mask RCNN)

总之,我们做出以下贡献:

- 我们建议使用带有自动Mask更新的部分卷积实现图像修复的最新技术。

- 在具有典型卷积的U-Net [10]中以前的工作中无法通过跳转链接获得良好的修补效果,我们证明替换具有部分卷积和掩模更新的卷积层可以实现最新的修补结果。

- 据我们所知,我们是第一个在不规则形状的孔上训练图像修复模型证明其功效的。 - 我们提出一个大型的不规则掩模数据集,并将公开发布以促进未来在培训和评估修补模型方面的努力。


3 Approach

Our proposed model uses stacked partial convolution operations and mask updating

steps to perform image inpainting. We first define our convolution and

mask update mechanism, then discuss model architecture and loss functions.

3.1 Partial Convolutional Layer

For brevity, we refer to our partial convolution operation and mask update function

jointly as the Partial Convolutional Layer.

Let W be the convolution filter weights for the convolution filter and b its

the corresponding bias. X are the feature values (pixels values) for the current

convolution (sliding) window and M is the corresponding binary mask. The

partial convolution at every location, similarly defined in [9], is expressed as:


相关研究

非学习方法:

1)传播邻近区域的外观 propagate appearance information from neighboring pixels to the target region using some mechanisms Distance Field: 只能处理小hole。大hole over-smoothing或者artifacts

2) PatchBased  寻找非hole区域的补丁Iteratively

PatchMatch加速了。但还是太慢了

深度学习方法

初始化constant placeholder values ---> CNN ---> postprocess

1)Content Encoders + Propagate the texture information from non-hole regions to fill the hole regions as postprocessing.

2)blurry initial hole-filling result is used as the input to a network replaced with patches from the closest non-hole regions in the feature space

3)  both global and local discriminators; Poisson blending as a post-process

4)contextual attention layers.

ignore mask placeholder values (we do)

1)searches for the closest encoding to the corrupted image in a latent space, which is then used to condition the output of a hole-filling generator

2) network needs no external dataset training and can rely on the structure of the generative network itself to complete the corrupted image.

缺点: 

1)different set of hyper parameters for every image

2)applies several iterations to achieve good results

3)not able to use skip links, which are known to produce detailed outputs ( we can)

4) With standard convolutional layers, the raw features of noise or wrong hole initialization values in the encoder stage will propagate to the decoder stage.

Our Work:

-makes extensive use of a masked or reweighted convolution operation(which allows us to condition output only on valid inputs.)

-single forward pass

Previous Example for Masked Conv Ops:

-soft attention mask for semantic segmentation

-PixelCNN (condition the next pixel only on previously synthesized pixels)


What is Partial Conv?

a special case of the normalized convolution


Our Contri for Partial Conv:

-further update the input mask for the next layer based on where the partial convolution

was able to make a valid response


Our Model:

- encoder-decoder architecture

-with sufficient receptive fields such that the mask is fully valid before it enters the decoder half

-simplifies the decoding process.


Section 3 Model

Our proposed model uses stacked partial convolution operations and mask updating steps to perform image inpainting. 

3.1 define our convolution and mask update mechanism, 


3.2  model architecture 

略。 看原文吧

3.3 loss functions.

©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 160,165评论 4 364
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 67,720评论 1 298
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 109,849评论 0 244
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 44,245评论 0 213
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 52,596评论 3 288
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 40,747评论 1 222
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 31,977评论 2 315
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 30,708评论 0 204
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 34,448评论 1 246
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 30,657评论 2 249
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 32,141评论 1 261
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 28,493评论 3 258
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 33,153评论 3 238
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 26,108评论 0 8
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 26,890评论 0 198
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 35,799评论 2 277
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 35,685评论 2 272

推荐阅读更多精彩内容

  • rljs by sennchi Timeline of History Part One The Cognitiv...
    sennchi阅读 7,110评论 0 10
  • 生活可以为自己,多姿多彩,多有趣
    doris6788阅读 171评论 0 0
  • 今天乒乓球桌到了,装了一个晚上。自己耍了一会,感觉还不错,以后多锻炼身体!
    paul7阅读 109评论 0 0
  • 昨天没时间听得朋友可以再看看,朱老师是用真心来为大家授课的,听得我感动地都流泪了,一会我要再发出去,大家真得不要错...
    溪溪西子阅读 593评论 19 16
  • 我原本以为 错过了 那个季节 我不会再见到你啦 却不料 你在六月 在那遥远的地方 安了家 世界很大 我好想随你听听...
    本无痕阅读 399评论 65 55