VOOZH about

URL: https://www.geeksforgeeks.org/machine-learning/ml-getting-started-with-alexnet/

⇱ ML | Getting Started With AlexNet - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

ML | Getting Started With AlexNet

Last Updated : 12 May, 2026

AlexNet is a deep convolutional neural network used for image classification. It consists of multiple convolutional and fully connected layers designed to extract features and perform classification efficiently. It's features are:

  • ReLU activation enables faster training and better gradient flow.
  • Dropout reduces overfitting in fully connected layers.
  • Data augmentation helps in improving model generalization on image data.

Architecture

  • 5 convolutional layers with max pooling after the 1st, 2nd, and 5th layers.
  • Overlapping max pooling (3×3 filter, stride 2) improves performance.
  • 2 fully connected layers with dropout for regularization.
  • Softmax layer for final classification output.
👁 Image

Implementation

1. Importing Libraries

Import libraries like

2. Loading and Preprocessing CIFAR-10 Dataset

  • CIFAR-10 contains 60,000 32×32 RGB images across 10 classes.
  • Pixel values are scaled to [0, 1].
  • Labels are one-hot encoded for softmax classification.

3. Defining the AlexNet Model (Adjusted for CIFAR-10)

  • Adapted for CIFAR-10: Handles 32×32 images with 10 output classes.
  • Reduced FC layers: Prevents overfitting on small datasets.
  • Uses ReLU, Dropout, BatchNorm and softmax in the final layer.

4. Compiling the Model

Using adam optimizer and categorical_crossentropy for multi-class classification.

5. Training the Model

  • Train for 15 epochs, with 20% validation split.
  • You can increase epochs for better accuracy.

Output:

👁 Screenshot-2025-07-03-120714
Training

6. Evaluating the Model

Evaluates the trained model on test data to measure accuracy and performance.

Output:

Test Accuracy: 0.7387

7. Plotting Training & Validation Accuracy

Plots training and validation accuracy to visualize model performance over epochs.

Output:

👁 AlexNet
AlexNet on CIFAR-10

Advantages

  • Uses ReLU activation for faster training compared to traditional tanh/sigmoid.
  • Applies dropout to reduce overfitting during training.
  • Utilizes GPU-based parallel computation for faster processing.
  • Uses overlapping max pooling to improve generalization and performance.

Disadvantages

  • Has a large number of parameters, making it memory-intensive.
  • Requires high computational resources for training.
  • Lacks modular and automated architecture design.
  • Tends to overfit on small datasets.
  • Does not include modern architectural improvements.

Applications

  • Used for image classification of objects in images.
  • Acts as a feature extractor for transfer learning tasks.
  • Serves as a backbone for object detection models.
  • Applied in medical imaging for detecting abnormalities.
  • Used in facial recognition and emotion detection systems.
  • Helps in identifying objects in autonomous driving systems.
Comment
Article Tags: