I am using the resnet model from keras.
I can use
tf.keras.applications.resnet50.ResNet50(include_top=True, weights=None, input_tensor=None,
    input_shape=(224,224,3), classes=2 )

and my ourput will be two classes
predictions (Dense)             (None, 2)            4098        avg_pool[0][0]                   


is there anyway to not have the Dense layer and just have two class prediction via average pooling?
I thought this code should do the trick:

tf.keras.applications.resnet50.ResNet50(
    include_top=False, weights=None, input_tensor=None,
    input_shape=(224,224,3), pooling='avg' , classes=2 )

but my output is still 2048:
avg_pool (GlobalAveragePooling2 (None, 2048)         0           conv5_block3_out[0][0]