function downloadTrainedPix2PixHDNet(url,destination)
% The downloadTrainedPix2PixHDNet function downloads the pretrained 
% Pix2PixHD network that generates synthetic scene images from pixel label
% images.
%
% Copyright 2019 The MathWorks, Inc.

filename = 'trainedPix2PixHDNet.zip';
netDirFullPath = destination;
netZipFileFullPath = fullfile(destination,filename);
netMATFileFullPath = fullfile(destination,'trainedPix2PixHDNet.mat');
if ~exist(netMATFileFullPath,'file')
    if ~exist(netZipFileFullPath,'file')
        fprintf('Downloading pretrained Pix2PixHD network for CamVid data.\n');
        fprintf('This can take several minutes to download...\n');
        if ~exist(netDirFullPath,'dir')
            mkdir(netDirFullPath);
        end
        websave(netZipFileFullPath,url);
        fprintf('Done.\n\n');
    end
    unzip(netZipFileFullPath,netDirFullPath)
else
    fprintf('Pretrained Pix2PixHD network for CamVid data set already exists.\n\n');
end
end