Google Professional Machine Learning Engineer Question 516
Single answerGoogle Cloud PlatformYou are tasked with building a machine learning model for image classification on Google Cloud. The input dataset contains images with a resolution of 224x224 pixels, and you decide to use a convolutional neural network (CNN). During preprocessing, you need to correctly configure the input dimension for the model. Which of the following is the correct input dimension you should set for the images?
- A
[224, 224]
- B
[224, 224, 3]
- C
[224, 224, 1]
- D
[3, 224, 224]
Show answer and explanation
Correct answer: B
Explanation
When preparing image data for a convolutional neural network (CNN) on Google Cloud, it is essential to correctly specify the input dimensions. For RGB images, the input dimension should include height, width, and the number of channels (3 for RGB). TensorFlow and Keras models use the channel-last format by default, which means the correct input dimension for the given dataset is [224, 224, 3].
- A. Incorrect.
This option is incorrect because it only specifies the height and width of the image but does not include the number of color channels (e.g., RGB).
- B. Correct.
This option is correct because it specifies the height, width, and color channels (3 for RGB), which is the standard input format for image data in most machine learning frameworks.
- C. Incorrect.
This option is incorrect because it specifies a single channel input, which is typically used for grayscale images. However, the dataset contains RGB images with three channels.
- D. Incorrect.
This option is incorrect because it represents a format where the channel dimension comes first (channel-first format), which is not the default for most TensorFlow or Keras models. The default is channel-last format: [height, width, channels].