Animal detection and classification using svm
이전 댓글 표시
We are working on animal detection and classification (wild animal). We thought of using SVM classification algorithm. We are not getting the code. Our dataset /database is cheetah, elephant, fox, pig, tiger and wolf. We have chosen the image with nature background
답변 (1개)
Gautam
2025년 1월 2일
Hello Tejomayi,
You can use the “fitcsvm” function to perform classification of animals using the SVM algorithm. Assuming you have the features data, below is a workflow that you can refer to
% Assume we have 3 features per animal.
features = [
70, 60, 110;
3000, 3, 25;
8, 8, 60;
90, 40, 11;
220, 80, 65;
40, 30, 55
];
% Corresponding labels for each animal
labels = {'Cheetah', 'Elephant', 'Fox', 'Pig', 'Tiger', 'Wolf'}';
% Convert string labels to categorical
categoricalLabels = categorical(labels);
% Train the SVM classifier
SVMModel = fitcsvm(features, categoricalLabels, 'KernelFunction', 'linear', 'Standardize', true);
% Display the trained SVM model
disp(SVMModel);
% Example of classifying a new animal based on its features
newAnimalFeatures = [100, 50, 50]; % Example features for a new animal
predictedLabel = predict(SVMModel, newAnimalFeatures);
% Display the predicted label
fprintf('The predicted animal is: %s\n', string(predictedLabel));
Please refer to the following documentation for more information on the “fitcsvm” function
카테고리
도움말 센터 및 File Exchange에서 Statistics and Machine Learning Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!