I’ve fixed a number of coding errors for this exercise but cant seem to get around the NameError i keep getting regarding GlobalAveragePooling. The error message is below. Thanks for any help you may be able to provide.
in alpaca_model(image_shape, data_augmentation)
38 # use global avg pooling to summarize the info in each channel
39 nb_layers = len(base_model.layers)
—> 40 x = GlobalAveragePooling2D(x)
41 #include dropout with probability of 0.2 to avoid overfitting
42 x = tf.Keras.Droput(rate=0.2)(x)
NameError: name ‘GlobalAveragePooling2D’ is not defined
Thanks TMosh! I was indeed missing the prefix on both, however GlobalAvgPooling is still coming up as the source of my error. The error code is shown below.
in alpaca_model(image_shape, data_augmentation)
38 # use global avg pooling to summarize the info in each channel
39 nb_layers = len(base_model.layers)
—> 40 x = tfl.GlobalAveragePooling2D(x)
41 #include dropout with probability of 0.2 to avoid overfitting
42 x = tfl.Keras.Droput(rate=0.2)(x)
/opt/conda/lib/python3.7/site-packages/tensorflow/python/keras/utils/conv_utils.py in normalize_data_format(value)
190 if value is None:
191 value = backend.image_data_format()
→ 192 data_format = value.lower()
193 if data_format not in {‘channels_first’, ‘channels_last’}:
194 raise ValueError('The data_format argument must be one of ’
AttributeError: ‘Tensor’ object has no attribute ‘lower’
Great! Yes, there was a problem in how you invoked the GlobalPooling function. You need two steps: define the function and then invoke it. You only did one of those two steps.