The code is good and efficient. However I found some bugs probably due to usage of old python kernel (3.6.9). I am not sure. I got two errors when compiling this code:
-
loaded_model needs to be compiled first before using it.
Solution: It is a temporary solution. I loaded the model in the last line of code instead after saving the model code line and before the test routine. The proper solution will be to compile the loaded_model.
add the following code:
# evaluate loaded model on test data loaded_model.compile(optimizer='rmsprop', loss='mse', metrics = ['accuracy']) score = loaded_model.evaluate(Xtest, Ytest, verbose=0) print("%s: %.2f%%" % (loaded_model.metrics_names[1], score[1]*100))
-
This error occurs at the line where images of test and prediction are to be plotted. (originally last line of code)
IndexError Traceback (most recent call last)
<ipython-input-27-e8239560eb56> in <module>
7 for filename in os.listdir('Dataset/Test/'):
8 colorize.append(img_to_array(load_img('Dataset/Test/'+filename)))
----> 9 ax[row,0].imshow(load_img('Dataset/Test/'+filename), interpolation='nearest')
10 row +=1
11
IndexError: index 2 is out of bounds for axis 0 with size 2
I have no clue yet how to solve it.
The code is good and efficient. However I found some bugs probably due to usage of old python kernel (3.6.9). I am not sure. I got two errors when compiling this code:
loaded_model needs to be compiled first before using it.
Solution: It is a temporary solution. I loaded the model in the last line of code instead after saving the model code line and before the test routine. The proper solution will be to compile the loaded_model.
add the following code:
# evaluate loaded model on test data loaded_model.compile(optimizer='rmsprop', loss='mse', metrics = ['accuracy']) score = loaded_model.evaluate(Xtest, Ytest, verbose=0) print("%s: %.2f%%" % (loaded_model.metrics_names[1], score[1]*100))This error occurs at the line where images of test and prediction are to be plotted. (originally last line of code)
I have no clue yet how to solve it.