MLP on CIFAR-10 β€” SMAI Assignment 4 (roll 2024101057)

  • Architecture: 3072 β†’ 512 β†’ 10 (fully connected), relu hidden activations, unconstrained weights; output = 10 logits (no activation), softmax cross-entropy loss.
  • Parameters: 1,578,506
  • Training: PyTorch, plain SGD, lr 0.01, batch size 64, grad_accumulation_steps 1, 100 epochs, true labels (p = 0), torch seed 1058, DataLoader seed 1059, float64.
  • Results: final train accuracy 0.9999, test accuracy (10,000-image test part) 0.5315.
  • Preprocessing: CIFAR-10 (uoft-cs/cifar10): the 50,000-image train part for training. Each 32x32x3 uint8 image (HWC order, as np.array(img)) is flattened to 3072 values, converted to float64, divided by 255 and standardised per column with the train-part mean/std in standardizer.npz (x_std = (x/255 - mean) / std; std 0 -> 1).

Files

  • mlp_p0.npz β€” weights in the assignment's Model.save_to format: W0, b0, W1, b1 with W of shape (n_in, n_out), plus architecture_json.
  • standardizer.npz β€” mean, std (3072 values each) used for preprocessing.
  • numpy_M1_selected_1.2.5.npz (+ numpy_M1_standardizer.npz) β€” the model selected in Task 1.2.5, trained with the from-scratch NumPy library on the stratified 36,000-image split.

Usage

import numpy as np
f, s = np.load("mlp_p0.npz"), np.load("standardizer.npz")
def forward(x_uint8):                       # x_uint8: (n, 32, 32, 3)
    h = (x_uint8.reshape(len(x_uint8), -1) / 255.0 - s["mean"]) / s["std"]
    h = h @ f["W0"] + f["b0"]
    h = np.maximum(h, 0)  # ReLU
    return h @ f["W1"] + f["b1"]           # logits
Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Dataset used to train Biased-Rook/smai-a4-cifar10-mlp