Advertisement
subasah

Untitled

May 2nd, 2020
891
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.83 KB | None | 0 0
  1. %this file is used to test the model in the unseen data to this model by
  2. %loading the trained model into the workking space
  3.  
  4. load skin-cancer-model-alexnet.mat trainedNet
  5. digitDatasetPath = fullfile('C:\Users\UTStudent\Desktop\salari\salari-project\skin-cancer-dataset-test');
  6. imds = imageDatastore(digitDatasetPath, ...
  7.     'IncludeSubfolders',true,'LabelSource','foldernames');
  8.  
  9. %finding number of images in the directorty of test
  10. numberofImages = length(imds.Files);
  11. idx = randperm(numel(imds.Files),numberofImages);
  12. %this loop here will clasify the unseen images to the model
  13. for i = 1:numberofImages
  14.     subplot(2,2,i)
  15.     I = readimage(imds,idx(i));
  16.     actualLabel = imds.Labels(idx(i));
  17.     predictedLabel = netTransfer.classify(I);
  18.     imshow(I)
  19.     title(['Predicted: ' char(predictedLabel) ', Actual: ' char(actualLabel)])
  20. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement