Fail to write this line of code:
add the new Binary classification layers
use global avg pooling to summarize the info in each channel
x= ?
Having tried this function: x=global_avg_pooling()(x)
but it says that “global_avg_pooling” is not defined!
So which function is useful in this case?
Like all the other functions we are using here, it is a Keras “Layer” function. Here’s the docpage for it.
2 Likes
then, it asks me to “use a prediction layer with one neuron (as a binary classifier only needs one)”
but if I write “tfl.Prediction” or “tfl.Predict”, it warns that “module ‘tensorflow.keras.layers’ has no attribute ‘Predict’/‘Prediction’”
Why is that?
What does prediction layer mean? 
They just mean a Dense layer with one output neuron.
Note that they show you what the summary of the model is supposed to look like, if you examine the following test cell. Looking at that would also have given you the clue about the global pooling layer.
1 Like
Note that you would normally expect to use a sigmoid activation function in that case, but you don’t need to: it is handled by the binary cross entropy loss function with the from_logits = True argument.
1 Like