Views
No views yet

| metric | value |
|---|---|
| validation loss | 0.2650 ± 0.0098 |
| validation accuracy | 95.14% ± 0.19 pp |
| test loss | 0.2791 |
| test accuracy | 94.76% |
| test correct | 9476 / 10000 |
8h2ywarm.[64, 128, 256]0.20.0013e-50.02qwfq2ihy044.ckpt8h2ywarmmodel.onnx for code-independent inference.images[batch, 1, 28, 28]float32logits[batch, 10]28 x 28.[0, 1].0.2860 and standard deviation 0.3530.[batch, 1, 28, 28].pip install huggingface_hub onnxruntime pillow numpy1import numpy as np
2import onnxruntime as ort
3from huggingface_hub import hf_hub_download
4from PIL import Image
5
6LABELS = {
7 0: "T-shirt/top",
8 1: "Trouser",
9 2: "Pullover",
10 3: "Dress",
11 4: "Coat",
12 5: "Sandal",
13 6: "Shirt",
14 7: "Sneaker",
15 8: "Bag",
16 9: "Ankle boot",
17}
18
19model_path = hf_hub_download(
20 repo_id="tsilva/fashion-mnist-classifier-cnn",
21 filename="model.onnx",
22)
23
24image = Image.open("example.png").convert("L").resize((28, 28))
25x = np.asarray(image, dtype=np.float32) / 255.0
26x = (x - 0.2860) / 0.3530
27x = x[None, None, :, :].astype(np.float32)
28
29session = ort.InferenceSession(model_path, providers=["CPUExecutionProvider"])
30logits = session.run(["logits"], {"images": x})[0]
31prediction = int(logits.argmax(axis=1)[0])
32
33print(prediction, LABELS[prediction])| id | label |
|---|---|
| 0 | T-shirt/top |
| 1 | Trouser |
| 2 | Pullover |
| 3 | Dress |
| 4 | Coat |
| 5 | Sandal |
| 6 | Shirt |
| 7 | Sneaker |
| 8 | Bag |
| 9 | Ankle boot |
model.onnx: ONNX export of the validation-selected checkpoint, using opset 17. Prefer this file for portable inference.model.ckpt: PyTorch Lightning checkpoint for the same model. This is code-dependent and mainly useful for PyTorch-based inspection or continued experimentation.config.yaml: resolved training config.metrics.csv: training/validation metric history.modeling.py: minimal PyTorch model definition and checkpoint loader for users who specifically need the checkpoint path.label_mapping.json: label id to class name mapping.