Computer Vision News - September 2021
2 Summary Co puter Vision Tool 6 same image is predicted using a multiclass linear SVM trained on features extracted by a pre-trained Convolutional Neural Network (CNN) . Hence, the final design should include both the ground truth label image and, in a different window, the prediction generated by the SVM classifier and an overview of the extracted training features. menu from which you can select one of the five labels in the dataset. Every time a value is selected from the menu, a different image from the testing dataset will randomly be chosen. At this stage, from the Code Browser (in Code View) on the left you need to add two callbacks: the startupFcn which will run as soon as you open the app; and one linked to the drop-down menu (a DropDownValueChanged callback). Now, if you switch to the Code View, you should find some sections that are already filled in for you - app constructor and components function - and some others that you need to fill in. In the startupFcn, you can add everything that you want to run at startup time, such as download of the images, loading of the pretrained network, preparation of training dataset for the prediction and so on. First, in the Design View, you can drag the desired components on the empty space in the middle. I chose to fill it with a Tab group, with two tabs called Image and Prediction. On the Image tab, I added a main Axes component, three lateral ones which display respectively red, green, and blue channels’ histograms and a drop- down % Code that executes after component creation function startupFcn (app) % Configure image axes app.ImageAxes.Visible = 'off'; app.ImageAxes.Colormap = gray( 256 ); axis(app.ImageAxes, 'image'); % Location of the compressed data set 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);
Made with FlippingBook
RkJQdWJsaXNoZXIy NTc3NzU=