PaddlePaddle / PaddleDetection

Object Detection toolkit based on PaddlePaddle. It supports object detection, instance segmentation, multiple object tracking and real-time multi-person keypoint detection.
Apache License 2.0
12.8k stars 2.89k forks source link

yaml文件读取错误:UnicodeDecodeError: 'gbk' codec can't decode byte 0xa1 in position 41: illegal multibyte sequence #2268

Closed pythonprogrammingbook closed 2 years ago

pythonprogrammingbook commented 3 years ago

开发环境 OS: Window10 Paddle = 2.0.0, git clone 最新版PaddleDetection

问题复现: (pp) D:\pp\PaddleDetection>python -u tools/train.py -c configs/hw_configs/faster_rcnn_r50_vd_fpn_roadsign_coco_template.yml -o use_gpu=true --eval Traceback (most recent call last): File "tools/train.py", line 399, in main() File "tools/train.py", line 71, in main cfg = load_config(FLAGS.config) File "D:\pp\PaddleDetection\ppdet\core\workspace.py", line 91, in load_config cfg = merge_config(yaml.load(f, Loader=yaml.Loader), cfg) File "C:\Users\Administrator.conda\envs\pp\lib\site-packages\yaml__init.py", line 112, in load loader = Loader(stream) File "C:\Users\Administrator.conda\envs\pp\lib\site-packages\yaml\loader.py", line 44, in init Reader.init(self, stream) File "C:\Users\Administrator.conda\envs\pp\lib\site-packages\yaml\reader.py", line 85, in init__ self.determine_encoding() File "C:\Users\Administrator.conda\envs\pp\lib\site-packages\yaml\reader.py", line 124, in determine_encoding self.update_raw() File "C:\Users\Administrator.conda\envs\pp\lib\site-packages\yaml\reader.py", line 178, in update_raw data = self.stream.read(size) UnicodeDecodeError: 'gbk' codec can't decode byte 0xa1 in position 41: illegal multibyte sequence

推荐解决方案: PaddleDetection\ppdet\core\workspace.py", line 90改为: with open(file_path, 'r', encoding='utf-8') as f:

heavengate commented 3 years ago

好的,感谢反馈,我们修复一下~

heavengate commented 3 years ago

您好,请问一下你用的python版本是多少,以及麻烦打印一下import sys; print(sys.getdefaultencoding())看下呢

pythonprogrammingbook commented 3 years ago

Python版本:3.7.9

结果:utf-8

python_programming@163.com

发件人: Kaipeng Deng 发送时间: 2021-02-28 22:26 收件人: PaddlePaddle/PaddleDetection 抄送: pythonprogrammingbook; Author 主题: Re: [PaddlePaddle/PaddleDetection] yaml文件读取错误:UnicodeDecodeError: 'gbk' codec can't decode byte 0xa1 in position 41: illegal multibyte sequence (#2268) 您好,请问一下你用的python版本是多少,以及麻烦打印一下import sys; print(sys.getdefaultencoding())看下呢 — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

RDXiaoLu commented 2 years ago

我也出现了同样的问题 win10 yaml这个模块 python 3.7.13 utf-8

GroganZY commented 6 months ago

现在还没修吗?