artsy 爬虫

Like many others, I can strongly say that taking photos is not my strong suit. I learned to get better and developed a sort of half-smile like Barney from “How I met your Mother”. Recently, I wanted to try to be more photogenic, so I searched through my social media to see how others did it. Then something hit me, most of these photos had some kind of filtering on them, mainly from Snapchat. This threw me for a loop for a while, until I tried them out for myself. These filters were wacky and silly and did make me look better on camera!

像许多其他人一样,我可以坚决地说拍照不是我的强项。 我从“我如何遇见你的母亲”中学到了进步,并学会了像Barney这样的半笑脸。 最近,我想变得更加上镜,因此我在社交媒体上进行搜索,以了解其他人是如何做到的。 然后让我感到震惊的是,这些照片大部分都经过某种过滤,主要来自Snapchat。 这让我循环了一段时间,直到我自己尝试了一下。 这些滤镜古怪而愚蠢,确实使我在相机上看起来更好!

That’s when I wondered, “what if we could make our own filters”? After some research, I learned that Snapchat creates these augmented reality filters from a number of computer vision techniques. Finally, after a few hours of research, I landed on an interesting paper called “A Neural Algorithm for Artistic Style” by Leon A. Gatsy and colleagues. They used a neural network to create a “stylized image” from a photo and a piece of artwork. Then, after a sudden realization, wanted to explore if we could use this technique to create custom filters, like those on Snap chat. So here is my journey on implementing it in Python!

那时候我在想,“我们是否可以自己制造过滤器”? 经过一番研究,我了解到Snapchat通过多种计算机视觉技术创建了这些增强现实滤镜。 最终,经过几个小时的研究,我找到了Leon A. Gatsy及其同事写的一篇有趣的论文,称为“一种用于艺术风格的神经算法”。 他们使用神经网络从照片和艺术品中创建“风格化图像”。 然后,在突然意识到之后,想要探索我们是否可以使用这种技术来创建自定义过滤器,例如Snap聊天中的过滤器。 所以这是我在Python中实现它的旅程!

Side Note: This technique has been a hot topic of research for a couple of years, and there is a number of great online resources and videos that explain the concepts very well. This article is mainly to provide a high-level overview of this technique as best as I can. Alright, let's get started!

旁注:这项技术已经成为研究的热点话题,并且有很多很棒的在线资源和视频很好地解释了这些概念。 本文的主要目的是尽我所能提供有关此技术的高级概述。 好吧,让我们开始吧!

神经风格转移:算法 (Neural Style Transfer: The Algorithm)

So what is this algorithm trying to accomplish? Essentially we want to produce an image that resembles our content image (the image we want stylized), with the artistic style of our style image.

那么该算法要完成什么呢? 本质上,我们希望产生一种与我们的内容图像(我们要风格化的图像)相似的图像,并具有我们风格图像的艺术风格。

Image Source)图片来源 )

In the original paper, he first used the VGG19 model to achieve this result. VGG19 is a popular neural network for image recognition, but we’re mainly going to focus on how it extracts features from a photograph. The feature extraction is done through a number of sequential layers that can detect small patterns. The features it initially picks up are very simple but gets more complex as more feature layers are added. we can then use these features, to recreate our original image!

在原始论文中,他首先使用VGG19模型来实现此结果。 VGG19是一种流行的用于图像识别的神经网络,但我们将主要关注它如何从照片中提取特征。 特征提取是通过许多可以检测出小图案的顺序层完成的。 最初拾取的要素非常简单,但随着添加更多要素图层而变得越来越复杂。 然后,我们可以使用这些功能来重建我们的原始图像!

内容损失 (Content Loss)

In this step, we want to try to recreate, more or less the essence of our content image. To achieve this, we’ll first start off by creating an image full of random noise. We’ll then shape this image to look like our content image, using the extracted features from our network as a guide. The distance between the random image features and the content features is called our “content loss”. To get the best stylized image, we want to minimize this loss function through back-propagation. We’ll finally loop through this whole thing and optimize on each step to get a pretty good recreation of our image.

