This is a lightweight ResNet-style classifier built to study how a model trained from scratch on a small, low-resolution dataset generalizes — and where it breaks.
The architecture consists of an initial 3×64 convolution stem followed by three residual stages (64 → 128 → 256 channels), each containing two residual blocks with skip connections. Global average pooling feeds into a single linear classification head over 10 classes.
The model achieves near-perfect training accuracy (>99%) but plateaus at ~91% on the validation set, indicating a generalization gap of ~8%. This gap is analyzed in detail below.
1# --- 3. Run inference ---23python src/infer.py your_image.jpg
4# Provide image path: your_image.jpg5# Prediction: CAR | Confidence: 99.97%
Training Details
Hyperparameters
Parameter
Value
Optimizer
AdamW
Learning Rate
0.001
Weight Decay
1e-4
Batch Size
128
Max Epochs
200
Early Stopping Patience
15 epochs
Scheduler
Early stopping on val loss
Data Augmentation
Training images were augmented with random cropping (32×32 with 4px padding) and random horizontal flips. Validation and test images received no augmentation. All images were normalized to the CIFAR-10 channel-wise mean and standard deviation.
Training Dynamics
The model was trained until early stopping triggered at approximately epoch 30–40. Training loss converged near zero while validation loss plateaued significantly earlier, producing the ~8% generalization gap. This suggests the model has enough capacity to memorize the training set but relies partially on dataset-specific texture and color shortcuts rather than fully generalized semantic features.
Limitations & Failure Modes
This model was trained on 32×32 images from a fixed distribution. It works well on inputs that resemble CIFAR-10's data characteristics but fails predictably in several ways:
Spurious Correlations (Background Dependence)
The model predicts "Airplane" with 100% confidence on a standard photo of a plane against a blue sky. While correct, this extreme confidence suggests reliance on the dominant blue background — a strong correlate of the airplane class in CIFAR-10 — rather than the aircraft's geometry.
Feature Dependency (Wheel Detection)
A Lamborghini Veneno in side profile is correctly classified as "Car" at 99.97% confidence despite a complex crowd background. The likely driver is the wheel feature: high-contrast dark circles are the most discriminative signal for the car class at low resolution.
Out-of-Distribution Viewpoints
A top-down photo of a sedan (roof visible, no wheels) is misclassified as "Truck" at 97.42% confidence. Without the expected side-profile shape or visible wheels, the model defaults to "Truck" based on the large, rectangular metallic surface. This confirms the model has learned 2D texture/shape heuristics rather than any 3D geometric understanding of objects.
General Limitations
Input must be resized to 32×32, causing severe information loss on high-resolution images.
Performance degrades on viewpoints, lighting conditions, and backgrounds not represented in CIFAR-10.
The model has no robustness to adversarial examples or significant domain shift.
Intended Use
This model is intended for educational and research purposes — specifically for studying generalization, overfitting dynamics, and inductive biases of small convolutional networks trained from scratch on low-resolution data. It is not intended for production use.