其他分享
首页 > 其他分享> > yolov7 _pickle.UnpicklingError: STACK_GLOBAL requires str 问题修复

yolov7 _pickle.UnpicklingError: STACK_GLOBAL requires str 问题修复

作者:互联网

问题现象

在启动训练时候报错了

 

 1 Model Summary: 415 layers, 37201950 parameters, 37201950 gradients, 105.1 GFLOPS
 2 
 3 Scaled weight_decay = 0.0005
 4 Optimizer groups: 95 .bias, 95 conv.weight, 98 other
 5 Traceback (most recent call last):
 6   File "train.py", line 610, in <module>
 7     train(hyp, opt, device, tb_writer)
 8   File "train.py", line 248, in train
 9     image_weights=opt.image_weights, quad=opt.quad, prefix=colorstr('train: '))
10   File "/home/yolo系列/yolov7/utils/datasets.py", line 78, in create_dataloader
11     prefix=prefix)
12   File "/home//yolo系列/yolov7/utils/datasets.py", line 392, in __init__
13     cache, exists = torch.load(cache_path), True  # load
14   File "/home/qfz/anaconda3/envs/yolov7/lib/python3.7/site-packages/torch/serialization.py", line 608, in load
15     return _legacy_load(opened_file, map_location, pickle_module, **pickle_load_args)
16   File "/home/qfz/anaconda3/envs/yolov7/lib/python3.7/site-packages/torch/serialization.py", line 777, in _legacy_load
17     magic_number = pickle_module.load(f, **pickle_load_args)
18 _pickle.UnpicklingError: STACK_GLOBAL requires str

 

问题分析

回想起是偷懒直接用yolov5训练过的数据集拷贝到yolov7下进行重新训练结果报错。

 

最终解决方法: 

经过波斯大佬的指点,把训练数据集下面的 labels.cache文件删除即可。

 

标签:yolov7,load,UnpicklingError,py,File,line,pickle
来源: https://www.cnblogs.com/qinfangzhe/p/16554181.html