I am in the middle of doing the deep learning specialization course and I want to make a basic AI , but how do I upload an image dataset that I have downloaded into a numpy array in jupyter notebook??
Here is one sample code I found online for this purpose:
# Import the necessary libraries
from
PIL
import
Image
from
numpy
import
asarray
# load the image and convert into
# numpy array
img
=
Image.
open
(
'Sample.png'
)
# asarray() class is used to convert
# PIL images into NumPy arrays
numpydata
=
asarray(img)
# <class 'numpy.ndarray'>
print
(
type
(numpydata))
# shape
print
(numpydata.shape)