My work is on extracting features of Disease image to extract exact region of Interest of Disease which is the best features algorithm to be used
조회 수: 4 (최근 30일)
이전 댓글 표시
extracting features for exact region of Interest in Disease fruit
how to divide testing and training data which is the best algorithm machine learning for feature extracting and Classification of Disease .
댓글 수: 0
채택된 답변
Diwakar Diwakar
2023년 6월 11일
이동: Image Analyst
2023년 6월 11일
To extracting features from disease images and identifying the exact region of interest (ROI), there are several algorithms and techniques you can consider.
CNNs have been highly successful in image analysis tasks, including feature extraction and classification. They learn hierarchical representations of images and can identify relevant features in the ROI.
Instead of using pre-defined feature extraction algorithms, you can use deep learning models such as autoencoders or pre-trained models like VGG16 or ResNet to learn features directly from the images.
This code will help you to understand the basic concept:
% Load pre-trained VGG16 model
net = vgg16;
% Set the path to your disease image dataset
datasetPath = 'path_to_your_dataset';
% Set the percentage of data to be used for testing
testPercentage = 0.2;
% Load disease image dataset
imds = imageDatastore(datasetPath, 'IncludeSubfolders', true, 'LabelSource', 'foldernames');
% Split dataset into training and testing sets
[trainImds, testImds] = splitEachLabel(imds, testPercentage, 'randomized');
% Extract features from training set using VGG16
featuresTrain = activations(net, trainImds, 'fc7', 'MiniBatchSize', 32, 'OutputAs', 'columns');
% Extract features from testing set using VGG16
featuresTest = activations(net, testImds, 'fc7', 'MiniBatchSize', 32, 'OutputAs', 'columns');
% Get training labels
trainLabels = trainImds.Labels;
% Get testing labels
testLabels = testImds.Labels;
% Train a classifier on the extracted features
classifier = fitcecoc(featuresTrain, trainLabels);
% Make predictions on the testing set
predictedLabels = predict(classifier, featuresTest);
% Evaluate the accuracy of the classifier
accuracy = mean(predictedLabels == testLabels);
fprintf('Accuracy: %.2f%%\n', accuracy * 100);
In this code, we use the VGG16 model to extract features from the images in the training and testing sets. The extracted features are then used to train a multi-class classifier (fitcecoc) and make predictions on the testing set. The accuracy of the classifier is calculated and displayed.
Moreover, the choice of the best machine learning algorithm for feature extraction and classification depends on various factors such as the complexity of the problem, the size and quality of your dataset, and the computational resources available.
댓글 수: 0
추가 답변 (1개)
Image Analyst
2023년 6월 11일
"how to divide testing and training data"
Try randsample
help randsample
You could also use randperm
help randperm
I'm not really sure how they're different, if at all.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Pattern Recognition and Classification에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!