smai-a4-iocnn / README.md
Chervith-Reddy's picture
Upload model weights, preprocessing and config
fc0a002 verified
|
Raw History Blame Contribute Delete
1.44 kB
---
library_name: numpy
tags:
- image-classification
- cifar10
datasets:
- uoft-cs/cifar10
---
# CIFAR-10 IOC-NN (3072-128-10)
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.
- Architecture: 3072-128-10 (394,634 parameters); hidden activation `elu`, Identity output layer (logits).
- Trained on the 50,000 CIFAR-10 training images with their true labels for 100 epochs: plain SGD, learning rate 0.01, batch size 64, cross-entropy loss, seed 1076.
- CIFAR-10 test accuracy (10,000 images): 0.4805; final training accuracy 0.8167.
## Files
- `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.
## Use
```python
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
```