未验证 提交 8c90c6cc 编写于 作者: D David Lin 提交者: GitHub

Ignore previous prediction outputs

Ignore files that ends with _mask and _result. This way previous prediction results won't be predicted again.
The changes have passed my local checks.
上级 8c87bb0b
......@@ -59,12 +59,16 @@ trt_precision_map = {
}
# scan a directory and get all images with support extensions
# scan a directory and get all images with support extensions(will ignore *_mask.* and *_result.*)
def get_images_from_dir(img_dir, support_ext=".jpg|.jpeg"):
if (not os.path.exists(img_dir) or not os.path.isdir(img_dir)):
raise Exception("Image Directory [%s] invalid" % img_dir)
imgs = []
for item in os.listdir(img_dir):
name, ext = os.path.splitext(item)
ext = ext[1:].strip().lower()
if name.endswith("_mask") or name.endswith("_result"):
continue
ext = os.path.splitext(item)[1][1:].strip().lower()
if (len(ext) > 0 and ext in support_ext):
item_path = os.path.join(img_dir, item)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册