图像技术在上亿规模实拍图片中的应用(算法好文)

{"type":"doc","content":[{"type":"heading","attrs":{"align":null,"level":2},"content":[{"type":"text","text":"背景"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"闲鱼作为一个自由的商品和内容分发市场,每天有上百万的用户图片上传,其中不乏图片重复,图片描述内容不明确、图文不符等低质量的商品;也有各种搞笑、抖机灵等倒流的内容;还有色情、黑产等违规或违法灰色地带。如果让这些低质的商品和内容都正常流入每天日常的商品展示中,不但会影响用户的交易效率,还会降低产品在市场中的口碑和价值,甚至增加被监管治理和叫停的风险,其中较为典型的问题包括:"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"bulletedlist","content":[{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"图片内容重复:在闲鱼日常的发布内容中,有些卖家为了增加自己商品的曝光机会用不同的描述和图片创建多个相同商品进行投放,这时文本的表述可能完全不同,但商品图片看上去基本一样如图1所示:"}]}]}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"image","attrs":{"src":"https:\/\/static001.geekbang.org\/infoq\/b4\/b4094e354e1a8b215350a20258b716db.png","alt":"图片","title":"null","style":[{"key":"width","value":"75%"},{"key":"bordertype","value":"none"}],"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":"center","origin":null},"content":[{"type":"text","text":"图1.相同商品图片"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"bulletedlist","content":[{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"图文内容不一致:部分图片内容与所售商品描述不一致,在排序时这些商品与其他一致的商品混排在一起时会影响整体搜索的体感和效果,如图2所示;"}]}]}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"image","attrs":{"src":"https:\/\/static001.geekbang.org\/infoq\/49\/490db40173870ecc5f94168a71aa2c14.png","alt":"图片","title":"null","style":[{"key":"width","value":"75%"},{"key":"bordertype","value":"none"}],"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":"center","origin":null},"content":[{"type":"text","text":"图2.商品图片和文本描述差异"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"bulletedlist","content":[{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"图片内容质量:用户上传的图片不是所有图片都适合做商品图片展示的,例如商品包装,商品局部,非商品图片,发票单据,商品描述图等,如图3;"}]}]}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"image","attrs":{"src":"https:\/\/static001.geekbang.org\/infoq\/6a\/6a1290a02692dcbc3ab229977cb394d1.png","alt":"图片","title":"null","style":[{"key":"width","value":"75%"},{"key":"bordertype","value":"none"}],"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":"center","origin":null},"content":[{"type":"text","text":"图3.不适合的商品图片"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"bulletedlist","content":[{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"违规:一些卖家为了吸引买家的注意,会把一些如美女、性感和搞笑等违规图片作为商品主图导流,严重影响闲鱼的品牌价值和公平优良的交易环境,如图4。"}]}]}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"image","attrs":{"src":"https:\/\/static001.geekbang.org\/infoq\/f5\/f5bce70bcfcc01c68ab9b8fb6f749ffc.png","alt":"图片","title":"null","style":[{"key":"width","value":"75%"},{"key":"bordertype","value":"none"}],"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":"center","origin":null},"content":[{"type":"text","text":"图4.美女首图商品"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"上述问题都可以归结为和视觉技术所涉及的范围,实际上互联网公司已经大规模的应用相关技术解决实际问题,例如阿里、百度、腾讯等头部公司都有自己的视觉算法团队,每年各大顶会也都是常客。大家不但探索相关的前沿技术,同时将其转化应用到实际的产品中,如图像特征在拍立淘、百度识图中的应用,图像检测直接运用在自动驾驶和工业质检中,图像识别相关技术分别在审核、短视频、广告等业务得到广泛的应用。本文针对闲鱼产品中涉及的部分问题介绍如何利用视觉技术解决,例如图片内容本身非商品或是色情等违规的物料都是可以利用图像分类,图像特征等方法去解决,以下主要从以下几个部分介绍:"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"numberedlist","attrs":{"start":null,"normalizeStart":1},"content":[{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":1,"align":null,"origin":null},"content":[{"type":"text","text":"构建大规模图片分类模型,学习闲鱼产品中的图片分布特征;"}]}]},{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":2,"align":null,"origin":null},"content":[{"type":"text","text":"基于分类模型学习图像比对特征;"}]}]},{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":3,"align":null,"origin":null},"content":[{"type":"text","text":"组合图像分类和图像特征解决实际问题;"}]}]}]},{"type":"heading","attrs":{"align":null,"level":2},"content":[{"type":"text","text":"构建大规模图片分类模型"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"图像分类模型是视觉模型的基础,检测,分割等视觉问题都依赖基础的图像的分类模型。在闲鱼场景构建图像分类模型存在以下几个难点:"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"numberedlist","attrs":{"start":null,"normalizeStart":1},"content":[{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":1,"align":null,"origin":null},"content":[{"type":"text","text":"图片大部分是用户上传,图像质量偏低,增加识别难度;"}]}]},{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":2,"align":null,"origin":null},"content":[{"type":"text","text":"图片内容不限于商品类目本身,涵盖很多和商品不相关其他类别,整体类别定义困难;"}]}]},{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":3,"align":null,"origin":null},"content":[{"type":"text","text":"闲鱼商品的title是由用户自己填写的,结构化信息参差不齐,同时还包含很多口语化的噪声;"}]}]},{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":4,"align":null,"origin":null},"content":[{"type":"text","text":"同类的商品包含的噪声图片很大,不能直接训练"}]}]},{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":5,"align":null,"origin":null},"content":[{"type":"text","text":"数据标注成本高,短时间内不能有效覆盖大部分数据;"}]}]}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"我们这里要求不直接识别出众多的具体商品类目名称,只要可以区分彼此即可,对于需要重点识别的类别,我们采用训练好的特征进行样本挖掘,整体流程如图5所示,包括基础图像特征学习,聚类样本构建,和分类模型的训练:"}]},{"type":"image","attrs":{"src":"https:\/\/static001.geekbang.org\/infoq\/fc\/fcc5d2be6d3b0b60846f9893e4fd8e38.png","alt":"图片","title":"null","style":[{"key":"width","value":"75%"},{"key":"bordertype","value":"none"}],"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":"center","origin":null},"content":[{"type":"text","text":"图5.半自动图像分类识别"}]},{"type":"heading","attrs":{"align":null,"level":3},"content":[{"type":"text","text":"基础图像特征学习"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"基础图像模型主要是为了学习数据的整体分布,在尽可能提高样本覆盖的情况下发掘较简单的样本使得模型可以冷启动。首先根据线上的query请求的展示结果,收集高频query下的点击商品作为候选集合,因为有用户误点击和高点击导流样本存在,所以需要过滤掉点击率偏低和偏高的商品样本,同时需要语义相近的query进行去重,经过上述几步就构成了图像分类的基础数据。模型训练采用resnet101模型,对比了softmax和arcface[5]两种损失的效果,结果softmax好于arcface,原因可能是因为样本不纯arcface很难收敛到较好的目标。"}]},{"type":"heading","attrs":{"align":null,"level":3},"content":[{"type":"text","text":"聚类样本构建"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"有了基础模型后,接下来需要收集闲鱼类目样本。首先收集闲鱼每个类目下商品样本,这步可以把语义概念控制在一定的范围内,接下来根据title中的中心词的命中率把该类目下下样本划分为不同的子类目,每个子类目下的样本都有明确的语义含义,但是图片存在较大变化如上图8-1所示“詹姆斯”这个子类目下的样本存在多个品类的情况,这类样本无法直接训练。这时我们可以利用上面得到的基础图像特征对子类目下的样本提纯,即在每个子类目类做聚类,把互为图像特征余弦距离最近的样本聚合成新的类别,过滤掉样本较少的类目,最终就得到了我们训练闲鱼场景下的图像分类样本,针对不同的距离阈值,我们分别选取了4.6K,7.4K,12K三组类目细分类,人工评估效果7.4K较为理想,其他两个对样本的划分要么太粗要么太细。"}]},{"type":"heading","attrs":{"align":null,"level":3},"content":[{"type":"text","text":"分类模型的训练"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"基于之前的分类模型参数,训练新的类目标签,采用batchsize=256, centercorp=224, 加入随机crop,镜像,cutout预处理,学习率采用cos学习率同时在一定轮数加入热重启,使模型在后期还能进一步提升准确率,最终验证集合top@1准确率74%,基本达到了应用要求。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"为了能识别票据,文字图,建筑物,人物等特定类别,我们需要对这些类别做定制的样本挖掘:通过已经训练好的模型抽取特征搭建商品库的检索系统,收集需要特殊处理的样本进行最紧邻查找,对查找后的结果卡阈值并再次进行检索继续扩充需要的样本集合如图6,最终合并这些类目与原有类目一起训练。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"image","attrs":{"src":"https:\/\/static001.geekbang.org\/infoq\/8c\/8cf321b6d628ed3462a92410afade3d1.png","alt":"图片","title":"null","style":[{"key":"width","value":"75%"},{"key":"bordertype","value":"none"}],"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":"center","origin":null},"content":[{"type":"text","text":"图6.特定类目样本挖掘"}]},{"type":"heading","attrs":{"align":null,"level":2},"content":[{"type":"text","text":"基于分类模型学习图像比对特征"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"比对特征主要是用来判断商品是否同款,过滤掉或打散图片重复的商品。由于系统里每个商品已经单独定义,所以这里采用deepid[1][2]][3]方案,训练同款特征,但直接用每个商品的图片训练存在两个问题:1.每个id类别存在变化较大的多张图片并不能直接使用所有图片;2.每个id类目的样本稀少,直接训练很难收敛。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"针对上述问题1我们有个先验的假设即用户上传的多张图片中与商品主要意图相关的图片占大多数,所以我们可以借鉴之前聚类的思路,在同一个商品的多张图片中进行聚类,选取样本最多的类别为我们的候选集合,如果类别间的样本相差不大则认为该商品不适合做训练应丢弃。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"为了每个类别都可以尽可能挖掘到同款样本,我们选取在线上同一个query下有交易行为的商品和点击率较高的商品作为候选集合同时对每个商品内部进行聚类保证样本纯度,在实验时我们发现品牌类query或品类query下的样本存在较大的多样性,如“安踏”、“华为手机”、“电动车”,即使点击行为较为稠密,但可能属于不同sku的商品,所以我们需要对query进行限制,尽量保证query到单独sku粒度消除歧义性,如“华为p40 pro”、“极米投影仪h3”、“小牛电动车G2”。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"有了上述的样本我们就可以训练deepid模型,这里采用人脸常用的arcface loss[5], backbone选择之前的分类模型和初始化参数,开始阶段先用较小margin参数,然后遍历scale参数,经过选取合适的margin和scale后训练模型到饱和,接下来增大margin参数同样选取合适的scale参数训练,经过3次这样的迭代使模型在不过拟合的情况下训练,最终相款识别准确率95%, 商品sku内召回79%。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"基于同款特征也可以用于在相同识别的场景中,即利用同款特征做召回再利用sift特征做最后的几何校验,可以实现对旋转、部分裁剪和遮挡的相同图识别。"}]},{"type":"heading","attrs":{"align":null,"level":2},"content":[{"type":"text","text":"组合图像分类和图像特征解决相关性和多样性问题"}]},{"type":"heading","attrs":{"align":null,"level":3},"content":[{"type":"text","text":"闲鱼搜索相关性问题"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"针对用户提交商品图片多样性的特点,为了提升搜索体感,采用首图相关性聚类的方式重排检索结果如下图7-1示例,以“锐鲨”搜索query为例:图7.1 举例对照组检索结果,可以看出整体队列都是和便携工具相关的商品,但也存在包装(坑位1,6)和歧义(坑位3)的体验不好的case,通过上述的商品图像分类模型对商品多张图片进行预测并聚类,我们可以得到每个商品的主要的top3类别,随后统计整个队列的top类别做为该队列置信类别,最后根据置信度分档重排,结果参考图7.2看到top商品都是移动工具相关。另一个case如图8.1所示query为“詹姆斯”经过图像特征重排球鞋这个主要类别被重排到前排如图8.2,其他一些不太相关的类别被降权。线上的case中,也会有badcase,例如有些query如“华为”,“苹果”存在多类别是否需要重排需要根据用户反馈进行优化,重排的实验结果如下,点击率还是有明显的提升。"}]},{"type":"image","attrs":{"src":"https:\/\/static001.geekbang.org\/infoq\/cd\/cd74334ea426b0b30280a2e593aef29d.png","alt":"图片","title":null,"style":[{"key":"width","value":"75%"},{"key":"bordertype","value":"none"}],"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"image","attrs":{"src":"https:\/\/static001.geekbang.org\/infoq\/55\/550234821518a66d647de1f06a58b806.png","alt":"图片","title":"null","style":[{"key":"width","value":"75%"},{"key":"bordertype","value":"none"}],"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":"center","origin":null},"content":[{"type":"text","text":"图7.1.query=\"锐鲨\" 对照组top6结果"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"image","attrs":{"src":"https:\/\/static001.geekbang.org\/infoq\/ac\/acd41ceee1ecd042e77ea706a585e53e.png","alt":"图片","title":"null","style":[{"key":"width","value":"75%"},{"key":"bordertype","value":"none"}],"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":"center","origin":null},"content":[{"type":"text","text":"图7.2.query=\"锐鲨\"图像特征重拍实验组top6结果"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":"center","origin":null}},{"type":"image","attrs":{"src":"https:\/\/static001.geekbang.org\/infoq\/98\/984d8a952c62f4a2330b3eb3fb1b17f3.png","alt":"图片","title":"null","style":[{"key":"width","value":"75%"},{"key":"bordertype","value":"none"}],"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":"center","origin":null},"content":[{"type":"text","text":"图8.1.query=\"詹姆斯\" 对照组top6结果"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":"center","origin":null}},{"type":"image","attrs":{"src":"https:\/\/static001.geekbang.org\/infoq\/3a\/3acd23ca8225f2c8cee5506b37813935.png","alt":"图片","title":"null","style":[{"key":"width","value":"75%"},{"key":"bordertype","value":"none"}],"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":"center","origin":null},"content":[{"type":"text","text":"图8.2.query=\"詹姆斯\"图像特征重拍实验组top6结果"}]},{"type":"heading","attrs":{"align":null,"level":3},"content":[{"type":"text","text":"闲鱼Feed多样性问题"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"多样性是推荐效果的一个重要的指标,相关结果太集中会影响用户的体验。闲鱼用户定义的商品特殊性,在多样性问题上很难用一种方法解决,需要利用类目,文本描述,商品图片等多维度共同解决,其中商品图片多样性问题解法与上面搜索一致性问题有些相似。如下图9.1所示,同为“华为mate Xs”一款商品,用户定义类目可能属于不同类别,所以直接用户定义类目无法做多样性处理,但从图片维度我们可以发现这些商品有相同的元素即商品包装图片, 所以可以利用图像分类模型分别对每个商品图片进行预测类目实现打散。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"image","attrs":{"src":"https:\/\/static001.geekbang.org\/infoq\/8c\/8c998a76e8c405aaac0e7bc5250f5760.png","alt":"图片","title":"null","style":[{"key":"width","value":"75%"},{"key":"bordertype","value":"none"}],"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":"center","origin":null},"content":[{"type":"text","text":"图9.1 视觉同类但提交类目不同的case举例"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"首先需要过滤掉人物和文字类目这些图像表示一致但语义变化很大的商品不做处理,之后对商品的多张商品图进行类目预测并对预测后的置信度top1的类目进行聚合,具有相同类目的商品即为将要去重的候选集合,实际中发现有些相同商品的top1类目并不相同,可能是在top3中,但直接使用top3去重影响面会很大,会带来不少badcase,所以这里采用迭代两次方式即对top1聚合后的结果top3类目投票,选取具有非共现但投票过半的类目进行第二次去重如9.2所示,经过两次去重后可对文本和类目不好去重的case有效的补充。"}]},{"type":"image","attrs":{"src":"https:\/\/static001.geekbang.org\/infoq\/cc\/cccf21e920bc47180cb18cea0d681855.png","alt":"图片","title":"null","style":[{"key":"width","value":"75%"},{"key":"bordertype","value":"none"}],"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":"center","origin":null},"content":[{"type":"text","text":"图9.2 图像多样性去重逻辑"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"上线后各项指标都有提升"}]},{"type":"image","attrs":{"src":"https:\/\/static001.geekbang.org\/infoq\/6e\/6e0ad708779ad66a3ee4ac9ca3e3caa0.png","alt":"图片","title":null,"style":[{"key":"width","value":"75%"},{"key":"bordertype","value":"none"}],"href":null,"fromPaste":true,"pastePass":true}},{"type":"heading","attrs":{"align":null,"level":3},"content":[{"type":"text","text":"相同商品图片去重"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"闲鱼商品中有的卖家为了增加自己的曝光会创建多个商品并采用相似的描述和视觉上变化很小的商品图片,另外还有一些卖家会使用相同原始的商品图片,这类商品如果出现在同一个搜索结果页会带来不好的用户体验,也会降低商品的交易效率。这里利用之前图像对比特征搭建图像搜索引擎,索引方式采用通用的乘积量化的方法构建1.2亿商品库,整体流程如下图10.1。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"每天实时的商品相对全库比例较小,我们不需要做到实时精准去重,所以我们采用离线的去重方案:首先每天新增商品会以增量的方式入库,在构建索引的同时会同步当前的商品在架、是否有效等状态过滤掉无效的商品,然后利用乘积量化的方法构建离线去重检索引擎,每天新增的商品会经过去重检索引擎找到与库里相同的商品并更新到线上的KV存储中,由于原有库中的商品和新商品产生了新链接关系,所以还需要根据新的链接匹配关系去更新KV存储中原有库中该商品的相同商品列表。线上的请求在完成召回后,会根据召回的商品id去KV存储中实时查询对应的相同商品,最后打散逻辑会对当前页中命中的相同商品进行分页打散完成去重。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"image","attrs":{"src":"https:\/\/static001.geekbang.org\/infoq\/e9\/e93bb682d914008aec548d6e14767c84.png","alt":"图片","title":"null","style":[{"key":"width","value":"75%"},{"key":"bordertype","value":"none"}],"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":"center","origin":null},"content":[{"type":"text","text":"10.1 商品离在线去重方案"}]},{"type":"heading","attrs":{"align":null,"level":3},"content":[{"type":"text","text":"不合规商品过滤"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"闲鱼中的不合规商品主要包括美女首图,性感首图,搞笑图片,人体局部等,但实际出售的商品和这些商品图片没有任何关系,卖家使用这类图片主要是为了吸引用户的注意骗取流量。采用普遍使用的审核模型、OCR识别可以过滤掉大多数色情、涉黄、涉政和暴恐等非法内容。然后还有些违规类的商品如图11.2和搞笑、段子类的内容如图11.3影响正常的交易市场,这类问题无法直接用审核等模型过滤掉。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"image","attrs":{"src":"https:\/\/static001.geekbang.org\/infoq\/c7\/c71867068545de36a35177f18f16e494.png","alt":"图片","title":"null","style":[{"key":"width","value":"75%"},{"key":"bordertype","value":"none"}],"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":"center","origin":null},"content":[{"type":"text","text":"11.1 违规商品识别流程"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"针对与上述问题,我们设计了违规商品识别的方案如图11.1所示,因为涉及到线上业务策略这里不做详细描述,新增商品会经过两个逻辑判断是否违规:"}]},{"type":"numberedlist","attrs":{"start":null,"normalizeStart":1},"content":[{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":1,"align":null,"origin":null},"content":[{"type":"text","text":"首先识别和人相关的主图,利用通用分类给所有商品图片打标签,然后过滤掉语义不一致的商品,但这是会有一定的badcase如图11.4,这里的用户晒单是正常的商品,所以我在过滤后还需判断是否有同款的商品,如果识别同款,则会通过该商品;"}]}]},{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":2,"align":null,"origin":null},"content":[{"type":"text","text":"搞笑、段子类的图片一般都为热门图片,虽然会有可能再编辑,但主题内容是没变化的,这类图片通过建立违规内容库利用相同识别可以得到解决,如图11.1中的相同图识别分支;"}]}]}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"image","attrs":{"src":"https:\/\/static001.geekbang.org\/infoq\/93\/93043e1844368722c5e40b8f4aa4e51d.png","alt":"图片","title":"null","style":[{"key":"width","value":"75%"},{"key":"bordertype","value":"none"}],"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":"center","origin":null},"content":[{"type":"text","text":"11.2 违规商品示例"}]},{"type":"image","attrs":{"src":"https:\/\/static001.geekbang.org\/infoq\/e8\/e84cd7f2b7bc15b7fc7c9b510e6a7002.png","alt":"图片","title":"null","style":[{"key":"width","value":"75%"},{"key":"bordertype","value":"none"}],"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":"center","origin":null},"content":[{"type":"text","text":"11.3 非商品搞笑、段子等示例"}]},{"type":"image","attrs":{"src":"https:\/\/static001.geekbang.org\/infoq\/ad\/ad454a9495713ba8b0b1dba74019f6b2.png","alt":"图片","title":"null","style":[{"key":"width","value":"75%"},{"key":"bordertype","value":"none"}],"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":"center","origin":null},"content":[{"type":"text","text":"11.4 人物首图正常商品示例"}]},{"type":"heading","attrs":{"align":null,"level":2},"content":[{"type":"text","text":"总结"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"本文主要介绍了利用视觉技术中的分类,特征学习解决实际用户分发商品中的应用,然而闲鱼用户自定义的商品和内容的多样性使得在审核、治理和结构方面给我们带来了很多挑战,单纯利用一种模态和内容很难把所有问题都解决,所以在实际应用中会综合多种方案和技术组合求解,例如在识别类目问题上,不但需要利用文本、图像内容提升识别精度,还在产品侧引导用户帮助完成商品结构化;对于样本提纯不但可以标注,还可以充分合理利用用户的反馈行为帮助我们;另外检索系统、数据加工流程和同步管理等工程化是最终模型体现价值的关键,光只有单纯几个模型并不能直接解决线上问题;在违规治理问题上正所谓“魔高一尺,道高一丈”,有些不合规用户总钻平台的漏洞为自己牟利,与他们的斗智斗勇是个长期的过程,也需要技术不断迭代和超越。感谢合作团队:闲鱼结构化团队,闲鱼架构团队,达摩院、审核部分等兄弟团队给与的人力和技术支持。"}]},{"type":"heading","attrs":{"align":null,"level":2},"content":[{"type":"text","text":"引用"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"[1]Yi Sun,Xiaogang Wang,Xiaoao Tang. Deep Learning Face Representation from Predicting 10,000 Classes .CVPR 2014"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"[2]Yi Sun"},{"type":"sup","content":[{"type":"text","text":"[1]"}]},{"type":"text","text":", Xiaogang Wang"},{"type":"sup","content":[{"type":"text","text":"[2]"}]},{"type":"text","text":", Xiaoou Tang"},{"type":"sup","content":[{"type":"text","text":"[3]"}]},{"type":"text","text":". DeepID2: deep learning face representation by joint identification-verification. CVPR 2014"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"[3]Yi Sun"},{"type":"sup","content":[{"type":"text","text":"[4]"}]},{"type":"text","text":", Xiaogang Wang"},{"type":"sup","content":[{"type":"text","text":"[5]"}]},{"type":"text","text":", Xiaoou Tang"},{"type":"sup","content":[{"type":"text","text":"[6]"}]},{"type":"text","text":". Deeply learned face representations are sparse, selective, and robust. CVPR 2014"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"[4]Yi Sun"},{"type":"sup","content":[{"type":"text","text":"[7]"}]},{"type":"text","text":", Ding Liang"},{"type":"sup","content":[{"type":"text","text":"[8]"}]},{"type":"text","text":", Xiaogang Wang"},{"type":"sup","content":[{"type":"text","text":"[9]"}]},{"type":"text","text":", Xiaoou Tang"},{"type":"sup","content":[{"type":"text","text":"[10]"}]},{"type":"text","text":". Face Recognition with Very Deep Neural Networks. CVPR 2015"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"[5]Jiankang Deng"},{"type":"sup","content":[{"type":"text","text":"[11]"}]},{"type":"text","text":", Jia Guo"},{"type":"sup","content":[{"type":"text","text":"[12]"}]},{"type":"text","text":", Niannan Xue"},{"type":"sup","content":[{"type":"text","text":"[13]"}]},{"type":"text","text":", Stefanos Zafeiriou"},{"type":"sup","content":[{"type":"text","text":"[14]"}]},{"type":"text","text":". ArcFace: Additive Angular Margin Loss for Deep Face Recognition. CVPR 2018"}]},{"type":"heading","attrs":{"align":null,"level":3},"content":[{"type":"text","text":"References"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"codeinline","content":[{"type":"text","text":"[1]"}]},{"type":"text","text":"Yi Sun: "},{"type":"text","marks":[{"type":"italic"}],"text":"https:\/\/arxiv.org\/search\/cs?searchtype=author&query=Sun%2C+Y"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"codeinline","content":[{"type":"text","text":"[2]"}]},{"type":"text","text":"Xiaogang Wang: "},{"type":"text","marks":[{"type":"italic"}],"text":"https:\/\/arxiv.org\/search\/cs?searchtype=author&query=Wang%2C+X"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"codeinline","content":[{"type":"text","text":"[3]"}]},{"type":"text","text":"Xiaoou Tang: "},{"type":"text","marks":[{"type":"italic"}],"text":"https:\/\/arxiv.org\/search\/cs?searchtype=author&query=Tang%2C+X"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"codeinline","content":[{"type":"text","text":"[4]"}]},{"type":"text","text":" Yi Sun: "},{"type":"text","marks":[{"type":"italic"}],"text":"https:\/\/arxiv.org\/search\/cs?searchtype=author&query=Sun%2C+Y"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"codeinline","content":[{"type":"text","text":"[5]"}]},{"type":"text","text":"Xiaogang Wang: "},{"type":"text","marks":[{"type":"italic"}],"text":"https:\/\/arxiv.org\/search\/cs?searchtype=author&query=Wang%2C+X"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"codeinline","content":[{"type":"text","text":"[6]"}]},{"type":"text","text":"Xiaoou Tang: "},{"type":"text","marks":[{"type":"italic"}],"text":"https:\/\/arxiv.org\/search\/cs?searchtype=author&query=Tang%2C+X"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"codeinline","content":[{"type":"text","text":"[7]"}]},{"type":"text","text":"Yi Sun: "},{"type":"text","marks":[{"type":"italic"}],"text":"https:\/\/arxiv.org\/search\/cs?searchtype=author&query=Sun%2C+Y"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"codeinline","content":[{"type":"text","text":"[8]"}]},{"type":"text","text":"Ding Liang: "},{"type":"text","marks":[{"type":"italic"}],"text":"https:\/\/arxiv.org\/search\/cs?searchtype=author&query=Liang%2C+D"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"codeinline","content":[{"type":"text","text":"[9]"}]},{"type":"text","text":"Xiaogang Wang: "},{"type":"text","marks":[{"type":"italic"}],"text":"https:\/\/arxiv.org\/search\/cs?searchtype=author&query=Wang%2C+X"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"codeinline","content":[{"type":"text","text":"[10]"}]},{"type":"text","text":"Xiaoou Tang: "},{"type":"text","marks":[{"type":"italic"}],"text":"https:\/\/arxiv.org\/search\/cs?searchtype=author&query=Tang%2C+X"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"codeinline","content":[{"type":"text","text":"[11]"}]},{"type":"text","text":"Jiankang Deng: "},{"type":"text","marks":[{"type":"italic"}],"text":"https:\/\/arxiv.org\/search\/cs?searchtype=author&query=Deng%2C+J"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"codeinline","content":[{"type":"text","text":"[12]"}]},{"type":"text","text":"Jia Guo: "},{"type":"text","marks":[{"type":"italic"}],"text":"https:\/\/arxiv.org\/search\/cs?searchtype=author&query=Guo%2C+J"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"codeinline","content":[{"type":"text","text":"[13]"}]},{"type":"text","text":"Niannan Xue: "},{"type":"text","marks":[{"type":"italic"}],"text":"https:\/\/arxiv.org\/search\/cs?searchtype=author&query=Xue%2C+N"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"codeinline","content":[{"type":"text","text":"[14]"}]},{"type":"text","text":"Stefanos Zafeiriou: "},{"type":"text","marks":[{"type":"italic"}],"text":"https:\/\/arxiv.org\/search\/cs?searchtype=author&query=Zafeiriou%2C+S"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"本文转载自:闲鱼技术(ID:XYtech_Alibaba)"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"原文链接:"},{"type":"link","attrs":{"href":"https:\/\/mp.weixin.qq.com\/s\/AQqaxvok9N6PWd83GZ_wpA","title":"xxx","type":null},"content":[{"type":"text","text":"图像技术在上亿规模实拍图片中的应用(算法好文)"}]}]}]}
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章