I'm trying to make a Convolutional 2D network that trains on image values, but, unfortunately, I can't seem to find a way to store each image as a variable.
(Before anyone asks, I have looked here , but base-64 encoding doesn't exactly work with convolutional neural networks.)
I have also tried matplotlib.image.imread
and glob.glob
, but these, again, do not store the actual image, but the data behind the image itself. And, again, I can't exactly train a neural network with metadata.
Does anyone have any ideas that I could use to do this?
You can read the image in using the pillow library and convert it to a numpy array so you can feed it into your network.
https://kite.com/python/examples/4887/PIL-convert-between-a-pil-%60image%60-and-a-numpy-%60array%60
If you need to save those arrays into a file for later use you can use np.savez .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.