Skip to content

Latest commit

 

History

History
145 lines (91 loc) · 4.16 KB

File metadata and controls

145 lines (91 loc) · 4.16 KB

Convolutional Neural Network for Intel Image Classification

An efficient convolutional neural network achieving 90% accuracy on the Intel Image Classification dataset in just 12-30 training epochs without transfer learning with comprehensive metric monitoring.

Results

  • 90.07% accuracy
  • Fast convergence: 89%+ accuracy in just 12-30 epochs
  • ResNet-like architecture, implemented from scratch
  • Comprehensive monitoring via TensorBoard
  • Excellent PR-Curves and histograms
  • Overfitting gap of only 0.17%

Architecture

Full diagram

CNN Full Graph



CNN Principal Scheme

Optimizer

Various optimizers were tested, including PNMBelief, DiffPNM, Adam, AdamW, SGD, NSGD. As a result of testing and fine-tuning, it was found that optimizers with positive-negative momentum estimation do not provide accuracy improvements for this model. SGD and Nesterov SGD optimizers also showed no advantages in either accuracy or convergence speed.

The best optimizer turned out to be AdamW, achieving maximum accuracy of 90.07% with the fastest convergence speed. The model with AdamW optimizer reaches about 89% accuracy in just 12-30 epochs, which is significantly faster than other optimizers that lag behind by an average of 10-15 epochs under similar conditions.

Optimal parameters were determined empirically:

  num_epochs: 30
  batch_size: 40

  learning_rate: 0.000375
  beta0: 0.915
  beta1: 0.985
  weight_decay: 0.0017

Metrics

The project includes a comprehensive set of metrics and visualizations:

TensorBoard

  • Confusion Matrix - error matrix with absolute and normalized values
  • PR-Curves - Precision-Recall curves with good coverage
  • Weight/Bias/Gradient histograms and distributions for all model layers
  • Key metrics loss and accuracy for train and test sets

Scalars

Accuracy

Loss

Learning Rate

PR-Curves

PR-Curve Forest PR-Curve Sea PR-Curve Street

Confusion Matrix

Confusion Matrix Epoch 2 Confusion Matrix Epoch 27

Confusion matrices at epochs 2 and 27

Histograms

Gradients Histograms Biases Histograms

Gradients and biases histograms

Distributions

Biases Distributions Gradients Distributions

Biases and gradients distributions

Installation

poetry install

Usage

python scripts/train.py

tensorboard --logdir=outputs/logs

python scripts/predict.py

Dependencies

  • ~3 GB VRAM/RAM
  • Python >=3.13,<3.15
  • NumPy (>=2.3.5,<3.0.0)
  • Tqdm (>=4.67.1,<5.0.0)
  • Torch (>=2.9.1,<3.0.0)
  • Torchvision (>=0.24.1,<0.25.0)
  • Scikit-learn (>=1.7.2,<2.0.0)
  • Tensorboard (>=2.20.0,<3.0.0)
  • Torchviz (>=0.0.3,<0.0.4)