CIFAR-10 MLP

Own model trained for SMAI Assignment 4, Q1. model.npz contains the final clean-label (p=0) model compared in Section 1.5, trained for 100 epochs on the original 50,000 CIFAR-10 training images. No test-based epoch selection was used. Architecture and training settings are in config.json and embedded in the NPZ file. Weight matrices use input-by-output orientation; biases and all numerical arrays are float64.

Preprocessing and loading

Convert RGB images to NumPy float64, flatten in row-major order to 3,072 features, divide by 255, then subtract preprocess_mean and divide by preprocess_scale from model.npz. These statistics were fitted on the 50,000 training images only. Classes are airplane, automobile, bird, cat, deer, dog, frog, horse, ship and truck (IDs 0–9).

import json
import numpy as np
import torch
from ioc_torch import TorchClassifier

with np.load("model.npz", allow_pickle=False) as saved:
    metadata = json.loads(str(saved["metadata"]))
    mean = saved["preprocess_mean"].copy()
    scale = saved["preprocess_scale"].copy()
settings = metadata["training_config"]
model = TorchClassifier(
    depth=settings["depth"], widths=settings["widths"],
    activation=settings["activation"], loss="CCE",
    learning_rate=settings["learning_rate"], batch_size=settings["batch_size"],
    grad_accumulation_steps=settings["grad_accumulation_steps"],
    convex=metadata["convex"],
).load_from("model.npz").eval()
# images: uint8 RGB array of shape (N, 32, 32, 3)
# x = (images.astype(np.float64).reshape(-1, 3072) / 255.0 - mean) / scale
# with torch.no_grad():
#     probabilities = model(torch.from_numpy(x)).softmax(dim=1)

The NPZ includes every weight and bias. The loader checks architecture shapes before changing parameters. This small raw-pixel model is an assignment experiment, not a production image classifier.

numpy_mlp_selected.npz additionally preserves the NumPy model selected in Section 1.2.5 using the custom 36,000/12,000/12,000 split, with its own preprocessing statistics. It is distinct from the final PyTorch model in model.npz.

Downloads last month
-
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Dataset used to train armboss200/smai-assignment-4-mlp