未验证 提交 72b36bec 编写于 作者: 夜雨飘零 提交者: GitHub

fix read chinese path bug (#521)

上级 4472c87c
...@@ -99,7 +99,7 @@ def create_file_list(params): ...@@ -99,7 +99,7 @@ def create_file_list(params):
data_dir = params.get('data_dir', '') data_dir = params.get('data_dir', '')
params['file_list'] = ".tmp.txt" params['file_list'] = ".tmp.txt"
imgtype_list = {'jpg', 'bmp', 'png', 'jpeg', 'rgb', 'tif', 'tiff'} imgtype_list = {'jpg', 'bmp', 'png', 'jpeg', 'rgb', 'tif', 'tiff'}
with open(params['file_list'], "w") as fout: with open(params['file_list'], "w", encoding='utf-8') as fout:
tmp_file_list = os.listdir(data_dir) tmp_file_list = os.listdir(data_dir)
for file_name in tmp_file_list: for file_name in tmp_file_list:
file_path = os.path.join(data_dir, file_name) file_path = os.path.join(data_dir, file_name)
...@@ -134,7 +134,7 @@ def get_file_list(params): ...@@ -134,7 +134,7 @@ def get_file_list(params):
if params['mode'] == 'test': if params['mode'] == 'test':
create_file_list(params) create_file_list(params)
with open(params['file_list']) as flist: with open(params['file_list'], encoding='utf-8') as flist:
full_lines = [line.strip() for line in flist] full_lines = [line.strip() for line in flist]
full_lines = shuffle_lines(full_lines, params["shuffle_seed"]) full_lines = shuffle_lines(full_lines, params["shuffle_seed"])
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册