Reputation: 48916
I have 374
32x32
images that I read and stored in a list as follows:
for root, dirs, files in os.walk(image_directory):
for i in range(number_of_images):
img = cv2.imread(root + '/' + str(i) + '.jpg')
real_images.append(img)
when I wanted to return the shape of real_images
by doing: numpy.array(real_images).shape
, I got (374,)
.
Why didn't I get (374, 32, 32, 3)
? That is, the number of images along with their dimensions?
Thanks.
Upvotes: 0
Views: 57
Reputation: 337
What @HaBom said in the comment might be the case. I tried the following and got a similar result as yours.
import numpy as np
a = []
for i in range(10):
a.append(np.arange(10))
print(np.array(a).shape)
a.append(np.array([1]))
print(np.array(a).shape)
Output:
(10,10)
(11,)
Try checking the shapes of individual np
array if you can. Maybe it will tell you what is happening. Hope this helps.
Upvotes: 1