python Deep learning load image dataset




Asked on March 24, 2023

I'm new to deep learning. I feel so stupid myself, because I'm asking many questions during one day.

I'm loading images through glob, and I'm heading a problem.

I pnned to load images to numpy, and I hope it's shape: width * height * imagecounts (only 1 shape), but it is not. I wants 128*128*242, and the result is 128, 128, 3( and I don't know where the '3' come from.)

I think, one of the problem is I need to load whole images, but every time I renew the data into new image, and not calculating the counts.

I'm learning about 'deep learning' to make 'deep learning', and I really want to make it on my own later, please help.

Data example:

[[255 255 255]
 [255 255 255]
 [255 255 255]
      ...
 [255 255 255]
 [255 255 255]
 [255 255 255]]

Here's my code

def _load_img():
# I get data_list with
# data_list = glob('dataset\\training\\*\\*.jpg')
    for v in data_list: 
        data = np.array(Image.open(v))

#img_size : 128 * 128
#I reshaped the data to get 242 the number of images count.
    data = data.reshape(-1, img_size)

    return data



Write Answer











©2024 concretepage.com | Privacy Policy | Contact Us