Skip to content

Commit 00f18fd

Browse files
committed
bugfix: recursive calling when input is image file with illegal suffix
1 parent ac1cfd9 commit 00f18fd

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

paddlex/inference/common/batch_sampler/image_batch_sampler.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,14 @@ def sample(self, inputs):
110110
if len(batch) == self.batch_size:
111111
yield batch
112112
batch = ImgBatch()
113-
else:
113+
elif Path(input).is_dir():
114114
file_list = self._get_files_list(input)
115115
yield from self.sample(file_list)
116+
else:
117+
logging.error(
118+
f"Not supported input file type! Only PDF and image files ended with suffix `{', '.join(self.IMG_SUFFIX + self.PDF_SUFFIX)}` are supported! But recevied `{input}`."
119+
)
120+
yield batch
116121
else:
117122
logging.warning(
118123
f"Not supported input data type! Only `numpy.ndarray` and `str` are supported! So has been ignored: {input}."

0 commit comments

Comments
 (0)