Closed shengyi4 closed 2 years ago
work_dir = './work_dirs\upernet_swin_base_patch4_window12_512x512_160k_ade20k_pretrain_384x384_22K'
I think it is caused by wrong path, perhaps caused by different OS environment (windows and linux)?
Thanks for your feedback! I am using windows. I didn't specify the path in the configuration file as well. It worked for other configurations (deep lab v3, segformer, and so on). But it doesn't work for swin.
OK, just set correct path and it could work normally in windows too.
Thanks! It works when I set the path in the command line.
excuse me ,the same error happens to me now, i wonder how you solve the issue exactly, thanks
the same error happens to me now
![]()
我现在也发生了同样的错误
Hi, excuse me ,the same error happens to me now, i wonder how you solve the issue exactly, thanks,
excuse me ,the same error happens to me now, i wonder how you solve the issue exactly, thanks
excuse me ,the same error happens to me now, i wonder how you solve the issue exactly, thanks
the error is unicoder, so i find the dataset corresponds files, replace the data_root to \
, after can train nomally
因为Swin Transformer的backone为upernet, os.path.join()会使用"\"来拼接路径,这样就会出现\u,而\uXXXX代表一个unicode编码。所以找到代码中的os.path.join()全部修改就好了
I am tring to reproduce the result for uppernet + swin transformer. However, when I run: python tools/train.py configs/swin/upernet_swin_base_patch4_window12_512x512_160k_ade20k_pretrain_384x384_22K.py . It shows an error like this: Traceback (most recent call last): File "C:\Users\sheng\miniconda3\envs\open-mmlab\lib\site-packages\yapf\yapflib\verifier.py", line 43, in VerifyCode compile(textwrap.dedent(code).encode('UTF-8'), '', 'exec')
File "", line 2
work_dir = './work_dirs\upernet_swin_base_patch4_window12_512x512_160k_ade20k_pretrain_384x384_22K'
^
SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 11-12: truncated \uXXXX escape
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "C:\Users\sheng\miniconda3\envs\open-mmlab\lib\site-packages\yapf\yapflib\verifier.py", line 46, in VerifyCode ast.parse(textwrap.dedent(code.lstrip('\n')).lstrip(), '', 'exec')
File "C:\Users\sheng\miniconda3\envs\open-mmlab\lib\ast.py", line 50, in parse
return compile(source, filename, mode, flags,
File "", line 1
work_dir = './work_dirs\upernet_swin_base_patch4_window12_512x512_160k_ade20k_pretrain_384x384_22K'
^
SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 11-12: truncated \uXXXX escape
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "C:\Users\sheng\miniconda3\envs\open-mmlab\lib\site-packages\yapf\yapflib\verifier.py", line 50, in VerifyCode compile(normalized_code.encode('UTF-8'), '', 'exec')
File "", line 1
work_dir = './work_dirs\upernet_swin_base_patch4_window12_512x512_160k_ade20k_pretrain_384x384_22K'
^
SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 11-12: truncated \uXXXX escape
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "C:\Users\sheng\Desktop\mmsegmentation\tools\train.py", line 209, in
main()
File "C:\Users\sheng\Desktop\mmsegmentation\tools\train.py", line 135, in main
cfg.dump(osp.join(cfg.work_dir, osp.basename(args.config)))
File "C:\Users\sheng\miniconda3\envs\open-mmlab\lib\site-packages\mmcv\utils\config.py", line 564, in dump
f.write(self.pretty_text)
File "C:\Users\sheng\miniconda3\envs\open-mmlab\lib\site-packages\mmcv\utils\config.py", line 502, in prettytext
text, = FormatCode(text, style_config=yapf_style, verify=True)
File "C:\Users\sheng\miniconda3\envs\open-mmlab\lib\site-packages\yapf\yapflib\yapf_api.py", line 188, in FormatCode
reformatted_source = FormatTree(
File "C:\Users\sheng\miniconda3\envs\open-mmlab\lib\site-packages\yapf\yapflib\yapf_api.py", line 151, in FormatTree
return reformatter.Reformat(_SplitSemicolons(llines), verify, lines)
File "C:\Users\sheng\miniconda3\envs\open-mmlab\lib\site-packages\yapf\yapflib\reformatter.py", line 105, in Reformat
return _FormatFinalLines(final_lines, verify)
File "C:\Users\sheng\miniconda3\envs\open-mmlab\lib\site-packages\yapf\yapflib\reformatter.py", line 413, in _FormatFinalLines
verifier.VerifyCode(formatted_code[-1])
File "C:\Users\sheng\miniconda3\envs\open-mmlab\lib\site-packages\yapf\yapflib\verifier.py", line 52, in VerifyCode
raise InternalError(sys.exc_info()[1])
yapf.yapflib.verifier.InternalError: (unicode error) 'unicodeescape' codec can't decode bytes in position 11-12: truncated \uXXXX escape (, line 1)
It worked fine with other configures. Does anyone else encounter this problem? Thanks.