未验证 提交 ae38108a 编写于 作者: C cnn 提交者: GitHub

fix bug of function _make_dataset in ppdet/data/source/dataset.py (#1385)

Co-authored-by: NKaipeng Deng <dengkaipeng@baidu.com>
上级 3bb95624
......@@ -87,16 +87,16 @@ def _is_valid_file(f, extensions=('.jpg', '.jpeg', '.png', '.bmp')):
return f.lower().endswith(extensions)
def _make_dataset(dir):
dir = os.path.expanduser(dir)
if not os.path.isdir(d):
raise ('{} should be a dir'.format(dir))
def _make_dataset(data_dir):
data_dir = os.path.expanduser(data_dir)
if not os.path.isdir(data_dir):
raise ('{} should be a dir'.format(data_dir))
images = []
for root, _, fnames in sorted(os.walk(dir, followlinks=True)):
for root, _, fnames in sorted(os.walk(data_dir, followlinks=True)):
for fname in sorted(fnames):
path = os.path.join(root, fname)
if is_valid_file(path):
images.append(path)
file_path = os.path.join(root, fname)
if _is_valid_file(file_path):
images.append(file_path)
return images
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册