Animal detection and classification using svm

9 ビュー (過去 30 日間)
Tejomayi Raju
Tejomayi Raju 2021 年 2 月 18 日
回答済み: Gautam 2025 年 1 月 2 日
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
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

カテゴリ

Help Center および File ExchangeAnimation についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by