在这一步中,我们想要尝试或多或少地重新创建内容图像的本质。 为此,我们首先要创建一个充满随机噪声的图像。 然后,我们将从网络中提取的特征用作指导,以使此图像成形为看起来像我们的内容图像。 随机图像特征和内容特征之间的距离称为“内容损失”。 为了获得最佳的风格化图像,我们希望通过反向传播来最小化此损失函数。 我们最终将遍历整个过程,并在每个步骤上进行优化,以使我们的形象得到很好的再现。

for i in range(1,epochs+1):target_features = model_activations(target,model)content_loss = torch.mean((content_features['conv4_2']-target_features['conv4_2'])**2)

风格损失 (Style Loss)

Image Source)图像源 )

For this step, we’ll want to recreate the core artistic direction of our style image. Gatsy solves this in an interesting way! Instead of comparing our style features to another image, we’ll compare each feature map to itself. We’ll first transform the style features into a gram matrix, which is basically the inner product of a matrix. The “style loss” was is basically the sum of losses for all feature maps in the model network. We’ll do a similar looping process and optimize on each step.

对于这一步,我们将要重新创建样式图像的核心艺术方向。 盖茨以一种有趣的方式解决了这个问题! 与其将样式特征与其他图像进行比较,我们将每个特征图与其自身进行比较。 我们首先将样式特征转换为gram矩阵,这基本上是矩阵的内积。 “样式损失”基本上是模型网络中所有要素图的损失之和。 我们将执行类似的循环过程,并在每个步骤上进行优化。

style_loss = 0for layer in style_wt_meas:style_gram = style_grams[layer]target_gram = target_features[layer]_,d,w,h = target_gram.shapetarget_gram = gram_matrix(target_gram)style_loss += (style_wt_meas[layer]*torch.mean((target_gram-style_gram)**2))/d*w*h

Our final step in this process is to calculate our final loss as the weighted sum of our content loss and style loss. we’ll also optimize this loss at each step of our training loop.

我们在此过程中的最后一步是将最终损失计算为内容损失和样式损失的加权总和。 我们还将在训练循环的每个步骤中优化这一损失。

total_loss = content_wt*content_loss + style_wt*style_loss

问题与未来的工作 (Problems and Future Work)

Gatsy Method for Style Transfer was the first of its kind, but it did have some problems. The major problem is that it’s very slow. This is because Since the optimization is done every cycle in the training loop, the algorithm takes some time to produce anything. Secondly, sometimes changing the weights will greatly destabilize the photo. There is a fix by adding a total loss variation which aligns the mean and variance of the content and style images. From my research, it looks like Neural Style Transfer is still a hot topic, with applications being applied to video processing, simulations, and designs.

样式转换的盖茨方法是第一种,但是确实存在一些问题。 主要的问题是它非常慢。 这是因为由于优化是在训练循环的每个循环中完成的,所以该算法需要花费一些时间来产生任何东西。 其次,有时改变权重会大大破坏照片的稳定性。 通过添加总损耗变化来解决问题,该变化可以使内容和样式图像的均值和方差对齐。 从我的研究看来,神经样式转换仍然是一个热门话题,其应用程序已应用于视频处理,模拟和设计。

I used Ayush Chaurasia: Artistic Neural Style Transfer From Scratch on Youtube to create the code. Like I mentioned in the beginning of this article, there are plenty of great resources you can find online. If you wanted to get started with computer vision problems, I think that building neural style transfer application can be very fun and exciting! So I hoped this helped and I wish you luck if you try to pursue this!

我使用Ayush Chaurasia:Youtube上从头开始的艺术神经风格转换来创建代码。 就像我在本文开头提到的那样,您可以在网上找到很多很棒的资源。 如果您想开始解决计算机视觉问题,我认为构建神经样式转换应用程序会非常有趣和令人兴奋! 因此,我希望这对您有所帮助,并祝您好运,如果您尝试这样做!

谢谢阅读! (Thanks for Reading!)

Here are some cool results that I’ve taken, I can’t wait to see what you’ll create!

