My university lecturer has provided us with MATLAB code that encorporates the use of a ANN to predict and classify a number of images based on whether they have a logo present in their image or not.
I'm trying to make my life slightly easier by writing some extra code that quickly determines that false positive and false negative rate of the ANN's classification output.
I've written the code, however when I train and run the neural network the correct and incorrect classifications both come out at around ~30 each, out of 60. The first 30 are logo images, and the second 30 are non-logo images. This means the network has a roughly 50% success rate, which is pretty bad. I've also been through and tested each picture manually, and although there are some errors, there definitely isn't a 50:50 split on correct and incorrect classifications.
Considering the code for the ANN was written by my lecturer, I don't think its the ANN's output that's the problem, but rather my logic in determining the FNR and FPR values. However I've been staring at it for the last half an hour and I can't seem to figure out what the issue is. If someone could look over it and see if I have any logic errors and point them out I'd appreciate it. Sometimes a fresh pair of eyes helps.
for i = 1 : number_test_images
test_image=imread(['Test_logo\' test_folder(i+2).name]);
feature_vector=get_featureVector(test_image); % function get_featureVector returns a column vector.
Y_testing = net(feature_vector'); % compute the output of the trained network
if round(Y_testing)>=.5, %logo classification
disp('Logo');
if current_image <= 30 %first 30 images are logos = correct classification
correct = correct + 1;
else current_image > 30 %last 30 images are non-logos = incorrect classification
incorrect = incorrect + 1;
end
else
disp('Non logo'); %non-logo classification
if current_image <= 30 %first 30 images are logos = incorrect classification
incorrect = incorrect + 1;
else current_image > 30 %last 30 images are non-logos = correct classification
correct = correct + 1;
end
end
end
FPR = incorrect/30;
FNR = correct/30;
error = ((FPR+FNR)/2);