Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

the error is a bit cryptic, but you're feeding grayscale images into it, while it expects color (3-channel) images.

then, the code you're trying with was made for object detection , while your network is for classification.

you'll have to rewrite anything behind the net.forward() call.

the error is a bit cryptic, but you're feeding grayscale images into it, while it expects color (3-channel) images.images. also the images should be resized to 227x227 (if you look at the prototxt)

then, the code you're trying with was made for object detection , while your network is for classification.

you'll have to rewrite anything behind after the net.forward() call.

the error is a bit cryptic, but you're feeding grayscale images into it, while it expects color (3-channel) images. also the images should be resized to 227x227 (if you look at the prototxt)

then, the code you're trying with was made for object detection , while your network is for classification.

you'll have to rewrite anything after the net.forward() call.call. i don't have the data, but hopefully it is as simple as:

Mat probs = net.forward("probs").reshape(1,1);
MinMaxLocResult mm = Core.minMaxLoc(probs);

int id = mm.maxLoc.x;

the error is a bit cryptic, but you're feeding grayscale images into it, while it expects color (3-channel) images. also the images should be resized to 227x227 (if you look at the prototxt)

then, the code you're trying with was made for object detection , while your network is for classification.

you'll have to rewrite anything after the net.forward() call. i don't have the data, but hopefully it is as simple as:

// prototxt says, the last name is "prob", not "probs"
Mat probs = net.forward("probs").reshape(1,1);
net.forward("prob").reshape(1,1); // flatten to a single row
MinMaxLocResult mm = Core.minMaxLoc(probs);
Core.minMaxLoc(probs); // get largest softmax output

int id = mm.maxLoc.x;

the error is a bit cryptic, but you're feeding grayscale images into it, while it expects color (3-channel) images. also the images should be resized to 227x227 (if you look at the prototxt)

then, the code you're trying with was made for object detection , while your network is for classification.

you'll have to rewrite anything after the net.forward() call. i don't have the data, but hopefully it is as simple as:

// prototxt says, the last name is "prob", not "probs"
Mat probs = net.forward("prob").reshape(1,1); // flatten to a single row
MinMaxLocResult mm = Core.minMaxLoc(probs); // get largest softmax output

int id result = mm.maxLoc.x;
mm.maxLoc.x; // gender or age group