Bird
Raised Fist0
Computer Visionml~20 mins

Inception modules in Computer Vision - Practice Problems & Coding Challenges

Choose your learning style10 modes available

Start learning this pattern below

Jump into concepts and practice - no test required

or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
Challenge - 5 Problems
🎖️
Inception Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
What is the main purpose of an Inception module in a convolutional neural network?

Imagine you want your model to look at an image in many ways at once, like using different sized glasses to see details and the big picture. What is the main purpose of an Inception module?

ATo replace convolutional layers with fully connected layers for faster training.
BTo reduce the number of layers in the network by merging all convolutions into one.
CTo combine multiple convolution filters of different sizes to capture features at various scales simultaneously.
DTo increase the image size before feeding it into the network.
Attempts:
2 left
💡 Hint

Think about how the module uses different filter sizes in parallel.

Predict Output
intermediate
2:00remaining
What is the output shape of this Inception module snippet?

Given an input tensor of shape (batch_size, 28, 28, 192), what will be the output shape after this Inception module block?

Computer Vision
import tensorflow as tf
from tensorflow.keras import layers

input_tensor = tf.keras.Input(shape=(28, 28, 192))

branch1 = layers.Conv2D(64, (1,1), padding='same', activation='relu')(input_tensor)
branch2 = layers.Conv2D(96, (1,1), padding='same', activation='relu')(input_tensor)
branch2 = layers.Conv2D(128, (3,3), padding='same', activation='relu')(branch2)
branch3 = layers.Conv2D(16, (1,1), padding='same', activation='relu')(input_tensor)
branch3 = layers.Conv2D(32, (5,5), padding='same', activation='relu')(branch3)
branch4 = layers.MaxPooling2D((3,3), strides=(1,1), padding='same')(input_tensor)
branch4 = layers.Conv2D(32, (1,1), padding='same', activation='relu')(branch4)

output = layers.concatenate([branch1, branch2, branch3, branch4], axis=-1)
model = tf.keras.Model(inputs=input_tensor, outputs=output)
print(model.output_shape)
A(None, 28, 28, 256)
B(None, 28, 28, 224)
C(None, 28, 28, 192)
D(None, 28, 28, 320)
Attempts:
2 left
💡 Hint

Add the number of filters from all branches for the last dimension.

Model Choice
advanced
2:00remaining
Which model architecture first introduced the Inception module?

Which famous convolutional neural network architecture first used the Inception module to improve performance and efficiency?

AAlexNet
BGoogLeNet (Inception v1)
CVGGNet
DResNet
Attempts:
2 left
💡 Hint

It is also called Inception v1 and won the ImageNet challenge in 2014.

🧠 Conceptual
advanced
2:00remaining
What technique in the Inception module uses 1x1 convolutions for dimensionality reduction before expensive convolutions?

In Inception modules, 1x1 convolutions are used before larger convolutions to reduce the number of channels. What is this technique called?

ABatch normalization
BPooling
CDropout
DDimensionality reduction
Attempts:
2 left
💡 Hint

It helps reduce computation by lowering the number of input channels.

🔧 Debug
expert
3:00remaining
Why does this Inception module code raise a shape mismatch error?

Consider this code snippet for an Inception module. It raises a shape mismatch error during concatenation. What is the cause?

Computer Vision
import tensorflow as tf
from tensorflow.keras import layers

input_tensor = tf.keras.Input(shape=(28, 28, 192))

branch1 = layers.Conv2D(64, (3,3), padding='valid', activation='relu')(input_tensor)
branch2 = layers.Conv2D(96, (1,1), padding='same', activation='relu')(input_tensor)
branch2 = layers.Conv2D(128, (3,3), padding='same', activation='relu')(branch2)
branch3 = layers.Conv2D(16, (1,1), padding='same', activation='relu')(input_tensor)
branch3 = layers.Conv2D(32, (5,5), padding='same', activation='relu')(branch3)
branch4 = layers.MaxPooling2D((3,3), strides=(1,1), padding='same')(input_tensor)
branch4 = layers.Conv2D(32, (1,1), padding='same', activation='relu')(branch4)

output = layers.concatenate([branch1, branch2, branch3, branch4], axis=-1)
model = tf.keras.Model(inputs=input_tensor, outputs=output)
print(model.output_shape)
Abranch1 uses 'valid' padding causing smaller spatial dimensions than other branches.
Bbranch4 uses max pooling with stride 1 causing shape mismatch.
CThe input tensor shape is incompatible with 5x5 convolutions.
DConcatenation axis is incorrect; it should be axis=1.
Attempts:
2 left
💡 Hint

Check how padding affects output size in convolutions.

Practice

(1/5)
1. What is the main purpose of using 1x1 convolutions in an Inception module?
easy
A. To increase the spatial size of the feature maps
B. To add non-linearity without changing dimensions
C. To replace max pooling layers
D. To reduce the number of channels and keep the model efficient

Solution

  1. Step 1: Understand the role of 1x1 convolutions

    1x1 convolutions act as channel-wise feature selectors and reduce the number of channels, lowering computation.
  2. Step 2: Connect to Inception module efficiency

    By reducing channels before expensive convolutions, the model stays efficient without losing important information.
  3. Final Answer:

    To reduce the number of channels and keep the model efficient -> Option D
  4. Quick Check:

    1x1 convolutions reduce channels = B [OK]
Hint: 1x1 convs reduce channels to save computation [OK]
Common Mistakes:
  • Thinking 1x1 convs increase spatial size
  • Confusing 1x1 convs with pooling layers
  • Assuming 1x1 convs only add non-linearity
2. Which of the following is the correct way to combine outputs from different branches in an Inception module?
easy
A. Concatenate the outputs along the channel dimension
B. Use max pooling on all outputs
C. Multiply the outputs element-wise
D. Add the outputs element-wise

Solution

  1. Step 1: Identify how Inception combines branch outputs

    Inception modules concatenate outputs from different filter branches along the channel axis to keep all features.
  2. Step 2: Understand why concatenation is used

    Concatenation preserves all features from each branch, unlike addition or multiplication which mix them.
  3. Final Answer:

    Concatenate the outputs along the channel dimension -> Option A
  4. Quick Check:

    Outputs concatenated by channels = D [OK]
Hint: Inception outputs join by channel concat, not add [OK]
Common Mistakes:
  • Confusing concatenation with element-wise addition
  • Thinking outputs are multiplied
  • Assuming pooling merges outputs
3. Given this simplified Inception module code snippet, what is the shape of the output tensor?
import torch
import torch.nn as nn

class SimpleInception(nn.Module):
    def __init__(self):
        super().__init__()
        self.branch1 = nn.Conv2d(192, 64, kernel_size=1)
        self.branch2 = nn.Conv2d(192, 128, kernel_size=3, padding=1)
        self.branch3 = nn.Conv2d(192, 32, kernel_size=5, padding=2)
    def forward(self, x):
        b1 = self.branch1(x)
        b2 = self.branch2(x)
        b3 = self.branch3(x)
        return torch.cat([b1, b2, b3], dim=1)

input_tensor = torch.randn(1, 192, 28, 28)
model = SimpleInception()
output = model(input_tensor)
print(output.shape)
medium
A. (1, 224, 32, 32)
B. (1, 64, 28, 28)
C. (1, 224, 28, 28)
D. (1, 224, 28, 28, 3)

Solution

  1. Step 1: Calculate output channels per branch

    Branch1 outputs 64 channels, branch2 outputs 128, branch3 outputs 32. Total channels = 64+128+32 = 224.
  2. Step 2: Check spatial dimensions and concatenation

    All convolutions use padding to keep spatial size 28x28. Concatenation along channel dimension keeps height and width same.
  3. Final Answer:

    (1, 224, 28, 28) -> Option C
  4. Quick Check:

    Channels sum to 224, spatial unchanged = A [OK]
Hint: Sum channels from branches, keep spatial size same [OK]
Common Mistakes:
  • Adding spatial dimensions instead of channels
  • Ignoring padding effects on size
  • Misunderstanding concat dimension
4. Identify the error in this Inception module implementation:
class FaultyInception(nn.Module):
    def __init__(self):
        super().__init__()
        self.branch1 = nn.Conv2d(128, 32, kernel_size=1)
        self.branch2 = nn.Conv2d(128, 64, kernel_size=3, padding=1)
    def forward(self, x):
        b1 = self.branch1(x)
        b2 = self.branch2(x)
        return torch.cat([b1, b2], dim=2)
medium
A. Missing padding in branch2 convolution
B. Concatenation dimension should be 1, not 2
C. Input channels to branch1 are incorrect
D. Using nn.Conv2d instead of nn.Conv1d

Solution

  1. Step 1: Check concatenation dimension

    In PyTorch, channel dimension is 1. Concatenating along dim=2 (height) is incorrect for Inception outputs.
  2. Step 2: Confirm other parts

    Branch2 padding keeps spatial size consistent; input channels match; Conv2d is correct for images.
  3. Final Answer:

    Concatenation dimension should be 1, not 2 -> Option B
  4. Quick Check:

    Concat along channels = dim 1 [OK]
Hint: Concat outputs along channel dim (1), not height (2) [OK]
Common Mistakes:
  • Concatenating along wrong dimension
  • Confusing padding with error
  • Misreading input channel sizes
5. You want to design an Inception module that balances feature diversity and computational cost. Which combination best achieves this?
hard
A. Use 1x1 convolutions before 3x3 and 5x5 convolutions, then concatenate outputs
B. Use only 5x5 convolutions without 1x1 convolutions to capture large features
C. Use max pooling only and skip convolutions to reduce cost
D. Stack multiple 3x3 convolutions without any 1x1 convolutions

Solution

  1. Step 1: Understand feature diversity and cost tradeoff

    Large filters capture diverse features but are costly. 1x1 convolutions reduce channels before large filters to save cost.
  2. Step 2: Evaluate options

    Use 1x1 convolutions before 3x3 and 5x5 convolutions, then concatenate outputs uses 1x1 convs to reduce channels before 3x3 and 5x5, balancing diversity and efficiency. Others either ignore cost or diversity.
  3. Final Answer:

    Use 1x1 convolutions before 3x3 and 5x5 convolutions, then concatenate outputs -> Option A
  4. Quick Check:

    1x1 convs reduce cost + multi-filter concat = C [OK]
Hint: Use 1x1 convs before big filters for efficiency [OK]
Common Mistakes:
  • Ignoring 1x1 convs and increasing cost
  • Using only pooling loses feature richness
  • Stacking without channel reduction wastes resources