Computer Vision News - September 2021

3 Summary 7 App Designer for MatLab url = 'http://download.tensorflow.org/example_images/flower_photos.tgz'; % Store the output in a temporary folder downloadFolder = tempdir; filename = fullfile(downloadFolder,'flower_dataset.tgz'); % Uncompressed data set imageFolder = fullfile(downloadFolder,'flower_photos'); if ~exist(imageFolder,'dir') % download only once disp('Downloading Flower Dataset (218 MB)...'); websave(filename,url); untar(filename,downloadFolder) end imds = imageDatastore(imageFolder, 'LabelSource', 'foldernames', 'IncludeSubfolders',true); % Load pretrained network app.net = resnet50(); % Training and Test set [trainingSet, app.testSet] = splitEachLabel(imds, 0.3 , 'randomize'); % Create augmentedImageDatastore from training and test sets to resize images in imds to the size required by the network. app.imageSize = app.net.Layers( 1 ).InputSize; augmentedTrainingSet = augmentedImageDatastore(app.imageSize, trainingSet, 'ColorPreprocessing', 'gray2rgb'); augmentedTestSet = augmentedImageDatastore(app.imageSize, app.testSet, 'ColorPreprocessing', 'gray2rgb'); % Get the network weights for the second convolutional layer w1 = app.net.Layers( 2 ).Weights; % Scale and resize the weights for visualization w1 = mat2gray(w1); w1 = imresize(w1, 5 ); montage(w1,'Parent',app.FeaturesAxes); featureLayer = 'fc1000'; % Update the image and histograms updateimage(app,'daisy'); trainingFeatures = activations (app.net , augmentedTrainingSet, featureLayer, 'MiniBatchSize', 32 , 'OutputAs', 'columns'); % Get training labels from the trainingSet You also need to add an extra function which takes as input a label name and displays the main image and the three channels’ histograms.

RkJQdWJsaXNoZXIy NTc3NzU=