October 2018
Intermediate to advanced
252 pages
6h 49m
English
As the last step, we perform predictions on the test dataset. We load the model and read in the test image paths. We then create a separate process for reading in and resizing the test images using ThreadPool. This allows the images to be processed while the model evaluates the samples. Predictions are stored in the predictions CSV file for evaluation:
'''get predictions'''data_path = '/deeplearning-keras/ch05/data/test'model_path = '/deeplearning-keras/ch05/weights/model.h5'resize_dims = (256, 256, 3)test_divisions = 20 # Used for segmenting image evaluation in threadingbatch_size = 100 # Batch size used for keras predict functionins, outs = convModel()model = Model(inputs=ins, outputs=outs)model.load_weights(model_path)test_paths ...