0

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

2
  • 1
    This is something very specific to that code base. There is a function called load_dataset() that returns a tuple of objects, one of which is a numpy array called train_set_x_orig. What is the data about? Usually, images have three channels. Commented Nov 10, 2020 at 11:46
  • 1
    Example interpretation: (m_train, num_px, num_px, 3) = n images * n pixels width * n pixels height = n pixels width * 3 color-channels (e.g. RGB) Commented Nov 10, 2020 at 11:47

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.