Rafael Ruiz Muñoz
Rafael Ruiz Muñoz

Reputation: 5472

Predict label of one single image using DeepLearnToolbox

I am using DeepLearnToolbox to do CNN (Convolutional Neural Networks).

I have computed my network successfully and I've seen my accuracy, but my question is:

how can I query one single image into the network in order to get the label predicted?

The final result that I want to get is a label predicted, with maybe the error for each label not predicted.

Thank you.


This is the code that I have for testing the accuracy:

function [er, bad] = cnntest(net, x, y) % net = network, x = test_x (images), y = test_y (labels)
    %  feedforward
    net = cnnff(net, x);
    [~, h] = max(net.o);
    [~, a] = max(y);
    bad = find(h ~= a);

    er = numel(bad) / size(y, 2);
end

Upvotes: 2

Views: 292

Answers (1)

cfh
cfh

Reputation: 4666

These two lines

net = cnnff(net, x);
[~, h] = max(net.o);

feed an image x through the network and then compute the index h which had the largest output activation. You can simply do the same for an arbitrary input image x and it will give you the class h.

Upvotes: 1

Related Questions