Namespace(weights='yolo7.pt', cfg='cfg/training/yolov7.yaml', data='data/DOTA_split.yaml', hyp='data/hyp.scratch.p5.yaml', epochs=10, batch_size=4, img_size=[640, 640], rect=False, resume=False, nosave=False, notest=False, noautoanchor=False, evolve=False, bucket='', cache_images=False, image_weights=False, device='', multi_scale=False, single_cls=False, ada m=False, sync_bn=False, local_rank=-1, workers=8, project='runs/train', entity=None, name='exp', exist_ok=False, quad=False, linear_lr=False, label_smoothing=0.0, upload_dataset=False, bbox_interval=-1, save_period=-1, artifact_alias='latest', freeze=[0], v5_metric=False, world_size=1, global_rank=-1, save_dir='runs\\train\\exp2', total_batch_size=4) tensorboard: Start with 'tensorboard --logdir runs/train', view at http://localhost:6006/ hyperparameters: lr0=0.01, lrf=0.1, 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.3, cls_pw=1.0, obj=0.7, 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.2, scale=0.9, shear=0.0, perspective=0.0, flipud=0.0, fliplr=0.5, mosaic=1.0, mixup=0.15, copy_paste=0.0, paste_in=0.15, loss_ota=1 Traceback (most recent call last): File "D:\Documents\Desktop\YOLO_suanfa\yolov7-main\train.py", line 618, in <module> train(hyp, opt, device, tb_writer) File "D:\Documents\Desktop\YOLO_suanfa\yolov7-main\train.py", line 64, in train data_dict = yaml.load(f, Loader=yaml.SafeLoader) # data dict File "D:\Documents\Desktop\YOLO_suanfa\yolov7-main\venv\lib\site-packages\yaml\__init__.py", line 79, in load loader = Loader(stream) File "D:\Documents\Desktop\YOLO_suanfa\yolov7-main\venv\lib\site-packages\yaml\loader.py", line 34, in __init__ Reader.__init__(self, stream) File "D:\Documents\Desktop\YOLO_suanfa\yolov7-main\venv\lib\site-packages\yaml\reader.py", line 85, in __init__ self.determine_encoding() File "D:\Documents\Desktop\YOLO_suanfa\yolov7-main\venv\lib\site-packages\yaml\reader.py", line 124, in determine_encoding self.update_raw() File "D:\Documents\Desktop\YOLO_suanfa\yolov7-main\venv\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
时间: 2024-04-18 19:31:51 浏览: 254
yolo-tensorrt:支持Yolov5s,m,l,x .darknet->张量。 Yolov4 Yolov3使用原始暗网* .weights和* .cfg fils。 如果包装纸对您有用,请加注星标
这个错误是因为在读取 YAML 文件时使用了 GBK 编码,但在第233个位置出现了非法的多字节序列,导致无法解码。你可以尝试以下解决方法:
1. 将文件编码改为 UTF-8 或其他可支持的编码格式。
2. 使用适当的编码解码器来读取文件,例如使用 `utf-8` 编码器:
```python
import codecs
with codecs.open('cfg/training/yolov7.yaml', 'r', encoding='utf-8') as f:
data_dict = yaml.load(f, Loader=yaml.SafeLoader)
```
请确保你的代码中正确指定了文件的编码方式。
阅读全文