Computer Vision News - September 2021
3 Summary 9 App Designer for MatLab Finally, the DropDownValueChanged callback code should be filled with a call to the updateimage function with the selected value from the drop-down menu. % Value changed function: DropDown function DropDownValueChanged (app, event) value = app.DropDown.Value; % Update the image and histograms updateimage(app,string(value)); end On thePrediction tab, I addedanAxes component showing the weights for the second convolutional layer and a button which I named Run Classification. If this is pushed, the Edit Field component will be filled in with the prediction from the SVM classifier. Below, the code linked to the button callback. % Button pushed function: RunclassificationButton function RunclassificationButtonPushed (app, event) % Create augmentedImageDatastore to automatically resize the image when image features are extracted using activations. ds = augmentedImageDatastore(app.imageSize, app.testImage, 'ColorPreprocessing', 'gray2rgb'); % Extract image features using the CNN featureLayer = 'fc1000'; app.imageFeatures = activations (app.net , ds, featureLayer, 'OutputAs', 'columns'); % Make a prediction using the classifier app.predictedLabel = predict(app.classifier, app.imageFeatures, 'ObservationsIn', 'columns'); app.EditField.Value = string(app.predictedLabel); end
Made with FlippingBook
RkJQdWJsaXNoZXIy NTc3NzU=