Skip to content
masterclassBuddyTech Buzz5 fresh blogs · 5:00 AM IST

Keras · Class

applications.InceptionV3

InceptionV3 builds the Inception v3 image-classification architecture, optionally initialized with ImageNet weights. Exclude its classifier and optionally pool the output to use it as a feature extractor.

How it works

InceptionV3 constructs the Keras implementation of the Inception v3 image-classification architecture. It can load ImageNet weights, retain or remove its classification head, and optionally apply global pooling to produce feature vectors; inputs should first pass through the matching preprocessing function.

Syntax

keras.applications.InceptionV3(include_top=True, weights="imagenet", input_tensor=None, input_shape=None, pooling=None, classes=1000, classifier_activation="softmax", name="inception_v3")

Parameters

NameTypeDescription
include_topBooleanWhether to include the final fully connected classification layer; defaults to True.
weightsNone, string, or pathNone for random initialization, "imagenet" for pretrained weights, or a weights-file path; defaults to "imagenet".
input_tensorKeras tensor or NoneOptional Keras input tensor to use as the model input; defaults to None.
input_shapetuple or NoneOptional three-channel input shape when include_top=False; defaults to None.
poolingstring or NoneOptional pooling mode for the feature output when the top is excluded; defaults to None.
classesintegerNumber of output classes when the top is included and no weights are specified; defaults to 1000.
classifier_activationstring or NoneActivation for the classifier output; defaults to "softmax".
namestringModel name; defaults to "inception_v3".

Returns

A Keras model instance for image classification, optionally initialized with ImageNet-pretrained weights.

Key points

  • Calling keras.applications.InceptionV3() creates the Inception v3 network.
  • The constructor can initialize the network with ImageNet-pretrained parameters.
  • weights accepts None, the ImageNet identifier, or a path to a weight file.
  • include_top controls whether the final classifier is part of the returned model.
  • Custom input shapes must represent RGB-style three-channel images.

Common mistakes

  • Custom input dimensions are available only when the classification head is removed.
  • A custom class count can be supplied only with the top classifier enabled and without predefined weights.
  • Custom spatial dimensions must be at least 75 pixels in each dimension.

Example: Create an InceptionV3 feature extractor

import keras

model = keras.applications.InceptionV3(
    weights="imagenet",
    include_top=False,
    pooling="avg",
    input_shape=(299, 299, 3),
)

inputs = keras.Input((299, 299, 3))
x = keras.applications.inception_v3.preprocess_input(inputs)
features = model(x)
feature_model = keras.Model(inputs, features)

Builds an ImageNet-backed InceptionV3 feature extractor and applies the model-specific pixel scaling before inference.

When to use it

Image classification

Predicting among the original ImageNet categories with pretrained parameters.

Feature extraction

Generating compact representations for downstream vision models.

Transfer learning

Replacing the original classifier with a task-specific output layer.

Interview questions

QWhat does weights="imagenet" provide? The model is initialized with weights pretrained on ImageNet, rather than random values or weights loaded from a supplied file path.

question is InceptionV3 limited to ImageNet classification?

Follow-up: How would you adapt it for a new label set? Use include_top=False, select a pooling strategy such as avg, and attach a new classifier.

QWhat is the effect of include_top?

The constructor returns a Keras image-classification model. Removing the top produces a backbone suitable for feature extraction, while pooling can turn spatial outputs into a fixed-size representation.

Follow-up: What does pooling="avg" do conceptually? It applies global average pooling to the final convolutional feature map.

QHow should inputs be prepared?

InceptionV3 expects model-specific preprocessing before inference. Its preprocessing scales pixel values between -1 and 1.

Follow-up: Can preprocessing be placed inside the model graph? Yes; apply keras.applications.inception_v3.preprocess_input to the input tensor before calling the InceptionV3 model.

  • keras.applications.inception_v3.preprocess_input
  • keras.applications.inception_v3.decode_predictions
  • keras.applications.InceptionResNetV2
  • keras.applications.Xception

Source: InceptionV3 model. Checked 2026-10-15.