Created
June 18, 2019 06:27
-
-
Save netsatsawat/4b56aeed96c4066cb4e22c57162054a9 to your computer and use it in GitHub Desktop.
Use the network to predict the test data generator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
STEP_SIZE_TEST = testing_generator.n // testing_generator.batch_size | |
testing_generator.reset() | |
predictions = malaria_model.predict_generator(testing_generator, | |
steps=STEP_SIZE_TEST, | |
verbose=1) | |
img_name = testing_generator.filenames | |
results = pd.DataFrame({'img_name': img_name, | |
'prediction': predicted_class}) | |
_this = results.img_name.str.split('\\', n=1, expand=True) | |
results['reference'] = _this[0] | |
# Add true label | |
lookup_class = dict((k, v) for k, v in (training_generator.class_indices).items()) | |
results['true_label'] = results.reference.map(lookup_class) | |
display(results.head(5)) | |
''' | |
img_name prediction reference true_label | |
0 Parasitized\Parasitized_C100P61ThinF_IMG_20150918_144348_cell_143.png 0 Parasitized 0 | |
1 Parasitized\Parasitized_C100P61ThinF_IMG_20150918_144348_cell_144.png 0 Parasitized 0 | |
2 Parasitized\Parasitized_C100P61ThinF_IMG_20150918_145422_cell_166.png 0 Parasitized 0 | |
3 Parasitized\Parasitized_C100P61ThinF_IMG_20150918_145422_cell_169.png 0 Parasitized 0 | |
4 Parasitized\Parasitized_C100P61ThinF_IMG_20150918_145609_cell_145.png 0 Parasitized 0 | |
''' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment