Skip to content

Commit 1f9fd6c

Browse files
committed
check the dataset info
1 parent fb25b31 commit 1f9fd6c

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

pix2tex/dataset/check_pkl.py

+21
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)