这是我取得的一些不错的结果,我迫不及待想看看您将创建什么!

Red Clouds on the Golden Gate Bridge
金门大桥上的红云
Kadinsky on Great Turtle
卡丁斯基在大乌龟上
Michael Angelo’s painting on yours truly(Me) (Style Source: Photo by Adrianna Geo on Unsplash)
迈克尔·安杰洛(Michael Angelo)的画在您的真实(我)上(样式来源: Adrianna Geo在Unsplash上拍摄的照片)

Full Code can be found on my Google Colab:

完整代码可在我的Google Colab中找到:

You can check out my GitHub for more resources!

您可以查看我的GitHub了解更多资源!

翻译自: https://towardsdatascience.com/lets-get-artsy-creating-custom-snapchat-filters-with-neural-networks-8b73134b6cd7

artsy 爬虫


http://www.taodudu.cc/news/show-1873914.html

相关文章:

  • 大数据 机器学习 人工智能_在这个季节中,您如何免费学习数据科学,人工智能和机器学习。...
  • 机器学习时会发生什么
  • Noodle.ai的Atlas机器学习(ML)框架第1部分:构建AI应用程序面临的挑战
  • mavan自动化接管浏览器_人工智能与自动化:接管还是共生?
  • canva画板_客户体验,人工智能和机器学习-Oovvuu,Canva和Minerva集体的想法
  • 马斯克神经网络转换器_通过转换数据来减少人工神经网络的复杂性
  • 无需编码生成信息系统_无需编码即可逐步进行花分类
  • 动态时间规整算法_如何使用动态时间规整算法进行语音识别
  • 逻辑运算 神经网络_使用神经网络实现逻辑门(第2部分)
  • ai 实用新型专利_专利制度协调AI创造的创新
  • 缓冲区是人为设定的吗_人为的,但这真的是情报吗?
  • 对Librehash海洋协议审查的回应
  • 使用lstm实现文本生成_Spamilton:使用LSTM和Hamilton歌词生成文本
  • nlp n-gram_NLP中的单词嵌入:一键编码和Skip-Gram神经网络
  • nas神经网络架构搜索_神经建筑搜索(NAS)基础
  • web与ai相结合成为趋势_将AI和行为科学相结合可以改变体验
  • 递归神经网络/_递归神经网络
  • Kardashev量表和AI:可能的床友
  • 变异数分析_人工智能系统中分析变异的祸害
  • ai时代大学生的机遇和挑战_评估AI对美术的影响:威胁或机遇
  • 人工智能+智能运维解决方案_人工智能驱动的解决方案可以提升您的项目管理水平
  • c语言 机器语言 汇编语言_多语言机器人新闻记者
  • BrainOS —最像大脑的AI
  • 赵本山 政治敏锐_每天5分钟保持敏锐的7种方法
  • 面试问到处理过什么棘手问题_为什么调节人工智能如此棘手?
  • python svm向量_支持向量机(SVM)及其Python实现
  • 游戏世界观构建_我们如何构建技术落后的世界
  • 信任的机器_您应该信任机器人吗?
  • ai第二次热潮:思维的转变_基于属性的建议:科技创业公司如何使用AI来转变在线评论和建议
  • 建立RoBERTa模型以发现Reddit小组的情绪

