How to reshape properly in order to recreate the results got in the 'results' tab?


#1

I trained a model and when tested it over a train set that i uploaded, using the ’ dataset inference’ tab app I got a 92% accuracy. Then i download the model and use the following code:

from keras import backend as K
from keras.models import load_model
import cv2
import numpy as np

K.set_image_dim_ordering(‘th’)
model = load_model(‘model.h5’)
for i in range(1,30):

img = cv2.imread(filepath + str(i) +'.jpg') 
img = cv2.cvtColor(img,cv2.COLOR_BGR2RGB)
img= cv2.resize(img,(200,200))
img = np.reshape(img,(1,3,200,200),-1)
pred = model.predict(img).argmax(-1)[0]
if pred==0:
    print('1')
if pred==1:
    print('2')
if pred==2:
    print('3')

And my predictions aren’t the same that those that i get by using the deepcognition dataset inference tab. Any suggestions? Im using tensorflow as my backedn, should i use theano??? please help, the results that i get are totally useless


#2

Hi can you please share the model and dataset so that I can check the reason.
Mail us at support@deepcognition.ai

Regards
Rajat


#3

Thanks for replying. I already sent an email to the address you posted.


#4

Yes I have received the mail. I will get back to you soon.