SADIK Vision Multiverse - TinyNet (54 KB)
A very small int8 image classifier for the 4-class SADIK Vision Multiverse dataset, created by Sadik Nawaz (Age 11).
- Weights file:
tinynet_int8.bin- 53.60 KB (54,882 bytes), single self-contained blob - Parameters: 47,236
- Input: 96x96 RGB
- Backbone: depthwise-separable CNN trained from scratch via knowledge distillation from the 83%-accuracy ResNet18 teacher
- Quantization: int8 per-output-channel symmetric weights, float16 BatchNorm/bias, float16 scales
Goal: a model that fits in under 59 KB while still learning the 4 classes.
Results (int8, 5-fold cross-validation)
| Metric | Score |
|---|---|
| Int8 out-of-fold accuracy | 61.0% |
| Int8 CV accuracy | 61.1% +/- 6.9% |
| Int8 macro F1 | 53.0% |
| Class | Precision | Recall | F1 | Support |
|---|---|---|---|---|
| anime_digital_art | 0.58 | 0.64 | 0.61 | 11 |
| cyberpunk_tech | 0.65 | 0.46 | 0.54 | 24 |
| game_assets_3d | 0.20 | 0.18 | 0.19 | 11 |
| photorealistic_portraits | 0.71 | 0.87 | 0.78 | 31 |
The dataset has only 77 hand-cleaned images, so treat these numbers as an educational estimate, not a production benchmark. The tiny 54 KB model is intentionally much weaker than the 83% ResNet18 teacher.
Usage
pip install torch torchvision numpy pillow
python predict_tiny.py my_image.jpg
from tinynet import load_int8, read_extra
from PIL import Image
from torchvision import transforms
import torch
model = load_int8("tinynet_int8.bin")
info = read_extra("tinynet_int8.bin")
tf = transforms.Compose([
transforms.Resize(256),
transforms.CenterCrop(224),
transforms.Resize((96, 96)),
transforms.ToTensor(),
transforms.Normalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225]),
])
with torch.no_grad():
probs = model(tf(Image.open("my_image.jpg").convert("RGB")).unsqueeze(0)).softmax(1)[0]
for cls, p in sorted(zip(info["class_names"], probs.tolist()), key=lambda x: -x[1]):
print(f"{cls:28s} {p:.1%}")
The int8 file is dequantized to float32 at load time, so it runs anywhere PyTorch runs - no special int8 kernels needed.
Training
- Train a ResNet18 teacher (5-fold CV, 83.1% out-of-fold).
- Cache 16 augmented views per image plus the teacher's soft logits.
- Distill the teacher into TinyNet (temperature 2.0, 50/50 cross-entropy + KL loss).
- Quantize weights to int8 per output channel.
- Evaluate on held-out folds (61.0% int8 out-of-fold accuracy).
Files:
tinynet_int8.bin- 53.6 KB quantized weights (the tiny model)tinynet_fp32.pt- 214.1 KB float32 checkpointtinynet.py- architecture + quantization/loading codefast_train.py- full training + distillation scriptpredict_tiny.py- CLI inferencemetrics.json,sizes.json
Limitations
- 77 training images only; accuracy is noisy.
- 96x96 input, so fine details are lost.
cyberpunk_techvsgame_assets_3dis the hardest pair.- Int8 weights are dequantized for inference (small file, not faster compute).
- Not suitable for safety-critical or production use.
Author
Sadik Nawaz - 11-year-old AI developer from Pakistan
- Hugging Face: @SadikNawazAI