artsy 爬虫_让我们得到Artsy! 使用神经网络创建自定义Snapchat过滤器!相关推荐

  1. chrome主题_谷歌Chrome将很快允许用户创建自定义主题

    站长之家(ChinaZ.com) 7月31日 消息:据9to5google报道,虽然用户可以通过Chrome Web Store定制主题,但用户要根据自己的独特喜好定制主题却不是一个简单的事.谷歌正寻 ...

  2. 网易蜂巢 mysql镜像_在网易蜂巢的容器中创建自定义镜像和推送本地镜像的教程...

    Dockerfile 创建自定义镜像1.  登录蜂巢控制台:https://c.163.com/dashboard 2.  点击左侧导航菜单的「镜像仓库」标签: 3.  点击镜像仓库列表左上角的「创建 ...

  3. python 爬虫源代码-从零开始学Python网络爬虫_源代码.rar

    [实例简介] [实例截图] [核心代码] 从零开始学Python网络爬虫_源代码_1 ├── 58project │ ├── __pycache__ │ │ ├── channel_extract.c ...

  4. pythonscrapy爬虫_零基础写python爬虫之使用Scrapy框架编写爬虫

    网络爬虫,是在网上进行数据抓取的程序,使用它能够抓取特定网页的HTML数据.虽然我们利用一些库开发一个爬虫程序,但是使用框架可以大大提高效率,缩短开发时间.Scrapy是一个使用Python编写的,轻 ...

  5. linkedin爬虫_机器学习的学生和从业者的常见问题在LinkedIn上提问

    linkedin爬虫 经验 (Experience) 介绍 (Introduction) LinkedIn has grown in popularity over the years, and it ...

  6. python网络爬虫_爬图片

    python网络爬虫_爬图片 1.安装 Beautifulsoup4 #解析返回的html与json数据pip install Beautifulsoup4 使用 :           运行后输入要 ...

  7. python爬虫_网易音乐歌单

    小白flag7 python爬虫_网易音乐歌单 准备 import os #存放文件处理 import time #程序运行时间计算 import sys #错误信息返回 预留 from seleni ...

  8. python爬虫公众号_python爬虫_微信公众号推送信息爬取的实例

    问题描述 利用搜狗的微信搜索抓取指定公众号的最新一条推送,并保存相应的网页至本地. 注意点 搜狗微信获取的地址为临时链接,具有时效性. 公众号为动态网页(JavaScript渲染),使用request ...

  9. Python爬虫_案例分析(二)

    Python爬虫_案例分析(二) 一.电影天堂案例 import scrapy from scrapy_movie.items import ScrapyMovieItem class MvSpide ...

  10. Python_爬虫_网页图片下载_その日の紋

    Python_爬虫_网页图片下载_その日の紋 项目效果 项目需求 项目分析 URL分析 页面分析 项目实施 项目源码 项目效果 项目需求 目标页面:https://www.hanakomon.jp/c ...

最新文章

  1. 中文NER涨点神器!基于多元数据的双流Transformer编码模型
  2. 文件IO-Properties
  3. 如何锁定 Visual SourceSafe 数据库(转载)
  4. Teams Bot如何解析和发送 at 用户
  5. windows下搭建Vagrant+Virtualbox环境
  6. BZOJ2002: [Hnoi2010]Bounce 弹飞绵羊(LCT)
  7. vbox 中ubuntu20.04和宿主机共享文件_如何在家搭建一套自己的实验平台(10)iSCSI 共享存储...
  8. 洛谷P5269 欧稳欧再次学车
  9. Python借助smote实现不均衡样本数据的上采样和下采样,并可视化展示样本分布
  10. 手机智能汽车钥匙来了, 汽车远程启动在手机上就能完成
  11. 用python画月亮和星空_用canvas画一轮明月,夜空与流星
  12. vip会员开通续费html页面
  13. ftdi utilities
  14. LG G7解OP开Volte
  15. MSN 9.0 同时登陆多个账号
  16. 如何用js实现图片下载
  17. 10种常见的移动端App广告展现形式
  18. 基于Bootstrap的后台管理系统模板。AceAdmin停更前最后的两个版本
  19. 软件测试行业的未来趋势及规划
  20. 当今世界不和谐的主要原因(作业真烦人,那就随便写一个吧)

热门文章

  1. 多线程JAVA篇(一)
  2. Protocol(协议)(二十)
  3. MYSQL复习笔记12-视图
  4. Ajax中的get和post两种请求方式的异同
  5. windows2003手工安装配置php5详细指南
  6. (转)PMP的项目管理5大组
  7. 每日一句20191019
  8. 20190913每日一句
  9. 190329每日一句
  10. Atitit 项目质量管理 目录 1. 标准化 规范化 1 1.1. 而项目管理中的39个标准过程(PMI)或42个要素(ICB)全部是一次性过程或要素, 1 1.2. 休哈特(shewhart 统