How is multiclass classification and finding accuracy using ANN from the exracted features by LBP done?
    9 visualizaciones (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
I have 5 class of images and in each class I have 5 images and I have extracted features using LBP(Local Binary Pattern) and I need to classify and find accuracy of it using ANN from the extracted features(it contains histogram of 0-255 ),Guide me please if possible with a code?
3 comentarios
Respuestas (1)
  Ayush Aniket
      
 el 5 de Mayo de 2025
        A simple way to do this would be as follows:
- Load Features and Labels -
    % Load features
    data = importdata('features.mat'); % data should be 25x256 (if using LBP histograms)
    % Labels (provided)
    label = [1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5]';
        2. Split Data (4 Train, 1 Test per Class) -  
    trainIdx = [];
    testIdx = [];
    for c = 1:5
        idx = find(label == c);
        trainIdx = [trainIdx; idx(1:4)];
        testIdx  = [testIdx;  idx(5)];
    end
    XTrain = data(trainIdx, :)';
    YTrain = label(trainIdx)';
    XTest  = data(testIdx, :)';
    YTest  = label(testIdx)';
        3. Prepare Targets for ANN Define and Train ANN - 
    % Convert labels to categorical for ANN
    YTrain_cat = full(ind2vec(YTrain)); % Converts to one-hot encoding
    YTest_cat  = full(ind2vec(YTest));
    % Simple feedforward network with one hidden layer of 10 neurons
    net = patternnet(10);
    % Train the network
    net = train(net, XTrain, YTrain_cat);
However, your data has quite less number of images(25) compared to number of features(256). In such cases, its highly likely that the ANN will overfit the data. You can try the following approaches to mitigate the overfitting: 
- Using PCA to reduce dimensionality: https://www.mathworks.com/help/stats/pca.html
- With so little data, classical machine learning methods (e.g., SVM, k-NN, LDA) often outperform neural networks.
- Finally, you can try data augmentation: https://www.mathworks.com/help/deeplearning/ug/image-augmentation-using-image-processing-toolbox.html
0 comentarios
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!



