imds = imageDatastore('C:\Users\new\Testing',...
'IncludeSubfolders',true,...
'LabelSource','foldernames');
[Data,testData]= splitEachLabel(imds,0.8,'randomize');
imageInputLayer([200 128 3],'Name','input')
convolution2dLayer(5,16,'Padding','same','Name','conv_1')
batchNormalizationLayer('Name','BN_1')
reluLayer('Name','relu_1')
convolution2dLayer(3,32,'Padding','same','Stride',2,'Name','conv_2')
batchNormalizationLayer('Name','BN_2')
reluLayer('Name','relu_2')
convolution2dLayer(3,32,'Padding','same','Name','conv_3')
batchNormalizationLayer('Name','BN_3')
reluLayer('Name','relu_3')
convolution2dLayer(3,32,'Padding','same','Name','conv_4');
batchNormalizationLayer('Name','BN_4')
reluLayer('Name','relu_4')
additionLayer(5,'Name','add')
averagePooling2dLayer(4,'Stride',3,'Name','avpool')
fullyConnectedLayer(4,'Name','fc')
softmaxLayer('Name','softmax')
classificationLayer('Name','classOutput')];
lgraph = layerGraph(layers);
skipConv = convolution2dLayer(2,32,'Stride',2,'Name','skipConv');
lgraph = addLayers(lgraph,skipConv);
lgraph = connectLayers(lgraph,'relu_1','skipConv');
lgraph = connectLayers(lgraph,'relu_2','add/in2');
lgraph = connectLayers(lgraph,'relu_3','add/in3');
lgraph = connectLayers(lgraph,'relu_4','add/in4');
lgraph = connectLayers(lgraph,'skipConv','add/in5');
options = trainingOptions('adam', ...
'ValidationFrequency',5, ...
'InitialLearnRate',1e-4,'Plots','training-progress');
[convnet, traininfo] = trainNetwork(trainData,lgraph,options);
inp = input('Enter input :');
[cameraman_LBP] = LocalBinaryPattern (I);
subplot(121),imshow(I, []), title('INPUT IMAGE')
subplot(122),imshow(cameraman_LBP, []), title('LBP FEATURES')
[featureVector,hogVisualization] = extractHOGFeatures(I);
imshow(I);title('INPUT IMAGE')
[hog1, visualization] = extractHOGFeatures(I,'CellSize',[64 64]);
imshow(I),title('INPUT IMAGE');
imshow(I),title('HOG FEATURES IMAGE');
hog = hog_feature_vector(I);
class = classify(convnet,I);
NN = jnn('ffnn',feat,label,opts);
NN = jnn('nn',feat,label,opts);
msgbox("Testing of brain tumor classification using Convolution Neural Network (HOG vs LBP)successfully completed");