Hello!
I have a network with multiple outputs, that is a caffenet with adding two more outputs (a regression layer and a classification layer), and I don't know hot to get results from sencond and third outputs. I describe details here:
The details of the prototxt model file: it is a caffenet with some changes, I have added two outputs (one additional clasification output and also a regression output):
... # Caffenet until here, some changes:
layers {
name: "fc8-1"
type: INNER_PRODUCT
bottom: "fc7"
top: "fc8-1"
inner_product_param {
num_output: 8
}
}
layers {
name: "prob-1"
type: SOFTMAX
bottom: "fc8-1"
top: "prob-1"
}
layers {
name: "fc8-2"
type: INNER_PRODUCT
bottom: "fc7"
top: "fc8-2"
inner_product_param {
num_output: 2
}
}
layers {
name: "prob-2"
type: SOFTMAX
bottom: "fc8-2"
top: "prob-2"
}
layers {
name: "fc8-1-regr"
type: INNER_PRODUCT
bottom: "fc7"
top: "fc8-1-regr"
inner_product_param {
num_output: 1
}
}
I infer and I have not Idea how to get outputs. I define net object to run inference later:
net_weights='./caffenet_mix_iter_50000.caffemodel'
net_model_file='./deploy.prototxt'
net = caffe.Classifier(net_model_file, net_weights,
mean=meanOfMean,
channel_swap=(2,1,0),
raw_scale=255,
image_dims=(227, 227))
Also, I load an image:
image = '/home/diego/test_images/test_01.jpg'
input_image = caffe.io.load_image(image)
_ = plt.imshow(image)
Until here all seems normal, but when I try to get results from multiple outputs, I cat only get one output:
prediction = net.predict([image])
prediction.shape
prediction[0].shape
print(prediction)
But I can see into the log that Caffe knows multiple outputs (from the running log) :
...
I1120 14:01:09.473515 24579 net.cpp:264] This network produces output fc8-age-regr
I1120 14:01:09.473520 24579 net.cpp:264] This network produces output prob-age
I1120 14:01:09.473526 24579 net.cpp:264] This network produces output prob-gender
...
Then, what is the correct way to obtain multiple outputs from this network?
A lot of thanks! I see caffe great but I have not very depth information.
Diego