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

Pretrained Backbones

~9 min · keras-cv

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

The backbone is the feature extractor

A backbone is the model minus its final task layer — the stack of convolutions (or transformer blocks) that turns raw pixels into a rich feature map. Pretrained on ImageNet, it already knows edges, textures, shapes, and object parts; your downstream task only has to learn how to read those features. That's transfer learning's whole leverage, and it's why almost no one in 2026 trains a vision model from random weights.

KerasCV ships a deep menu of backbones spanning the classic CNN, mobile, dense, and ViT-style families:

BackboneStyleSizes
EfficientNetV1/V2Efficient CNNB0–B7, S/M/L
ResNetClassic residual18/34/50/101/152
MiT (Mix Transformer)ViT-styleB0–B5
MobileNetV3Mobile-optimizedSmall/Large
DenseNetDense connections121/169/201
CSPDarkNetYOLO backboneTiny/S/M/L/XL

Choosing a size

The size suffix (B0 vs B7, ResNet18 vs ResNet152) is a direct latency-vs-accuracy dial: bigger backbones see more, but cost more per inference. Start small. A ResNet50 or EfficientNetV2-S is the workhorse default — enough capacity for most problems, fast enough to iterate on. Reach for the giants only after you've confirmed the small one is genuinely capacity-bound, not data-bound.

Code

Load a pretrained backbone via from_preset·python
import keras_cv

# Load a pretrained backbone
backbone = keras_cv.models.EfficientNetV2Backbone.from_preset(
    "efficientnetv2_s_imagenet"
)
Attach a classification head on top of the backbone·python
import keras

# backbone outputs a feature map; pool it, then classify
model = keras.Sequential([
    backbone,
    keras.layers.GlobalAveragePooling2D(),
    keras.layers.Dense(num_classes, activation="softmax"),
])

# Or skip the manual wiring: a task preset bundles backbone + head
classifier = keras_cv.models.ImageClassifier.from_preset(
    "efficientnetv2_s_imagenet", num_classes=num_classes
)

External links

Exercise

Build three classifiers using ResNet18, ResNet50, and ResNet152 backbones. Fine-tune each on a small dataset (Oxford Flowers 102). Plot accuracy vs. train time vs. parameter count on one chart — then identify the knee where adding capacity stops paying off. That knee is your real default for this data.
Hint
Freeze the backbone for the first few epochs (train only the head), then unfreeze with a low learning rate. The 152 will likely overfit a small dataset faster than the 50 — watch the val curve, not just final accuracy.

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.