function downloadTrainedConcreteClassificationNet(url,destination)
% The downloadTrainedConcreteClassificationNet function downloads the
% pretrained network that detects anomalies such as cracks in images of
% concrete.
%
% Copyright 2021 The MathWorks, Inc.

[~,name,~] = fileparts(url);
netDirFullPath = destination;
netZipFileFullPath = fullfile(destination,[name+".zip"]);
netMATFileFullPath = fullfile(destination,[name+".mat"]);
if ~exist(netMATFileFullPath,"file")
    if ~exist(netZipFileFullPath,"file")
        disp("Downloading pretrained concrete crack classification network.");
        disp("This can take several minutes to download...");
        if ~exist(netDirFullPath,"dir")
            mkdir(netDirFullPath);
        end
        websave(netZipFileFullPath,url);
        disp("Done.");
    end
    unzip(netZipFileFullPath,netDirFullPath)
else
    disp("Pretrained concrete crack classification network already exists.");
end
end