1. _pickle.UnpicklingError: STACK_GLOBAL requires str
产生原因:之前的数据集训练过,导致数据集文件夹中生成.cache的缓存文件。
解决:找到数据集文件夹中的全部.cache文件,进行删除
2. yolov7报错 indices should be either on cpu or on the same device as the indexed tensor (cpu)
产生原因:部分在GPU上运行,部分在CPU上运行
解决:在loss.py文件 中,修改对应报错的 ComputeLossOTA类下build_targets方法,添加.to(device),共修改三处。
1. 修改一:添加device = torch.device(targets.device)为
2. 修改二:修改from_which_layer.append(torch.ones(size=(len(b),)) * i)为from_which_layer.append((torch.ones(size=(len(b),)) * i).to(device))
3. 修改三:matching_matrix = torch.zeros_like(cost)为matching_matrix = torch.zeros_like(cost, device=device)
主要参考:yolov7报错 indices should be either on cpu or on the same device as the indexed tensor (cpu)解决-CSDN博客
3. 解决:yolov7 UnicodeDecodeError: 'gbk' codec can't decode byte 0x88 in position 507: illegal multibyte sequence
解决:yaml文件中有中文注释,将所有中文注释删除即可。