--- license: mit library_name: pytorch tags: - image-classification - cifar10 - cnn - computer-vision datasets: - cifar10 metrics: - accuracy --- # CIFAR-10 CNN (1.2M parameters) A compact VGG-style convolutional network trained from scratch on CIFAR-10. It reaches **92.23% top-1 test accuracy** with under 1.2M parameters and trains in about 8.5 minutes on a single T4 GPU. ## Model Details - **Author:** Vishwajeet Adkine - **Type:** convolutional image classifier (PyTorch), trained from scratch - **Parameters:** 1,197,578 - **Input / output:** 3×32×32 RGB image, normalised with CIFAR-10 mean and std → logits for 10 classes (airplane, automobile, bird, cat, deer, dog, frog, horse, ship, truck) - **Architecture:** three blocks of two 3×3 conv layers (64, 128, 256 channels) with BatchNorm and ReLU, max-pooling between blocks, global average pooling, then `Linear(256→192) → ReLU → Dropout(0.3) → Linear(192→10)` ## Intended Use Educational and portfolio use: a small, reproducible baseline for CIFAR-10 and for experiments such as ablations, augmentation or compression. **Not intended for** real-world recognition tasks. It only knows 10 CIFAR classes at 32×32 resolution. ## Training | | | |---|---| | Data | CIFAR-10: 45,000 train / 5,000 validation / 10,000 test | | Augmentation | random crop (padding 4), horizontal flip | | Optimiser | SGD, Nesterov momentum 0.9, weight decay 5e-4 | | Schedule | one-cycle LR, max 0.1, 20% warm-up | | Regularisation | label smoothing 0.1, dropout 0.3 | | Epochs / batch | 30 / 128, mixed precision | | Selection | best validation accuracy | | Hardware | Tesla T4, about 8.5 minutes | ## Results | Metric | Value | |--------|-------| | Test accuracy (top-1) | **92.23%** | | Test accuracy (top-3) | 98.77% | | Best validation accuracy | 91.66% | The test set was used once, after model selection on the validation split. ## Limitations - Trained only on 32×32 CIFAR-10 images, so accuracy will drop on photos from other sources, other resolutions or objects outside the 10 classes. - No robustness testing (noise, blur, adversarial examples, distribution shift). - Cats and dogs are typically the hardest classes on CIFAR-10; check the confusion matrix before relying on per-class results. - The network always outputs one of the 10 classes, even for unrelated images. ## How to Use The class definition is in the training notebook (`cnn_cifar10_classifier.ipynb`). ```python ckpt = torch.load("cifar_cnn.pt", map_location="cpu") model = CifarCNN(); model.load_state_dict(ckpt["state_dict"]); model.eval() ``` ## Data and Licence CIFAR-10 (Krizhevsky, Nair and Hinton) — see the [dataset page](https://www.cs.toronto.edu/~kriz/cifar.html) for terms. Code and weights: MIT.