Publish trained RitualCNN ONNX model
Browse files- README.md +36 -0
- RitualCNN.onnx +3 -0
- config.json +19 -0
- metrics.json +319 -0
README.md
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: unlicense
|
| 3 |
+
library_name: onnx
|
| 4 |
+
pipeline_tag: image-classification
|
| 5 |
+
tags:
|
| 6 |
+
- onnx
|
| 7 |
+
- image-classification
|
| 8 |
+
- ritual-recognition
|
| 9 |
+
---
|
| 10 |
+
|
| 11 |
+
# RitualCNN
|
| 12 |
+
|
| 13 |
+
RitualCNN recognizes the seven ritual drawing classes used by the [Rituals game](https://github.com/methil-group/rituals).
|
| 14 |
+
|
| 15 |
+
## Use the model
|
| 16 |
+
|
| 17 |
+
The ONNX file is `RitualCNN.onnx`. It accepts a grayscale image as a `float32` tensor named `input`, with shape `[batch, 1, 128, 128]`.
|
| 18 |
+
|
| 19 |
+
Before inference, convert the image to grayscale, resize it to 128 by 128 pixels, set pixels above 127 to 1 and all other pixels to 0. The model returns seven raw scores named `output`. The highest score is the predicted class.
|
| 20 |
+
|
| 21 |
+
The output order is: `Acervus`, `Avarus`, `Flosculus`, `Mutus`, `Not`, `Pudor`, `Regium`.
|
| 22 |
+
|
| 23 |
+
## Training and evaluation
|
| 24 |
+
|
| 25 |
+
The model was trained on 163 original drawings. Source drawings were split by class into training and validation sets before augmentation. Rotations and small translations were applied to training drawings only. See `metrics.json` for the split, validation results, model checksum, and ONNX compatibility check.
|
| 26 |
+
|
| 27 |
+
The dataset is small. Validation results are only an estimate and should not be treated as a guarantee of accuracy on new drawings.
|
| 28 |
+
|
| 29 |
+
## Files
|
| 30 |
+
|
| 31 |
+
- `RitualCNN.onnx` — trained model, ONNX opset 11.
|
| 32 |
+
- `config.json` — input, output, and class information.
|
| 33 |
+
- `metrics.json` — training details and validation results.
|
| 34 |
+
- `README.md` — this model card.
|
| 35 |
+
|
| 36 |
+
Training code and the game are in the [Rituals GitHub repository](https://github.com/methil-group/rituals).
|
RitualCNN.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:985c6780057b8f016cae3db9be06c80752f23cd5837dfec9f4f6779e00574da8
|
| 3 |
+
size 409063
|
config.json
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"model_name": "RitualCNN",
|
| 3 |
+
"architecture": "PyTorch convolutional neural network exported to ONNX",
|
| 4 |
+
"input": {
|
| 5 |
+
"name": "input",
|
| 6 |
+
"shape": ["batch", 1, 128, 128],
|
| 7 |
+
"type": "float32",
|
| 8 |
+
"preprocessing": "Convert to grayscale, resize to 128x128, threshold at 127, normalize to 0 or 1."
|
| 9 |
+
},
|
| 10 |
+
"output": {
|
| 11 |
+
"name": "output",
|
| 12 |
+
"shape": ["batch", 7],
|
| 13 |
+
"type": "float32",
|
| 14 |
+
"meaning": "Raw class scores (logits). Select the label at the index with the highest score."
|
| 15 |
+
},
|
| 16 |
+
"labels": ["Acervus", "Avarus", "Flosculus", "Mutus", "Not", "Pudor", "Regium"],
|
| 17 |
+
"onnx_opset": 11,
|
| 18 |
+
"source_code": "https://github.com/methil-group/rituals"
|
| 19 |
+
}
|
metrics.json
ADDED
|
@@ -0,0 +1,319 @@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|
+
],
|
| 10 |
+
"labels": [
|
| 11 |
+
"Acervus",
|
| 12 |
+
"Avarus",
|
| 13 |
+
"Flosculus",
|
| 14 |
+
"Mutus",
|
| 15 |
+
"Not",
|
| 16 |
+
"Pudor",
|
| 17 |
+
"Regium"
|
| 18 |
+
],
|
| 19 |
+
"dataset": {
|
| 20 |
+
"source_drawings": 163,
|
| 21 |
+
"class_counts": {
|
| 22 |
+
"Acervus": {
|
| 23 |
+
"train": 22,
|
| 24 |
+
"validation": 5
|
| 25 |
+
},
|
| 26 |
+
"Avarus": {
|
| 27 |
+
"train": 12,
|
| 28 |
+
"validation": 3
|
| 29 |
+
},
|
| 30 |
+
"Flosculus": {
|
| 31 |
+
"train": 20,
|
| 32 |
+
"validation": 5
|
| 33 |
+
},
|
| 34 |
+
"Mutus": {
|
| 35 |
+
"train": 18,
|
| 36 |
+
"validation": 5
|
| 37 |
+
},
|
| 38 |
+
"Not": {
|
| 39 |
+
"train": 19,
|
| 40 |
+
"validation": 5
|
| 41 |
+
},
|
| 42 |
+
"Pudor": {
|
| 43 |
+
"train": 13,
|
| 44 |
+
"validation": 3
|
| 45 |
+
},
|
| 46 |
+
"Regium": {
|
| 47 |
+
"train": 26,
|
| 48 |
+
"validation": 7
|
| 49 |
+
}
|
| 50 |
+
}
|
| 51 |
+
},
|
| 52 |
+
"split": "Per-class 80/20 split of original drawings; augmentations applied only to training samples.",
|
| 53 |
+
"training": {
|
| 54 |
+
"epochs_requested": 60,
|
| 55 |
+
"best_epoch": 47,
|
| 56 |
+
"early_stopping_patience": 10,
|
| 57 |
+
"batch_size": 16,
|
| 58 |
+
"optimizer": "Adam",
|
| 59 |
+
"learning_rate": 0.001,
|
| 60 |
+
"weight_decay": 0.0001,
|
| 61 |
+
"loss": "class-weighted cross-entropy",
|
| 62 |
+
"augmentation": "Random rotation up to 15 degrees and translation up to 12 pixels, independently with 50% probability.",
|
| 63 |
+
"seconds": 87.72,
|
| 64 |
+
"pytorch_version": "2.8.0+cpu"
|
| 65 |
+
},
|
| 66 |
+
"validation_loss": 1.158913,
|
| 67 |
+
"validation": {
|
| 68 |
+
"accuracy": 0.6364,
|
| 69 |
+
"macro_f1": 0.5978,
|
| 70 |
+
"per_class": {
|
| 71 |
+
"Acervus": {
|
| 72 |
+
"support": 5,
|
| 73 |
+
"precision": 1.0,
|
| 74 |
+
"recall": 0.4,
|
| 75 |
+
"f1": 0.5714
|
| 76 |
+
},
|
| 77 |
+
"Avarus": {
|
| 78 |
+
"support": 3,
|
| 79 |
+
"precision": 0.75,
|
| 80 |
+
"recall": 1.0,
|
| 81 |
+
"f1": 0.8571
|
| 82 |
+
},
|
| 83 |
+
"Flosculus": {
|
| 84 |
+
"support": 5,
|
| 85 |
+
"precision": 0.5556,
|
| 86 |
+
"recall": 1.0,
|
| 87 |
+
"f1": 0.7143
|
| 88 |
+
},
|
| 89 |
+
"Mutus": {
|
| 90 |
+
"support": 5,
|
| 91 |
+
"precision": 0.0,
|
| 92 |
+
"recall": 0.0,
|
| 93 |
+
"f1": 0.0
|
| 94 |
+
},
|
| 95 |
+
"Not": {
|
| 96 |
+
"support": 5,
|
| 97 |
+
"precision": 1.0,
|
| 98 |
+
"recall": 0.6,
|
| 99 |
+
"f1": 0.75
|
| 100 |
+
},
|
| 101 |
+
"Pudor": {
|
| 102 |
+
"support": 3,
|
| 103 |
+
"precision": 0.5,
|
| 104 |
+
"recall": 1.0,
|
| 105 |
+
"f1": 0.6667
|
| 106 |
+
},
|
| 107 |
+
"Regium": {
|
| 108 |
+
"support": 7,
|
| 109 |
+
"precision": 0.5556,
|
| 110 |
+
"recall": 0.7143,
|
| 111 |
+
"f1": 0.625
|
| 112 |
+
}
|
| 113 |
+
},
|
| 114 |
+
"confusion_matrix": [
|
| 115 |
+
[
|
| 116 |
+
2,
|
| 117 |
+
0,
|
| 118 |
+
3,
|
| 119 |
+
0,
|
| 120 |
+
0,
|
| 121 |
+
0,
|
| 122 |
+
0
|
| 123 |
+
],
|
| 124 |
+
[
|
| 125 |
+
0,
|
| 126 |
+
3,
|
| 127 |
+
0,
|
| 128 |
+
0,
|
| 129 |
+
0,
|
| 130 |
+
0,
|
| 131 |
+
0
|
| 132 |
+
],
|
| 133 |
+
[
|
| 134 |
+
0,
|
| 135 |
+
0,
|
| 136 |
+
5,
|
| 137 |
+
0,
|
| 138 |
+
0,
|
| 139 |
+
0,
|
| 140 |
+
0
|
| 141 |
+
],
|
| 142 |
+
[
|
| 143 |
+
0,
|
| 144 |
+
0,
|
| 145 |
+
0,
|
| 146 |
+
0,
|
| 147 |
+
0,
|
| 148 |
+
1,
|
| 149 |
+
4
|
| 150 |
+
],
|
| 151 |
+
[
|
| 152 |
+
0,
|
| 153 |
+
1,
|
| 154 |
+
1,
|
| 155 |
+
0,
|
| 156 |
+
3,
|
| 157 |
+
0,
|
| 158 |
+
0
|
| 159 |
+
],
|
| 160 |
+
[
|
| 161 |
+
0,
|
| 162 |
+
0,
|
| 163 |
+
0,
|
| 164 |
+
0,
|
| 165 |
+
0,
|
| 166 |
+
3,
|
| 167 |
+
0
|
| 168 |
+
],
|
| 169 |
+
[
|
| 170 |
+
0,
|
| 171 |
+
0,
|
| 172 |
+
0,
|
| 173 |
+
0,
|
| 174 |
+
0,
|
| 175 |
+
2,
|
| 176 |
+
5
|
| 177 |
+
]
|
| 178 |
+
],
|
| 179 |
+
"classes_present": [
|
| 180 |
+
"Acervus",
|
| 181 |
+
"Avarus",
|
| 182 |
+
"Flosculus",
|
| 183 |
+
"Mutus",
|
| 184 |
+
"Not",
|
| 185 |
+
"Pudor",
|
| 186 |
+
"Regium"
|
| 187 |
+
]
|
| 188 |
+
},
|
| 189 |
+
"supplementary_test": {
|
| 190 |
+
"unique_images": 4,
|
| 191 |
+
"excluded_exact_duplicates": 2,
|
| 192 |
+
"results": {
|
| 193 |
+
"accuracy": 0.75,
|
| 194 |
+
"macro_f1": 0.6,
|
| 195 |
+
"per_class": {
|
| 196 |
+
"Acervus": {
|
| 197 |
+
"support": 0,
|
| 198 |
+
"precision": 0.0,
|
| 199 |
+
"recall": 0.0,
|
| 200 |
+
"f1": 0.0
|
| 201 |
+
},
|
| 202 |
+
"Avarus": {
|
| 203 |
+
"support": 0,
|
| 204 |
+
"precision": 0.0,
|
| 205 |
+
"recall": 0.0,
|
| 206 |
+
"f1": 0.0
|
| 207 |
+
},
|
| 208 |
+
"Flosculus": {
|
| 209 |
+
"support": 1,
|
| 210 |
+
"precision": 1.0,
|
| 211 |
+
"recall": 1.0,
|
| 212 |
+
"f1": 1.0
|
| 213 |
+
},
|
| 214 |
+
"Mutus": {
|
| 215 |
+
"support": 0,
|
| 216 |
+
"precision": 0.0,
|
| 217 |
+
"recall": 0.0,
|
| 218 |
+
"f1": 0.0
|
| 219 |
+
},
|
| 220 |
+
"Not": {
|
| 221 |
+
"support": 0,
|
| 222 |
+
"precision": 0.0,
|
| 223 |
+
"recall": 0.0,
|
| 224 |
+
"f1": 0.0
|
| 225 |
+
},
|
| 226 |
+
"Pudor": {
|
| 227 |
+
"support": 1,
|
| 228 |
+
"precision": 0.0,
|
| 229 |
+
"recall": 0.0,
|
| 230 |
+
"f1": 0.0
|
| 231 |
+
},
|
| 232 |
+
"Regium": {
|
| 233 |
+
"support": 2,
|
| 234 |
+
"precision": 0.6667,
|
| 235 |
+
"recall": 1.0,
|
| 236 |
+
"f1": 0.8
|
| 237 |
+
}
|
| 238 |
+
},
|
| 239 |
+
"confusion_matrix": [
|
| 240 |
+
[
|
| 241 |
+
0,
|
| 242 |
+
0,
|
| 243 |
+
0,
|
| 244 |
+
0,
|
| 245 |
+
0,
|
| 246 |
+
0,
|
| 247 |
+
0
|
| 248 |
+
],
|
| 249 |
+
[
|
| 250 |
+
0,
|
| 251 |
+
0,
|
| 252 |
+
0,
|
| 253 |
+
0,
|
| 254 |
+
0,
|
| 255 |
+
0,
|
| 256 |
+
0
|
| 257 |
+
],
|
| 258 |
+
[
|
| 259 |
+
0,
|
| 260 |
+
0,
|
| 261 |
+
1,
|
| 262 |
+
0,
|
| 263 |
+
0,
|
| 264 |
+
0,
|
| 265 |
+
0
|
| 266 |
+
],
|
| 267 |
+
[
|
| 268 |
+
0,
|
| 269 |
+
0,
|
| 270 |
+
0,
|
| 271 |
+
0,
|
| 272 |
+
0,
|
| 273 |
+
0,
|
| 274 |
+
0
|
| 275 |
+
],
|
| 276 |
+
[
|
| 277 |
+
0,
|
| 278 |
+
0,
|
| 279 |
+
0,
|
| 280 |
+
0,
|
| 281 |
+
0,
|
| 282 |
+
0,
|
| 283 |
+
0
|
| 284 |
+
],
|
| 285 |
+
[
|
| 286 |
+
0,
|
| 287 |
+
0,
|
| 288 |
+
0,
|
| 289 |
+
0,
|
| 290 |
+
0,
|
| 291 |
+
0,
|
| 292 |
+
1
|
| 293 |
+
],
|
| 294 |
+
[
|
| 295 |
+
0,
|
| 296 |
+
0,
|
| 297 |
+
0,
|
| 298 |
+
0,
|
| 299 |
+
0,
|
| 300 |
+
0,
|
| 301 |
+
2
|
| 302 |
+
]
|
| 303 |
+
],
|
| 304 |
+
"classes_present": [
|
| 305 |
+
"Flosculus",
|
| 306 |
+
"Pudor",
|
| 307 |
+
"Regium"
|
| 308 |
+
]
|
| 309 |
+
},
|
| 310 |
+
"interpretation": "A very small supplementary set; excluded from model selection."
|
| 311 |
+
},
|
| 312 |
+
"onnx": {
|
| 313 |
+
"opset": 11,
|
| 314 |
+
"max_abs_error_vs_pytorch": 1.1920928955078125e-06,
|
| 315 |
+
"sha256": "985c6780057b8f016cae3db9be06c80752f23cd5837dfec9f4f6779e00574da8",
|
| 316 |
+
"bytes": 409063
|
| 317 |
+
},
|
| 318 |
+
"limitations": "The dataset contains only 163 original drawings. Validation results are an estimate from a small hold-out set and do not establish real-world accuracy."
|
| 319 |
+
}
|