uoft-cs/cifar10
Viewer โข Updated โข 60k โข 355k โข 142
An input-output convex neural network (IOC-NN) for CIFAR-10 on raw pixels: ELU hidden activation and non-negative weights in every layer after the first, so every logit is a convex function of the input.
elu, Identity output layer (logits).weights.npz: W0, b0, W1, b1 (float64); layer i computes h @ W_i + b_i with W_i of shape (n_in, n_out).preprocessing.npz: mean and std (3072 values each) of the training pixels after dividing by 255.config.json: architecture, preprocessing, training settings and results.import numpy as np
w, prep = np.load("weights.npz"), np.load("preprocessing.npz")
x = (images.reshape(len(images), 3072) / 255.0 - prep["mean"]) / prep["std"] # images: uint8 (n, 32, 32, 3)
h = np.where((z := x @ w["W0"] + w["b0"]) > 0, z, np.expm1(np.minimum(z, 0.0)))
logits = h @ w["W1"] + w["b1"] # classes: airplane, automobile, bird, cat, deer, dog, frog, horse, ship, truck