page-script-id-agent / config.json
davanstrien's picture
davanstrien HF Staff
Add timm checkpoint (model.safetensors) and timm config; card: Use with timm
47907a2 verified
Raw History Blame Contribute Delete
3.47 kB
{
"architecture": "mobilenetv4_conv_small",
"num_classes": 21,
"num_features": 960,
"global_pool": "avg",
"label_names": [
"Arab",
"Beng",
"Cyrl",
"Deva",
"Grek",
"Hang",
"Hani",
"Hebr",
"Jpan",
"Latn",
"Taml",
"Thai",
"Armn",
"Ethi",
"Geor",
"Gujr",
"Khmr",
"Knda",
"Mlym",
"Mymr",
"Telu"
],
"model_args": {
"num_classes": 21,
"in_chans": 3,
"global_pool": "avg"
},
"pretrained_cfg": {
"custom_load": false,
"input_size": [
3,
640,
640
],
"test_input_size": [
3,
640,
640
],
"fixed_input_size": false,
"interpolation": "bilinear",
"crop_pct": 1.0,
"test_crop_pct": 1.0,
"crop_mode": "squash",
"mean": [
0.485,
0.456,
0.406
],
"std": [
0.229,
0.224,
0.225
],
"num_classes": 21,
"pool_size": [
20,
20
],
"first_conv": "conv_stem",
"classifier": "classifier",
"license": "apache-2.0",
"label_names": [
"Arab",
"Beng",
"Cyrl",
"Deva",
"Grek",
"Hang",
"Hani",
"Hebr",
"Jpan",
"Latn",
"Taml",
"Thai",
"Armn",
"Ethi",
"Geor",
"Gujr",
"Khmr",
"Knda",
"Mlym",
"Mymr",
"Telu"
]
},
"inference": {
"onnx_file": "model.onnx",
"onnx_input_name": "grey",
"onnx_output_name": "probabilities",
"input_size": 640,
"colour": "greyscale page",
"resize": "bilinear squash to 640 x 640 (aspect ratio not kept, no crop, no padding)",
"jpeg_draft": "for JPEG input, decode at reduced scale with PIL draft('L', (1280, 1280)) before the resize, as in training",
"onnx_input": "float32, N x 640 x 640, grey values 0 to 255; normalisation, temperature and sigmoid are inside the ONNX graph; output N x 21 probabilities",
"timm_input": "float32, N x 3 x 640 x 640: grey / 255 copied to three channels, then (x - mean) / std with the pretrained_cfg mean and std; output N x 21 logits",
"temperature": 2.3,
"probability": "timm: sigmoid(logit / temperature) per script (the ONNX file already returns this)",
"scripts": [
"Arab",
"Beng",
"Cyrl",
"Deva",
"Grek",
"Hang",
"Hani",
"Hebr",
"Jpan",
"Latn",
"Taml",
"Thai",
"Armn",
"Ethi",
"Geor",
"Gujr",
"Khmr",
"Knda",
"Mlym",
"Mymr",
"Telu"
],
"script_names": {
"Arab": "Arabic",
"Beng": "Bengali",
"Cyrl": "Cyrillic",
"Deva": "Devanagari",
"Grek": "Greek",
"Hang": "Hangul",
"Hani": "Han",
"Hebr": "Hebrew",
"Jpan": "Japanese",
"Latn": "Latin",
"Taml": "Tamil",
"Thai": "Thai",
"Armn": "Armenian",
"Ethi": "Ethiopic",
"Geor": "Georgian",
"Gujr": "Gujarati",
"Khmr": "Khmer",
"Knda": "Kannada",
"Mlym": "Malayalam",
"Mymr": "Myanmar",
"Telu": "Telugu"
},
"unknown_threshold": 0.6271,
"script_threshold": 0.55,
"mixed_page_threshold": 0.5,
"rule": "if the largest probability is below unknown_threshold, the page is 'unknown'; otherwise report every script with probability >= script_threshold. Use mixed_page_threshold instead when finding mixed-script pages matters more than a clean single answer."
}
}