We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent fb25b31 commit 1f9fd6cCopy full SHA for 1f9fd6c
pix2tex/dataset/check_pkl.py
@@ -0,0 +1,21 @@
1
+import pickle
2
+from pix2tex.dataset.dataset import Im2LatexDataset
3
+from os.path import join
4
+
5
+# path to pkl
6
+pkl_file_path = "test.pkl"
7
8
+# load pkl
9
+with open(pkl_file_path, 'rb') as f:
10
+ dataset = pickle.load(f)
11
12
+#iter(dataset)
13
14
+# print info.
15
+print("Data structure:")
16
+for dimensions, pairs in list(dataset.data.items())[:100]: # total images
17
+ print(f"Images with dimensions {dimensions}:")
18
+ for i, (latex, image_path) in enumerate(pairs[:1]): # one by one
19
+ print(f" Item {i+1}:")
20
+ print(f" LaTeX Code: {latex}")
21
+ print(f" Image Path: {image_path}")
0 commit comments