The numpy array which I am storing contains an image. The size of the image is 23.4 KB but the size of the .npy file is 4 MB
import numpy as np
from keras.preprocessing.image import load_img,img_to_array
image=load_img('image.JPEG')
array=img_to_array(image)
np.save('sample.npy',array)
numpy.save()
if you need to compress it use
numpy.savez_compressed()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With