katnii commited on
Commit
5ce8a3a
·
verified ·
1 Parent(s): c717cc4
Files changed (1) hide show
  1. README.md +226 -3
README.md CHANGED
@@ -1,3 +1,226 @@
1
- ---
2
- license: cc-by-nc-sa-4.0
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: cc-by-nc-sa-4.0
3
+ tags:
4
+ - math
5
+ - synthetic
6
+ - handwritten
7
+ - formula-recognition
8
+ task_categories:
9
+ - image-to-text
10
+ ---
11
+
12
+ # AmbHMEG: Ambiguous Handwritten Mathematical Expression Dataset
13
+
14
+ This repository provides a dataset of ambiguous handwritten mathematical expressions generated by AmbHMEG, a model for rendering LaTeX expressions as visually ambiguous math images.
15
+ It also includes the pretrained AmbHMEG model used for dataset generation.
16
+
17
+ - GitHub: https://github.com/pfnet-research/AmbHMEG
18
+
19
+ ## Contents
20
+
21
+ The resources are organized in the order of the data generation pipeline.
22
+
23
+ ### Training Dataset
24
+
25
+ - `mathwriting_with_graph.tar.zst`
26
+
27
+ A preprocessed version of the MathWriting dataset with graph annotations used for training the AmbHMEG model.
28
+
29
+ ### Pretrained Model
30
+
31
+ - `gryphgen_graph_sd_mathwriting_epoch_50.pth`
32
+
33
+ A model trained on the MathWriting dataset to generate handwritten mathematical expressions, including ambiguous variations.
34
+
35
+ ### Generated Dataset
36
+
37
+ - `mathwriting_amb.tar.zst`
38
+
39
+ A dataset of ambiguously generated handwritten mathematical expressions produced by AmbHMEG.
40
+
41
+ #### Structure
42
+
43
+ ```text
44
+ mathwriting_amb/
45
+ basic/
46
+ test/
47
+ valid/
48
+ layout/
49
+ test/
50
+ valid/
51
+ symbol/
52
+ test/
53
+ valid/
54
+ ````
55
+
56
+ #### Subsets
57
+
58
+ ##### basic
59
+
60
+ Standard single-conditioned generated dataset.
61
+
62
+ ##### layout
63
+
64
+ Dual-conditioned dataset:
65
+
66
+ * original expression
67
+ * expression with superscripts and subscripts removed
68
+
69
+ ##### symbol
70
+
71
+ Dual-conditioned dataset:
72
+
73
+ * original expression
74
+ * expression where symbols are replaced with visually similar alternatives
75
+
76
+ ###### Replacement Rules Used in Symbol Editing
77
+
78
+ ```python
79
+ pairs = [
80
+ ("0", "6"),
81
+ ("0", "8"),
82
+ ("1", "7"),
83
+ ("1", "9"),
84
+ ("2", "7"),
85
+ ("3", "8"),
86
+ ("5", "6"),
87
+ ("5", "8"),
88
+ ("0", "O"),
89
+ ("0", "o"),
90
+ ("1", "l"),
91
+ ("1", "I"),
92
+ ("2", "z"),
93
+ ("2", "Z"),
94
+ ("5", "S"),
95
+ ("6", "b"),
96
+ ("8", "B"),
97
+ ("9", "g"),
98
+ ("t", "+"),
99
+ ("c", "e"),
100
+ ("u", "v"),
101
+ ("v", "r"),
102
+ ("m", "n"),
103
+ ("a", "d"),
104
+ ("i", "j"),
105
+ ("x", r"\times"),
106
+ ("O", "Q"),
107
+ ("I", "J"),
108
+ ("v", r"\nu"),
109
+ ("o", r"\omicron"),
110
+ ("p", r"\rho"),
111
+ ("n", r"\eta"),
112
+ ("u", r"\mu"),
113
+ ("a", r"\alpha"),
114
+ ("y", r"\gamma"),
115
+ ("2", r"\zeta"),
116
+ ("2", r"\gamma"),
117
+ ("x", r"\chi"),
118
+ ("w", r"\omega"),
119
+ ("e", r"\epsilon"),
120
+ (r"\epsilon", r"\in"),
121
+ (r"\phi", r"\varphi"),
122
+ (r"\theta", r"\vartheta"),
123
+ (r"\pi", r"\varpi"),
124
+ ("k", r"\kappa"),
125
+ (r"\sigma", "o"),
126
+ ("r", r"\gamma"),
127
+ ("z", r"\xi"),
128
+ (r"\beta", "B"),
129
+ ("-", r"\sim"),
130
+ (r"\cdot", "."),
131
+ ("1", "|"),
132
+ ("|", "l"),
133
+ (r"\sum", "E"),
134
+ (r"\prod", r"\Pi"),
135
+ (r"\partial", "d"),
136
+ (r"\infty", "8"),
137
+ (r"\subset", "c"),
138
+ (r"\in", r"\epsilon"),
139
+ (r"\subseteq", r"\subset"),
140
+ (r"\approx", r"\sim"),
141
+ (r"\equiv", "="),
142
+ ("0", r"\emptyset"),
143
+ (r"\emptyset", r"\phi"),
144
+ (r"\ell", "1"),
145
+ ("C", "c"),
146
+ ("I", "l"),
147
+ ("I", "i"),
148
+ ("K", "k"),
149
+ ("M", "m"),
150
+ ("N", "n"),
151
+ ("O", "o"),
152
+ ("P", "p"),
153
+ ("S", "s"),
154
+ ("U", "u"),
155
+ ("V", "v"),
156
+ ("W", "w"),
157
+ ("X", "x"),
158
+ ("Y", "y"),
159
+ ("Z", "z"),
160
+ ("I", "j"),
161
+ ("L", "l"),
162
+ ("Q", "q"),
163
+ ("R", "r"),
164
+ (r"\Gamma", r"\gamma"),
165
+ (r"\Delta", r"\delta"),
166
+ (r"\Theta", r"\theta"),
167
+ (r"\Lambda", r"\lambda"),
168
+ (r"\Xi", r"\xi"),
169
+ (r"\Pi", r"\pi"),
170
+ (r"\Sigma", r"\sigma"),
171
+ (r"\Phi", r"\phi"),
172
+ (r"\Psi", r"\psi"),
173
+ (r"\Omega", r"\omega"),
174
+ (r"\Sigma", "E"),
175
+ (r"\Pi", r"\prod"),
176
+ ]
177
+ ```
178
+
179
+ #### Notes
180
+
181
+ This dataset contains data derived from and includes original MathWriting samples. It is subject to the terms of the MathWriting dataset license (CC BY-NC-SA 4.0).
182
+
183
+ ## Data Format
184
+
185
+ Each sample consists of an image and a corresponding label file.
186
+
187
+ * Image: `<id>.png`
188
+ * Label: `<id>.pkl` (JSON-serializable structure)
189
+
190
+ ## Usage
191
+
192
+ ### Download and Extract
193
+
194
+ ```bash
195
+ tar --zstd -xvf *.tar.zst
196
+ ```
197
+
198
+ ### Training and Generation
199
+
200
+ Refer to the official repository:
201
+
202
+ [https://github.com/pfnet-research/AmbHMEG](https://github.com/pfnet-research/AmbHMEG)
203
+
204
+ ## License
205
+
206
+ ### Code and Model
207
+
208
+ * Licensed under the MIT License
209
+
210
+ The model is trained on the MathWriting dataset, and its use and outputs may be subject to the dataset license.
211
+
212
+ ### Dataset
213
+
214
+ * Licensed under CC BY-NC-SA 4.0
215
+ * MathWriting Dataset
216
+ [https://github.com/google-research/google-research/tree/master/mathwriting](https://github.com/google-research/google-research/tree/master/mathwriting)
217
+
218
+ ## Usage Restrictions
219
+
220
+ * Commercial use is not allowed
221
+ * Derivative works must be shared under CC BY-NC-SA 4.0
222
+ * Attribution to the original MathWriting authors is required
223
+
224
+ ## Acknowledgements
225
+
226
+ We thank the authors of the MathWriting dataset for providing this resource.