How to iterate through test_data_gen

I can get the first item in test_data_gen with this code:
test = test_data_gen[0][0][0] # this is class ‘numpy.ndarray’

I can use the variable test in this code to see the image:
plt.imshow(test) #shows a picture with x and y axes

What I want to do is iterate through test_data_gen and put the images into an array so I call plotImages(image_array).

When I use next(test_data_gen) to try and append each numpy.ndarray to the list, it gets turned into a tuple.

What am I doing wrong here?

‘’'pics =
count = 10
while count > 0: #switch this to hold test = next(test_data_gen) see if that works…

pics.append(next(test_data_gen)) # pics needs to be an array of pictures from test_data_gen
count = count - 1
test = test_data_gen[0][0][0]# this is class ‘numpy.ndarray’
print(test.shape) # shape is (150, 150, 3)
plt.imshow(test) #shows a picture with x and y axes
print(type(test)) # class ‘numpy.ndarray’’’’

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.