Skip to content

Commit 55e0ee7

Browse files
authored
fix synthtext dataset convert (#807)
1 parent fecd8ed commit 55e0ee7

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

tools/dataset_converters/synthtext.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ def convert_rec_lmdb(self, image_dir=None, label_path=None, output_path=None):
143143
wordBB, txt = zip(*data_list)
144144
for i in range(len(mat["wordBB"][0])):
145145
mat["wordBB"][0][i] = wordBB[i]
146-
mat["txt"] = np.array(txt).reshape(1, -1)
146+
mat["txt"] = np.array(txt, dtype=object).reshape(1, -1)
147147

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

170170
images, labels = zip(*data_list)
171-
images = iter(itertools.chain(*images))
172-
labels = iter(itertools.chain(*labels))
171+
images = list(itertools.chain(*images))
172+
labels = list(itertools.chain(*labels))
173173

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

0 commit comments

Comments
 (0)