File size: 3,468 Bytes
8db42e3
47907a2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8db42e3
47907a2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8db42e3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
{
  "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."
  }
}