When Daniel learned Bodhidharma hospital matting, it's all out of control ......

In the eyes of the outside world, Bodhidharma hospital talent, mostly Oddities, doing mysterious and high-end research, sweeping monk like existence in general, but if one day, when the mystery is no longer mysterious expert, you find that they have begun to play matting, and it's all moving in the direction of the development of the uncontrolled time, then digging out what they can play tricks?

You see, then everything can pull!

gif_


Section Source Taobao Images

Replace the video to try? can!

Why should we started to study matting?

This is from Alibaba intelligent design laboratory independent research and development of a product design deer classes start. Deer classes intention is to change the traditional design pattern, so do a lot in a short time chart banner, poster design diagrams and venue map, improve work efficiency. Figure merchants upload baby uneven, ineffective served directly by deer drawing class venue can guarantee a unified style, high-quality visual effects to convey, so as to enhance the attractiveness and buyers of goods visual experience, to achieve the purpose of enhancing product conversion.

In the process of drawing, we find the goods matting is an inevitable and tedious work, a portrait fine matting designer takes an average of more than 2h time, so no need creative pure physical work need to be AI by replace, our matting algorithm came into being.

In recent years, image matting algorithm gradually into view, such as Tencent (FIG day P), Baidu (portrait matting, car division) and the like. And lurking in the back of the industry: the Pan-entertainment, electricity supplier industry, vertical industry, such as online catering, media, education and other sectors of commercial value should not be underestimated, meet a variety of battlefield, online courses, teacher matting, video production and other different cover forms of picture production needs expand. Some algorithms matting effect on the market in portrait hair details of the deal were not very good, and some common scenarios (electricity supplier, etc.) support is not very good. We focused on these two issues on the one hand the system design is more generalization ability, on the one hand deepen hair and pierced highly relevant algorithms have better results.

Problems encountered and solutions

我们最开始在上手鹿班“批量抠图”需求时,发现用户上传的图像质量、来源、内容五花八门,想用一个模型实现业务效果达到一劳永逸很难。在经过对场景和数据的大量分析后,定制整体框架如下:

image

主要涵盖了过滤、分类、检测、分割四个模块:

•过滤:滤掉差图(过暗、过曝、模糊、遮挡等),主要用到分类模型和一些基础图像算法;

•分类:瓶饮美妆等品类商品连通性比较好,3C、日用、玩具等品类则反之,另外场景(如人头、人像、动物)需求也是各具差异,故而设计不同的分割模型提升效果;

•检测:在鹿班场景用户数据多来自于商品图,很多是经过高度设计的图像,一图多商品、多品类、主体占比小,也不乏文案、修饰、logo等冗余信息,增加一步检测裁剪再做分割效果更精准;

•分割:先进行一层粗分割得到大致mask,再进行精细分割得到精确mask,这样一方面可以提速,一方面也可以精确到发丝级;
如何让效果更精准?

目前分类、检测模型相对比较成熟,而评估模型则需要根据不同场景做一些定制(电商设计图、天然摄影图等),分割精度不足,是所有模块中最薄弱的一个环节,因此成为了我们的主战场。详述如下:

•分类模型:分类任务往往需要多轮的数据准备,模型优化,数据清洗才能够落地使用。据此,我们设计完成了一个自动分类工具,融合最新的优化技术,并借鉴autoML的思想,在有限GPU资源的情况下做参数和模型搜索,简化分类任务中人员的参与,加速分类任务落地。

•评估模型:直接使用回归做分数拟合,训练效果并不好。该场景下作为一个前序过滤任务,作为分类问题处理则比较合理。实际我们也采用一些传统算法,协助进行过暗、过曝等判断。

•检测模型:主要借鉴了FPN检测架构。

1、对特征金字塔每一层featuremap都融合上下相邻层特征,这样输出的特征潜在表征能力更强;
2、特征金字塔不同层特征分别预测,候选anchors可增加对尺度变化的鲁棒性,提升小尺度区域召回;
3、对候选anchor的设定增加一些可预见的scale,在商品尺寸比例比较极端的情况下大幅提升普适性;

•分割融合模型:参考论文>>点击查看<<
与传统的只需要分别前景、背景的图像分割(segmentation)问题不同,高精度抠图算法需要求出某一像素具体的透明度是多少,将一个离散的0-1分类问题变成[0, 1]之间的回归问题。在我们的工作中,针对图像中某一个像素p,我们使用这样一个式子来进行透明度预测:

image

其中imageimage分别代表了这个像素属于前景和背景的概率,image是混合权重。我们的网络可整体分为两部分,分割网络和融合网络,如下图:

image

分割网络:我们使用了在图像分割任务中常用的编-解码器结构作为我们的基础结构,但与传统结构不同,我们的网络中使用了双解码器分别来预测前、背景概率imageimage。如果像素p在图像的实心区域(透明度为0或1),我们预测像素透明度的真实值;如果p在图像的半透明区域(透明度值在0到1之间),我们预测像素透明度真实值的上下界。通过在半透明区域使用加权的交叉熵损失函数,使imageimage的值相应升高,即可将透明度的真实值“包裹”!在image这一区间中。

image


右图中红色部分即是被前背景概率包住的像素!

融合网络:由数个连续卷积层构成,它负责预测混合权重image。注意,在图像的实心区域,像素的前背景预测往往容易满足image这一条件,此时imageimage求导恒为0,这一良好性质令融合网络在训练时可以自动“聚焦”于半透明区域。

应用产品化开放

得以商业应用的基础是我们在应用层单点能力,如人像/人头/人脸/头发抠图、商品抠图、动物抠图,后续还会逐步支持卡通场景抠图、服饰抠图、全景抠图等。据此我们也做了一些产品化工作,如鹿班的批量白底图功能、E应用证件照/战报/人物换背景(钉钉->我的->发现->小程序->画蝶)等。

试用地址:https://ivpd.console.aliyun.com/api-image
接入说明:https://help.aliyun.com/document_detail/139269.html

Business Cooperation information please poke link: https://page.aliyun.com/form/act854786621/index.htm

image

Guess you like

Origin yq.aliyun.com/articles/741223