Skip to content

index error: index 2 is out of bounds  #2

@Adamszk

Description

@Adamszk

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions