How to preprocess single image(X_ray) for prediction

How to preprocess single image to make it able for prediction , as in assignment we predicted whole batch using test_generator which normalized all batch , so how can we do the same preprocessing for single image as we standardize on sample of 100 training images in generator


You can use keras image preprocessor. Instead of preprocess image data from directory, load an image and process the image data. You can use the function;

image.load_img(path, target_size);

and then turn the imge to the array with;


You can find these function in keras and tensorflow. You can then use array() or expand_dims() from numpy.

1 Like

@me_sajied , and what about normalize or it just needed in training

Bunch of data can be normalized. Normalization means reorganization of data. Single information has nothing to do with the organization.