UnicodeDecodeError: 'gbk' codec can't decode byte 0x80 in position 233: illegal multibyte sequence
Search before asking
- [X] I have searched the YOLOv5 issues and found no similar bug report.
YOLOv5 Component
No response
Bug
D:\0_yyyzt\AIM\yolo\yolov5> python train.py --weights yolov5s.pt --epochs 300 --batch-size 16 --workers 8 --data D:\0_yyyzt\AIM\yolo\datasets\zhengtu\zhengtu.yaml train: weights=yolov5s.pt, cfg=, data=D:\0_yyyzt\AIM\yolo\datasets\zhengtu\zhengtu.yaml, hyp=data\hyps\hyp.scratch-low.yaml, epochs=300, batch_size=16, imgsz=640, rect=False, resume=False, nosave=False, noval=False, noautoanchor=False, noplots=False, evolve=None, evolve_population=data\hyps, resume_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, ndjson_console=False, ndjson_file=False github: up to date with https://github.com/ultralytics/yolov5 YOLOv5 v7.0-389-ge62a31b6 Python-3.11.9 torch-2.5.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
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 INFO: Using 'D:\0_yyyzt\AIM\yolo\yolov5\.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.
Traceback (most recent call last):
File "D:\0_yyyzt\AIM\yolo\yolov5\train.py", line 986, in
Environment
OS=win py=3.11.9 use=cpu NoUse NVIDIA
Minimal Reproducible Example
D:\0_yyyzt\AIM\yolo\yolov5> python train.py --weights yolov5s.pt --epochs 300 --batch-size 16 --workers 8 --data D:\0_yyyzt\AIM\yolo\datasets\zhengtu\zhengtu.yaml train: weights=yolov5s.pt, cfg=, data=D:\0_yyyzt\AIM\yolo\datasets\zhengtu\zhengtu.yaml, hyp=data\hyps\hyp.scratch-low.yaml, epochs=300, batch_size=16, imgsz=640, rect=False, resume=False, nosave=False, noval=False, noautoanchor=False, noplots=False, evolve=None, evolve_population=data\hyps, resume_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, ndjson_console=False, ndjson_file=False github: up to date with https://github.com/ultralytics/yolov5 YOLOv5 v7.0-389-ge62a31b6 Python-3.11.9 torch-2.5.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
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 INFO: Using 'D:\0_yyyzt\AIM\yolo\yolov5\.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.
Traceback (most recent call last):
File "D:\0_yyyzt\AIM\yolo\yolov5\train.py", line 986, in
Additional
D:\0_yyyzt\AIM\yolo\yolov5> python train.py --weights yolov5s.pt --epochs 300 --batch-size 16 --workers 8 --data D:\0_yyyzt\AIM\yolo\datasets\zhengtu\zhengtu.yaml train: weights=yolov5s.pt, cfg=, data=D:\0_yyyzt\AIM\yolo\datasets\zhengtu\zhengtu.yaml, hyp=data\hyps\hyp.scratch-low.yaml, epochs=300, batch_size=16, imgsz=640, rect=False, resume=False, nosave=False, noval=False, noautoanchor=False, noplots=False, evolve=None, evolve_population=data\hyps, resume_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, ndjson_console=False, ndjson_file=False github: up to date with https://github.com/ultralytics/yolov5 YOLOv5 v7.0-389-ge62a31b6 Python-3.11.9 torch-2.5.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
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 INFO: Using 'D:\0_yyyzt\AIM\yolo\yolov5\.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.
Traceback (most recent call last):
File "D:\0_yyyzt\AIM\yolo\yolov5\train.py", line 986, in
Are you willing to submit a PR?
- [X] Yes I'd like to help by submitting a PR!
👋 Hello @zhangsiying2001, thank you for your interest in YOLOv5 🚀! It looks like you're encountering a UnicodeDecodeError while training.
If this is a 🐛 Bug Report, please ensure you've included a minimum reproducible example (MRE) for us to investigate. Based on the provided log, the issue seems related to file encoding. It would be helpful if you could:
- Confirm the encoding of your
.yamlfile (e.g., use UTF-8 encoding). - Share the contents of the file causing the issue, ensuring no sensitive information is included.
- Test running YOLOv5 using the recommended Python version and dependencies to rule out potential compatibility issues.
Requirements
- Make sure you are using Python >= 3.8 and have all dependencies correctly installed. Running the command to install dependencies after cloning the repository can help ensure this.
Environments
YOLOv5 can be run in various environments (local machine, cloud-based notebooks, or containers). Verify your environment is properly configured, especially for platform-specific settings like file encodings on Windows.
This is an automated response to help you get started. An Ultralytics engineer will take a closer look shortly to assist further 😊.
The UnicodeDecodeError indicates an issue with reading your YAML file due to encoding mismatches. Ensure that your zhengtu.yaml file is saved with UTF-8 encoding. On Windows, you can do this using text editors like Notepad++ or Visual Studio Code by selecting "Save with Encoding" as UTF-8. After saving, try running the script again. Let me know if the issue persists!
👋 Hello there! We wanted to give you a friendly reminder that this issue has not had any recent activity and may be closed soon, but don't worry - you can always reopen it if needed. If you still have any questions or concerns, please feel free to let us know how we can help.
For additional resources and information, please see the links below:
- Docs: https://docs.ultralytics.com
- HUB: https://hub.ultralytics.com
- Community: https://community.ultralytics.com
Feel free to inform us of any other issues you discover or feature requests that come to mind in the future. Pull Requests (PRs) are also always welcomed!
Thank you for your contributions to YOLO 🚀 and Vision AI ⭐