C.W.K.
Stream
Lesson 02 of 07 · published

Keras Applications

~9 min · transfer

Level 0Keras Apprentice
0 XP0/97 lessons0/20 achievements
0/120 XP to next level120 XP to go0% complete

The built-in catalog

Keras ships 37+ pretrained image models in keras.applications — every one carries ImageNet weights and a known accuracy/size tradeoff. You don't pick by name recognition; you pick by where the model has to run and how much accuracy you can afford to buy with parameters.

ModelParamsTop-1 AccBest For
EfficientNetV26M–119MUp to 85.7%Best accuracy/efficiency tradeoff
ResNet5025M76.0%Widely used, well understood
MobileNetV32.5M–5.4M75.2%Mobile/edge deployment
ConvNeXt28M–350MUp to 88.5%Modern CNN architecture
VGG16138M71.3%Simple, educational

The one argument that matters: include_top

For transfer learning you almost always load with include_top=False. That argument decides whether you get the original ImageNet classifier on top. With it set to False, Keras drops the final 1000-way Dense layer and hands you the raw feature extractor — the convolutional stack that turns an image into a feature map. You then attach your own head sized to your number of classes. Keep the default include_top=True only when you actually want to predict the original 1000 ImageNet categories. The Code section below shows the exact call.

One sizing detail: with include_top=False the output is a feature map (height × width × channels), not a vector — which is why the next lesson always follows the backbone with a GlobalAveragePooling2D before the Dense head.

Code

Load a backbone without its classifier head·python
# Load pretrained model (without classification head)
base_model = keras.applications.EfficientNetV2S(
    weights="imagenet",
    include_top=False,      # Remove classification layers
    input_shape=(224, 224, 3),
)

External links

Exercise

Load ResNet50 with include_top=False. Print the output shape for a (224,224,3) input. Add GlobalAveragePooling + Dense(num_classes) on top. Verify model.summary() makes sense.

Progress

Progress is local-only — sign in to sync across devices.
Spotted a bug or have feedback on this page?Report an Issue

Comments 0

🔔 Reply notifications (sign in)
Sign inPlease sign in to comment.

No comments yet — be the first.