Fadwa
Fadwa

Reputation: 1931

Keras loaded model is Not working

I trained a model with Keras, saved it using model.save(), and from Keras Documentation i don't need to save any thing else or compile the model after loading.

When i load it to test it on different images it gives this error:

totalMemory: 5.93GiB freeMemory: 5.41GiB 2018-05-17 10:10:53.265572: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1120] Creating TensorFlow device (/device:GPU:0) -> (device: 0, name: GeForce GTX 1060 with Max-Q Design, pci bus id: 0000:01:00.0, compute capability: 6.1)

2018-05-17 10:10:55.939415: E tensorflow/stream_executor/cuda/cuda_dnn.cc:385] could not create cudnn handle: CUDNN_STATUS_INTERNAL_ERROR

2018-05-17 10:10:55.939452: E tensorflow/stream_executor/cuda/cuda_dnn.cc:352] could not destroy cudnn handle: CUDNN_STATUS_BAD_PARAM

2018-05-17 10:10:55.939459: F tensorflow/core/kernels/conv_ops.cc:667] Check failed: stream->parent()->GetConvolveAlgorithms( conv_parameters.ShouldIncludeWinogradNonfusedAlgo(), &algorithms)

Aborted (core dumped)

Here is the code i am using:

num_classes = 17
model = load_model('model.h5')


img1 = cv2.resize(cv2.cvtColor(cv2.imread("s_0.jpg"), cv2.COLOR_BGR2RGB), (24,24))
img2 = cv2.resize(cv2.cvtColor(cv2.imread("s_f.jpg"), cv2.COLOR_BGR2RGB), (24,24))
img3 = cv2.resize(cv2.cvtColor(cv2.imread("s_2.jpg"), cv2.COLOR_BGR2RGB), (24,24))

X_test = np.array([img1,img2,img3])
Y_test = to_categorical(np.array([0,12,2]), num_classes)

Y_predict = model.predict(X_test)
print np.argmax(Y_predict,axis = 1)

When i use the exact code for testing just after training (model is available not loaded), it works fine.

Upvotes: 1

Views: 799

Answers (1)

marcopah
marcopah

Reputation: 866

It looks like your CUDA is broken. Test it by disabling the GPU export CUDA_VISIBLE_DEVICES=-1.

Upvotes: 1

Related Questions