How to save pixels after normalization
I want to normalize my images and use them in the training. But I couldn't find a way to save images after making changes below...How can I save it?
files = [/content/drive/MyDrive/Colab Notebooks/images/evre1/xyz.png,
/content/drive/MyDrive/Colab Notebooks/images/evre1/xty.png]
def normalize(files):
for i in files:
image = Image.open(i)
new_image =image.resize((224,224))
pixels = asarray(image)
# convert from integers to floats
pixels = pixels.astype('float32')
# calculate global mean and standard deviation
mean, std = pixels.mean(), pixels.std()
# print('Mean: %.3f, Standard Deviation: %.3f' % (mean, std))
# global standardization of pixels
pixels = (pixels - mean) / std
# confirm it had the desired effect
print(pixels)
# mean, std = pixels.mean(), pixels.std()
# print('Mean: %.3f, Standard Deviation: %.3f' % (mean, std))
normalize(files)
Thanks.
Topic normalization image-classification computer-vision deep-learning
Category Data Science