Swastik
Swastik

Reputation: 396

Shape of an array in NumPy

In Neural Networks and Deep Learning by DeepLearning.AI in Coursera I've a doubt in 2nd Week Programming Assignment

train_set_x_orig, train_set_y, test_set_x_orig, test_set_y, classes = load_dataset()

In above code segment they say that train_set_x_orig is a numpy-array of shape (m_train, num_px, num_px, 3)

Someone please help me to understand how shape of train_set_x_orig is (m_train, num_px, num_px, 3) and even i can't able to visualize the contents of numpy-array train_set_x_orig

Upvotes: 0

Views: 169

Answers (1)

faheem
faheem

Reputation: 634

look like its an image. in python use this code.

import matplotlib.pyplot as plt

for i in train_set_x_orig:
   img = np.array(i).astype('uint8')
   plt.imshow(img)
   plt.show()

this will show you all images 1 by one. 1st dimension is number of images, 2nd dimension is width 3rd dimension is height 4th dimension is color channel

Upvotes: 1

Related Questions