Deep Learning

理解和使用深度学习网络

GTC的Matlab演示:样式转移和名人LookAlikes

This post is all about NVIDIA and their upcomingGPU Technology Conferencecommonly referred to as GTC. Thousands of people attend every year at GTCs worldwide. GTC San Jose boasts around 9000 attendants. If you're one of those people, stop by and say hello! There's going to be many presentations, including a few from MathWorks onGPU Coder,,,,Matlab和Nvidia Docker,和动手MATLAB研讨会:See the schedule here

What are we going to show?

深度学习云

即使你不会GTC,我们希望你know that we support NVIDIA GPU Cloud Resources, through theirNGC平台。这意味着您可以在云中使用NVIDIA GPU运行MATLAB。新的(nvidia!)博客文章用一个示例说明了详细信息:https://devblogs.nvidia.com/
有关云资源的更多链接:

Demos

在节目中,我们将通过抽奖活动吸引人们到我们的展位,获得免费的Matlab家居许可证和凉爽的演示,包括:
  • Deep Learning on DGX
  • 深度学习延伸
  • Age Detection using YOLO on a Jetson Xavier board
And your choice between two deep learning demos I just completed: "Style Transfer" and "Celebrity Doppelganger." The code for Celebrity Doppelganger can be downloaded below. Just add your own images, and you're good to go!
样式转移
该演示使用深度学习来创建另一个图像(例如Van Gogh或Monet)的图像。对网络进行了训练,可以从网络中许多点从图像中提取特定功能。网络将编码并解码新图像的功能,该功能将从参考图像中获取样式:
这不是演示中最齐全的(我的设置我的平均每个图像0.5s),因此我们无法运行此示例流。取而代之的是,我将其运行在计时器上每隔几秒钟拍照,并允许人们自定义自己想要的风格。
Celebrity Doppelganger
该演示是从网络中提取功能(我选择了Resnet-101并从最终完全连接的层中提取功能),并运行K-Neartible的邻居算法以确定属于名人的功能的最接近匹配。
建造名人KD树搜索者的代码看起来像这样:
函数mdl = buildCelebModel(imds_celeb,net,layer layer)%获取名人激活num_files = length(imds_celeb.files);activs_c = [];对于II = 1:num_files ipicture = imresize(imds_celeb.readimage(ii),[448,448]);bbox = face_predict(ipicture);如果〜ISEMPTY(bbox)bboxpt = bbox(1,:);bufx = floor(.3*bboxpt(3));bufy = floor(.3*bboxpt(4));xs = max(bboxpt(1)-bufx,1);ys = max(bboxpt(2)-bufy,1);Xe = min(bboxpt(1)+bboxpt(3)-1+bufx,size(ipicture,2)); ye = min(bboxpt(2)+bboxpt(4)-1+bufy, size(ipicture,1)); face = ipicture(ys:ye, xs:xe, :); face = imresize(face, [224,224]); end xx = activations(net,single(face),layer); activs_c = vertcat(activs_c,squeeze(xx(1,1,:))'); %' end MDL = KDTreeSearcher(activs_c); end
The idea is to pull activations from each face, and then build a model (MDL) that you can use to find the closest match. When I run this through my webcam, extract a face from the camera, I can run this code:
activs_u = squeeze(xx(1,1,:))';%' [Idx,D] = knnsearch(app.mdl,activs_u,'K',num);
And I will get the Index (Idx) corresponding to the image number of my closest match. Inside the app, it will look something like this:
Whether or not you believe I look like Uma I guess is up for debate, but let's just say I was happy with my match!!更新:第二天我再次运行时,显然我看起来像Padma?该算法可疑!
Also keep in mind at a conference such as this, it's not really about showing the most ground breaking or highest accuracy algorithm. It's about letting people interact with deep learning and hopefully starting a conversation.
也就是说,在我去圣何塞之前,我还有几天可以与这些演示一起玩。关于如何在会议前使这些演示更好的建议吗?
I put the code for the doppelganger example in the download code button below. Let me know what you think of the demos, and please stop by the booth if you're going to be at GTC San Jose!

Copyright 2018 The MathWorks, Inc.
Get the MATLAB code


|

Comments

要发表评论,请单击here登录您的数学帐户或创建一个新帐户。