Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

index error: index 2 is out of bounds #2

Open
Adamszk opened this issue Jun 30, 2020 · 0 comments
Open

index error: index 2 is out of bounds #2

Adamszk opened this issue Jun 30, 2020 · 0 comments

Comments

@Adamszk
Copy link

Adamszk commented Jun 30, 2020

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:

  1. 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))

  2. 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant