OpenCV dnn classification result is not match to Caffe result
OpenCV Code:
image = cv2.imread("mysite/27.png")
blob = cv2.dnn.blobFromImage(image, 1, (224, 224), (123, 117, 104), swapRB=False, crop=False)
net = cv2.dnn.readNetFromCaffe("deploy.prototxt", "model.caffemodel")
net.setInput(blob)
preds = net.forward()
idxs = np.argsort(preds[0])[::-1][:5]
print(idxs)
Caffe code:
net = caffe.Classifier(MODEL_FILE, PRETRAINED, mean=np.array([104, 117, 123]), channel_swap=(2,1,0), input_scale=1.0, raw_scale=255, image_dims(224, 224))
input_image = caffe.io.load_image('27.png')
pred = net.predict([input_image])
idxs = np.argsort(pred[0])[::-1][:5]
print(idxs)
Even though I set swapRB=True/False, crop=True/False, all cases return different result. Result on Caffe is my expectation, but opencv isn't. I'm using OpenCV 3.4.2, Caffe 1.0.
Anyone can help. Thanks in advance.
what kind of model is it, exactly ?