Why does the error at the bottom show up even though the correct dataset seems to be selected?
It says "Unable to find suitable response variable ~"
Here is the code:
img = imread("C:UsersxxooxOneDriveデスクトップMATLAB worksDataMathWorks Imagesocean.jpg"); % Load the unlabeled image
load ("C:UsersxxooxOneDriveデスクトップMATLAB worksComputer Vision for Engineering and ScienceC2-MachineLearningForComputerVisionModule 2gcClassifierSaturation.mat","gcClassifierSaturation") % Load the model trained using hand-selected features
load ("C:UsersxxooxOneDriveデスクトップMATLAB worksComputer Vision for Engineering and ScienceC2-MachineLearningForComputerVisionModule 2gcClassifierBag.mat","gcClassifierBag") % Load the model trained using automatically generated features
load ("C:UsersxxooxOneDriveデスクトップMATLAB worksComputer Vision for Engineering and ScienceC2-MachineLearningForComputerVisionModule 2bag.mat","bag") % Load bag of visual words object created by bagOfFeatures
% Step 1: Create a table of saturation-based predictor features
% Convert the image to HSV color space
hsvImg = rgb2hsv(img);
% Extract the saturation channel
saturation = hsvImg(:,:,2);
% Calculate the mean and standard deviation of the saturation
avgSat = mean(saturation(:));
stdSat = std(saturation(:));
% Create a table of saturation-based predictor features
gcTableSaturation = table(avgSat, stdSat);
% Step 2: Use gcClassifierSaturation.predictFcn to classify the unlabeled image
% Use the classifier to predict the label
prediction = gcClassifierSaturation.predictFcn(gcTableSaturation);
% Attach the prediction to the table
gcTableSaturation.prediction = prediction;
% Step 3: Create a table of bagOfFeatures-based predictor features
% Encode the image using the bag of features
featureVector = encode(bag, img);
% Create a table of predictor features for the unlabeled image
gcTableBag = array2table(featureVector);
gcTableBag.Properties.VariableNames = arrayfun(@(x) [‘f’ num2str(x)], 1:500, ‘UniformOutput’, false);
% Step 4: Use gcClassifierBag.predictFcn to classify the unlabeled image
% Use the classifier to predict the label
predictionBag = gcClassifierBag.predictFcn(gcTableBag);
% Attach the prediction to the table
gcTableBag.prediction = predictionBag;It says "Unable to find suitable response variable ~"
Here is the code:
img = imread("C:UsersxxooxOneDriveデスクトップMATLAB worksDataMathWorks Imagesocean.jpg"); % Load the unlabeled image
load ("C:UsersxxooxOneDriveデスクトップMATLAB worksComputer Vision for Engineering and ScienceC2-MachineLearningForComputerVisionModule 2gcClassifierSaturation.mat","gcClassifierSaturation") % Load the model trained using hand-selected features
load ("C:UsersxxooxOneDriveデスクトップMATLAB worksComputer Vision for Engineering and ScienceC2-MachineLearningForComputerVisionModule 2gcClassifierBag.mat","gcClassifierBag") % Load the model trained using automatically generated features
load ("C:UsersxxooxOneDriveデスクトップMATLAB worksComputer Vision for Engineering and ScienceC2-MachineLearningForComputerVisionModule 2bag.mat","bag") % Load bag of visual words object created by bagOfFeatures
% Step 1: Create a table of saturation-based predictor features
% Convert the image to HSV color space
hsvImg = rgb2hsv(img);
% Extract the saturation channel
saturation = hsvImg(:,:,2);
% Calculate the mean and standard deviation of the saturation
avgSat = mean(saturation(:));
stdSat = std(saturation(:));
% Create a table of saturation-based predictor features
gcTableSaturation = table(avgSat, stdSat);
% Step 2: Use gcClassifierSaturation.predictFcn to classify the unlabeled image
% Use the classifier to predict the label
prediction = gcClassifierSaturation.predictFcn(gcTableSaturation);
% Attach the prediction to the table
gcTableSaturation.prediction = prediction;
% Step 3: Create a table of bagOfFeatures-based predictor features
% Encode the image using the bag of features
featureVector = encode(bag, img);
% Create a table of predictor features for the unlabeled image
gcTableBag = array2table(featureVector);
gcTableBag.Properties.VariableNames = arrayfun(@(x) [‘f’ num2str(x)], 1:500, ‘UniformOutput’, false);
% Step 4: Use gcClassifierBag.predictFcn to classify the unlabeled image
% Use the classifier to predict the label
predictionBag = gcClassifierBag.predictFcn(gcTableBag);
% Attach the prediction to the table
gcTableBag.prediction = predictionBag; It says "Unable to find suitable response variable ~"
Here is the code:
img = imread("C:UsersxxooxOneDriveデスクトップMATLAB worksDataMathWorks Imagesocean.jpg"); % Load the unlabeled image
load ("C:UsersxxooxOneDriveデスクトップMATLAB worksComputer Vision for Engineering and ScienceC2-MachineLearningForComputerVisionModule 2gcClassifierSaturation.mat","gcClassifierSaturation") % Load the model trained using hand-selected features
load ("C:UsersxxooxOneDriveデスクトップMATLAB worksComputer Vision for Engineering and ScienceC2-MachineLearningForComputerVisionModule 2gcClassifierBag.mat","gcClassifierBag") % Load the model trained using automatically generated features
load ("C:UsersxxooxOneDriveデスクトップMATLAB worksComputer Vision for Engineering and ScienceC2-MachineLearningForComputerVisionModule 2bag.mat","bag") % Load bag of visual words object created by bagOfFeatures
% Step 1: Create a table of saturation-based predictor features
% Convert the image to HSV color space
hsvImg = rgb2hsv(img);
% Extract the saturation channel
saturation = hsvImg(:,:,2);
% Calculate the mean and standard deviation of the saturation
avgSat = mean(saturation(:));
stdSat = std(saturation(:));
% Create a table of saturation-based predictor features
gcTableSaturation = table(avgSat, stdSat);
% Step 2: Use gcClassifierSaturation.predictFcn to classify the unlabeled image
% Use the classifier to predict the label
prediction = gcClassifierSaturation.predictFcn(gcTableSaturation);
% Attach the prediction to the table
gcTableSaturation.prediction = prediction;
% Step 3: Create a table of bagOfFeatures-based predictor features
% Encode the image using the bag of features
featureVector = encode(bag, img);
% Create a table of predictor features for the unlabeled image
gcTableBag = array2table(featureVector);
gcTableBag.Properties.VariableNames = arrayfun(@(x) [‘f’ num2str(x)], 1:500, ‘UniformOutput’, false);
% Step 4: Use gcClassifierBag.predictFcn to classify the unlabeled image
% Use the classifier to predict the label
predictionBag = gcClassifierBag.predictFcn(gcTableBag);
% Attach the prediction to the table
gcTableBag.prediction = predictionBag; matlab, machine learning, image classification MATLAB Answers — New Questions