未验证 提交 9f76868d 编写于 作者: W wangguanzhong 提交者: GitHub

fix infer on windows (#300)

上级 45d06dcb
...@@ -74,20 +74,20 @@ def get_test_images(infer_dir, infer_img): ...@@ -74,20 +74,20 @@ def get_test_images(infer_dir, infer_img):
"{} is not a file".format(infer_img) "{} is not a file".format(infer_img)
assert infer_dir is None or os.path.isdir(infer_dir), \ assert infer_dir is None or os.path.isdir(infer_dir), \
"{} is not a directory".format(infer_dir) "{} is not a directory".format(infer_dir)
images = []
# infer_img has a higher priority # infer_img has a higher priority
if infer_img and os.path.isfile(infer_img): if infer_img and os.path.isfile(infer_img):
images.append(infer_img) return [infer_img]
return images
images = set()
infer_dir = os.path.abspath(infer_dir) infer_dir = os.path.abspath(infer_dir)
assert os.path.isdir(infer_dir), \ assert os.path.isdir(infer_dir), \
"infer_dir {} is not a directory".format(infer_dir) "infer_dir {} is not a directory".format(infer_dir)
exts = ['jpg', 'jpeg', 'png', 'bmp'] exts = ['jpg', 'jpeg', 'png', 'bmp']
exts += [ext.upper() for ext in exts] exts += [ext.upper() for ext in exts]
for ext in exts: for ext in exts:
images.extend(glob.glob('{}/*.{}'.format(infer_dir, ext))) images.update(glob.glob('{}/*.{}'.format(infer_dir, ext)))
images = list(images)
assert len(images) > 0, "no image found in {}".format(infer_dir) assert len(images) > 0, "no image found in {}".format(infer_dir)
logger.info("Found {} inference images in total.".format(len(images))) logger.info("Found {} inference images in total.".format(len(images)))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册