raghakot / keras-resnet

Residual networks implementation using Keras-1.0 functional API
Other
1.39k stars 617 forks source link

inference image preprocessing #56

Closed AlphaRalph closed 6 years ago

AlphaRalph commented 6 years ago

I get wonderful results while training (val_acc > 98%), but when i try to evaluate images it seems like rolling a dice.

Is it necessary to preprocess the images the same way, as it is done before training? I tried the following:

image = cv2.resize(image, (32, 32)) image = img_to_array(image) image = image.astype('float32') mean_image = np.mean(image, axis=0) image -= mean_image image /= 128. image = np.expand_dims(image, axis=0)

But the result is not usable at all. Thanks in advance

AlphaRalph commented 6 years ago

Had to save and use mean image over all training images