Skip to content

Commit

Permalink
fix synthtext dataset convert (#807)
Browse files Browse the repository at this point in the history
  • Loading branch information
alien-0119 authored Feb 14, 2025
1 parent fecd8ed commit 55e0ee7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tools/dataset_converters/synthtext.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def convert_rec_lmdb(self, image_dir=None, label_path=None, output_path=None):
wordBB, txt = zip(*data_list)
for i in range(len(mat["wordBB"][0])):
mat["wordBB"][0][i] = wordBB[i]
mat["txt"] = np.array(txt).reshape(1, -1)
mat["txt"] = np.array(txt, dtype=object).reshape(1, -1)

data_list = defaultdict(list)
for image, polys, texts in zip(mat["imnames"][0], mat["wordBB"][0], mat["txt"][0]):
Expand All @@ -168,8 +168,8 @@ def convert_rec_lmdb(self, image_dir=None, label_path=None, output_path=None):
)

images, labels = zip(*data_list)
images = iter(itertools.chain(*images))
labels = iter(itertools.chain(*labels))
images = list(itertools.chain(*images))
labels = list(itertools.chain(*labels))

print("Creating the LMDB dataset.")
create_lmdb_dataset(images, labels, output_path=output_path)

0 comments on commit 55e0ee7

Please sign in to comment.