YOLOV5 7.0编码错误’gbk’ codec can’t decode byte 0x80 in position 233: illegal multibyte sequence
1.报错
train: weights=yolov5s.pt, cfg=models/yolov5s.yaml, data=data\coco128.yaml, hyp=data\hyps\hyp.scratch-low.yaml, epochs=100, batch_size=16, imgsz=640, rect=False, resume=False, nosave=False, noval=False, noautoanchor=False, noplots=False, evolve=None, bucket=, cache=None, image_weights=False, device=, multi_scale=False, single_cls=False, optimizer=SGD, sync_bn=False, workers=8, project=runs\train, name=exp, exist_ok=False, quad=False, cos_lr=False, label_smoothing=0.0, patience=100, freeze=[0], save_period=-1, seed=0, local_rank=-1, entity=None, upload_dataset=False, bbox_interval=-1, artifact_alias=latest
github: skipping check (not a git repository), for updates see https://github.com/ultralytics/yolov5
YOLOv5 2022-11-22 Python-3.7.16 torch-1.13.1+cpu CPU
hyperparameters: lr0=0.01, lrf=0.01, momentum=0.937, weight_decay=0.0005, warmup_epochs=3.0, warmup_momentum=0.8, warmup_bias_lr=0.1, box=0.05, cls=0.5, cls_pw=1.0, obj=1.0, obj_pw=1.0, iou_t=0.2, anchor_t=4.0, fl_gamma=0.0, hsv_h=0.015, hsv_s=0.7, hsv_v=0.4, degrees=0.0, translate=0.1, scale=0.5, shear=0.0, perspective=0.0, flipud=0.0, fliplr=0.5, mosaic=1.0, mixup=0.0, copy_paste=0.0
ClearML: run 'pip install clearml' to automatically track, visualize and remotely train YOLOv5 in ClearML
TensorBoard: Start with 'tensorboard --logdir runs\train', view at http://localhost:6006/
COMET WARNING: Comet credentials have not been set. Comet will default to offline logging. Please set your credentials to enable online logging.
COMET WARNING: To get all data logged automatically, import comet_ml before the following modules: tensorboard, torch.
COMET INFO: Using 'E:\\Python_Learn_Source\\YOLO\\yolov5_7.0_Loss_Multiple\\.cometml-runs' path as offline directory. Pass 'offline_directory' parameter into constructor or set the 'COMET_OFFLINE_DIRECTORY' environment variable to manually choose where to store offline experiment archives.
COMET WARNING: Native output logging mode is not available, falling back to basic output logging
Traceback (most recent call last):
File "E:/Python_Learn_Source/YOLO/yolov5_7.0_Loss_Multiple/train.py", line 617, in <module>
main(opt)
File "E:/Python_Learn_Source/YOLO/yolov5_7.0_Loss_Multiple/train.py", line 511, in main
train(opt.hyp, opt, device, callbacks)
File "E:/Python_Learn_Source/YOLO/yolov5_7.0_Loss_Multiple/train.py", line 79, in train
loggers = Loggers(save_dir, weights, opt, hyp, LOGGER) # loggers instance
File "E:\Python_Learn_Source\YOLO\yolov5_7.0_Loss_Multiple\utils\loggers\__init__.py", line 132, in __init__
self.comet_logger = CometLogger(self.opt, self.hyp)
File "E:\Python_Learn_Source\YOLO\yolov5_7.0_Loss_Multiple\utils\loggers\comet\__init__.py", line 97, in __init__
self.data_dict = self.check_dataset(self.opt.data)
File "E:\Python_Learn_Source\YOLO\yolov5_7.0_Loss_Multiple\utils\loggers\comet\__init__.py", line 232, in check_dataset
data_config = yaml.safe_load(f)
File "D:\Anconda3\anaconda_environment\envs\YOLOV5\lib\site-packages\yaml\__init__.py", line 125, in safe_load
return load(stream, SafeLoader)
File "D:\Anconda3\anaconda_environment\envs\YOLOV5\lib\site-packages\yaml\__init__.py", line 79, in load
loader = Loader(stream)
File "D:\Anconda3\anaconda_environment\envs\YOLOV5\lib\site-packages\yaml\loader.py", line 34, in __init__
Reader.__init__(self, stream)
File "D:\Anconda3\anaconda_environment\envs\YOLOV5\lib\site-packages\yaml\reader.py", line 85, in __init__
self.determine_encoding()
File "D:\Anconda3\anaconda_environment\envs\YOLOV5\lib\site-packages\yaml\reader.py", line 124, in determine_encoding
self.update_raw()
File "D:\Anconda3\anaconda_environment\envs\YOLOV5\lib\site-packages\yaml\reader.py", line 178, in update_raw
data = self.stream.read(size)
UnicodeDecodeError: 'gbk' codec can't decode byte 0x80 in position 233: illegal multibyte sequence
COMET INFO: Couldn't find a Git repository in 'E:\\Python_Learn_Source\\YOLO\\yolov5_7.0_Loss_Multiple' nor in any parent directory. Set `COMET_GIT_DIRECTORY` if your Git Repository is elsewhere.
COMET WARNING: Unknown error exporting current conda environment
COMET WARNING: Unknown error retrieving Conda package as an explicit file
COMET WARNING: Unknown error retrieving Conda information
COMET INFO: ---------------------------------------------------------------------------------------
COMET INFO: Comet.ml OfflineExperiment Summary
COMET INFO: ---------------------------------------------------------------------------------------
COMET INFO: Data:
COMET INFO: display_summary_level : 1
COMET INFO: url : [OfflineExperiment will get URL after upload]
COMET INFO: Others:
COMET INFO: offline_experiment : True
COMET INFO: Uploads:
COMET INFO: environment details : 1
COMET INFO: installed packages : 1
COMET INFO:
COMET WARNING: Experiment Name is generated at upload time for Offline Experiments unless set explicitly with Experiment.set_name
COMET WARNING: To get all data logged automatically, import comet_ml before the following modules: tensorboard, torch.
COMET INFO: Still saving offline stats to messages file before program termination (may take up to 120 seconds)
COMET INFO: Starting saving the offline archive
COMET INFO: To upload this offline experiment, run:
comet upload E:\Python_Learn_Source\YOLO\yolov5_7.0_Loss_Multiple\.cometml-runs\6fbd2ab89b6c44a080cd4c6c41a07563.zip
2.原因分析
遇到的错误与解码 YAML 文件中不支持的字符有关。看起来该文件是使用 ‘gbk’ 编解码,该编解码可能不支持某些字符。您可以尝试将编解码器更改为 ‘utf-8’,yolo中只有model模型文件中和coco数据集文件夹中存在yaml文件
测试知道报错是因为coco128.yaml文件有特殊字符
即可解决