Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

youo can specify the desired output layer in the net's forward() function, like:

output = net.forward("fc7")

youo you can specify the desired output layer in the net's forward() function, like:

output = net.forward("fc7")

using cv2.Dnn, you can specify the desired output layer in the net's forward() function, like:

output = net.forward("fc7")

using cv2.Dnn, cv2.dnn, you can specify the desired output layer in the net's forward() function, like:

# assuming, that an fc layer at the end denotes a "classification" model
net = cv.dnn.readNet(caffemodel, prototxt)
img = ...
blob = cv.dnn.blobFromImage(img, scale, (width, height), mean, isrgb, cropFromCenter)
net.setInput(blob)

output = net.forward("fc7")

for a more detailled (python) sample, please have a look here !

using cv2.dnn, you can specify the desired output layer in the net's forward() function, like:

# assuming, that an fc layer at the end denotes a "classification" model
net = cv.dnn.readNet(caffemodel, prototxt)
img = ...
blob = cv.dnn.blobFromImage(img, scale, (width, height), mean, isrgb, cropFromCenter)
net.setInput(blob)

output = net.forward("fc7")
net.forward("fc7") # <--your final layer here !
print np.argmax(output), np.max(output)

for a more detailled (python) sample, please have a look here !

using cv2.dnn, you can specify the desired output layer in the net's forward() function, like:

# assuming, that an fc layer at the end denotes a "classification" model
net = cv.dnn.readNet(caffemodel, prototxt)
img = ...
blob = cv.dnn.blobFromImage(img, scale, (width, height), (227, 227), mean, isrgb, cropFromCenter)
net.setInput(blob)

output = net.forward("fc7") # <--your final layer here !
print np.argmax(output), np.max(output)

for a more detailled (python) sample, please have a look here !