MATLAB Demos at GTC: Style Transfer and Celebrity Lookalikes 5
Posted by Johanna Pingel,
What are we going to show?
Deep Learning on the Cloud
Even 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
Demos
At 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:


Copyright 2018 The MathWorks, Inc.
Get the MATLAB code
- Category:
- I didn't know that!
Comments
To leave a comment, please click here to sign in to your MathWorks Account or create a new one.
Recent Comments