【mmdet】报错
Traceback (most recent call last):
File "d:/zy/code/mmdetection2/tools/train.py", line 255, in <module>
main(args)
File "d:/zy/code/mmdetection2/tools/train.py", line 117, in main
cfg = replace_cfg_vals(cfg)
File "d:\zy\code\mmdetection2\mmdet\utils\replace_cfg_vals.py", line 64, in replace_cfg_vals
updated_cfg = Config(
File "C:\Users\33790\anaconda3\envs\mmdet2\lib\site-packages\mmcv\utils\config.py", line 393, in __init__
text = f.read()
UnicodeDecodeError: 'gbk' codec can't decode byte 0xae in position 106: illegal multibyte sequence
原因
文件读取格式的错误。
解决
修改文件的读取方式
C:\Users\33790\anaconda3\envs\mmdet2\lib\site-packages\mmcv\utils\config.py
if cfg_text:
text = cfg_text
elif filename:
#with open(filename, 'r') as f: # 修改此处line 392
with open(filename, encoding='UTF-8') as f:
text = f.read()
else:
text = ''
super(Config, self).__setattr__('_text', text)