MATLAB Demos at GTC: Style Transfer and Celebrity Lookalikes
What are we going to show?
Deep Learning on the CloudEven if you're not going to GTC, we want you to know that we support NVIDIA GPU Cloud Resources, through their NGC platform. This means you can run MATLAB with NVIDIA GPUs in the cloud. A new (NVIDIA!) blog post explains the details with an example: https://devblogs.nvidia.com/ More links on cloud resources:
- Here's a super detailed video to get you set up using GPUs on the cloud: link to video
- and more details can be found here: link to documentation
DemosAt the show, we'll be luring people to our booth with a raffle for a free MATLAB Home license, and cool demos including:
- Deep Learning on DGX
- Deep Learning running TensorRT
- Age Detection using YOLO on a Jetson Xavier board
function MDL = buildCelebModel(imds_celeb,net,layer) % get celebrity activations num_files = length(imds_celeb.Files); activs_c = ; for ii = 1:num_files ipicture = imresize(imds_celeb.readimage(ii), [448,448]); bbox = face_predict(ipicture); if ~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); endThe 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!! Update: when I ran it again the following day, apparently I look like Padma? This algorithm is suspicious! 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. That said, I still have a few days to play with these demos before I leave for San Jose. Any suggestions on how to make these demos better before the conference? 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
To leave a comment, please click here to sign in to your MathWorks Account or create a new one.