跑yolov5训练官方代码出现下面的问题,第一个方法就是关闭代理网络vpn,直接运行,阻止数据上传。
D:\anaconda\envs\yolov5\python.exe C:\Users\ljx\Desktop\yoloair-main\yoloair-main\yolov7\train.py
YOLOR 2022-11-8 torch 1.8.1+cu111 CUDA:0 (NVIDIA GeForce RTX 3060 Laptop GPU, 6143.5MB)
Namespace(adam=False, artifact_alias='latest', batch_size=2, bbox_interval=-1, bucket='', cache_images=False, cfg='C:\\Users\\ljx\\Desktop\\yoloair-main\\yoloair-main\\configs\\yolov7-Improved\\yolov7-C3C2-DecoupHeadX.yaml', data='C:\\Users\\ljx\\Desktop\\yoloair-main\\yoloair-main\\data\\data.yaml', device='', entity=None, epochs=2, evolve=False, exist_ok=False, freeze=[0], global_rank=-1, hyp='C:\\Users\\ljx\\Desktop\\yoloair-main\\yoloair-main\\data\\hyps\\hyp.scratch.p5.yaml', image_weights=False, img_size=[640, 640], label_smoothing=0.0, linear_lr=False, local_rank=-1, multi_scale=False, name='exp', noautoanchor=False, nosave=False, notest=False, project='runs/train', quad=False, rect=False, resume=False, save_dir='runs\\train\\exp23', save_period=-1, single_cls=False, sync_bn=False, total_batch_size=2, upload_dataset=False, weights='', workers=0, world_size=1)
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
wandb: ERROR api_key not configured (no-tty). call wandb.login(key=[your_api_key])
Traceback (most recent call last):
File "C:\Users\ljx\Desktop\yoloair-main\yoloair-main\yolov7\train.py", line 624, in <module>
train(hyp, opt, device, tb_writer)
File "C:\Users\ljx\Desktop\yoloair-main\yoloair-main\yolov7\train.py", line 81, in train
wandb_logger = WandbLogger(opt, Path(opt.save_dir).stem, run_id, data_dict)
File "C:\Users\ljx\Desktop\yoloair-main\yoloair-main\yolov7\..\yolov7\utils\wandb_logging\wandb_utils.py", line 95, in __init__
self.wandb_run = wandb.init(config=opt,
File "D:\anaconda\envs\yolov5\lib\site-packages\wandb\sdk\wandb_init.py", line 1166, in init
raise e
File "D:\anaconda\envs\yolov5\lib\site-packages\wandb\sdk\wandb_init.py", line 1143, in init
wi.setup(kwargs)
File "D:\anaconda\envs\yolov5\lib\site-packages\wandb\sdk\wandb_init.py", line 289, in setup
wandb_login._login(
File "D:\anaconda\envs\yolov5\lib\site-packages\wandb\sdk\wandb_login.py", line 298, in _login
wlogin.prompt_api_key()
File "D:\anaconda\envs\yolov5\lib\site-packages\wandb\sdk\wandb_login.py", line 228, in prompt_api_key
raise UsageError("api_key not configured (no-tty). call " + directive)
wandb.errors.UsageError: api_key not configured (no-tty). call wandb.login(key=[your_api_key])
Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLZeroReturnError(6, 'TLS/SSL connection has been closed (EOF) (_ssl.c:1131)'))': /api/4504800232407040/envelope/
Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLZeroReturnError(6, 'TLS/SSL connection has been closed (EOF) (_ssl.c:1131)'))': /api/4504800232407040/envelope/
Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLZeroReturnError(6, 'TLS/SSL connection has been closed (EOF) (_ssl.c:1131)'))': /api/4504800232407040/envelope/
Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLZeroReturnError(6, 'TLS/SSL connection has been closed (EOF) (_ssl.c:1131)'))': /api/4504800232407040/envelope/
Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLZeroReturnError(6, 'TLS/SSL connection has been closed (EOF) (_ssl.c:1131)'))': /api/4504800232407040/envelope/
Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLZeroReturnError(6, 'TLS/SSL connection has been closed (EOF) (_ssl.c:1131)'))': /api/4504800232407040/envelope/
第二个方法就是老老实实注册
注册 Wandb 账号:你可以在 Wandb 网站 (https://wandb.ai/) 上创建一个账号并获得 API 密钥。然后,按照说明在你的脚本中配置 API 密钥。
在脚本中配置 API 密钥:如果你已经有 Wandb 账号和 API 密钥,可以直接在脚本中进行配置。找到脚本中类似下面的代码行:
wandb_logger = WandbLogger(opt, Path(opt.save_dir).stem, run_id, data_dict)
在上面的代码之前添加 API 密钥:
wandb.login(key="YOUR_API_KEY")
wandb_logger = WandbLogger(opt, Path(opt.save_dir).stem, run_id, data_dict)
将 “YOUR_API_KEY” 替换为你实际的 API 密钥。
第三个就是禁用 Wandb:如果你不想使用 Wandb 进行实验跟踪,可以通过注释相关的代码行来禁用它。查找以 wandb.init 或 wandb_logger 开头的行,并使用 # 符号将它们注释掉。
例如:
# wandb.init(config=opt, ...)
# ...
# wandb_logger = WandbLogger(opt, Path(opt.save_dir).stem, run_id, data_dict)
参考文章这一篇文章就可以解决:
https://blog.csdn.net/PSpiritV/article/details/123728315?ops_request_misc=&request_id=&biz_id=102&utm_term=Wandb%20wandb.errors&utm_medium=distribute.pc_search_result.none-task-blog-2~all~sobaiduweb~default-1-123728315.142^v92^insert_down1&spm=1018.2226.3001.4187