部署YOLOv8时遇见的错误
错误类型:TypeError: cannot unpack non-iterable NoneType object
出错的原因可能有:1、torch版本问题 2、meshgrid返回值
解决方案:
将tal.py中的代码
sy,sx = torch.meshgrid(sy, sx, indexing='ij') if TORCH_1_10 else torch.meshgrid(sy, sx)
替换为:
sx,sy = torch.meshgrid(sy, sx, indexing='ij') if TORCH_1_10 else torch.meshgrid(sy, sx)
或者替换为:(有效果)
sx,sy=np.meshgrid(sx.detach().to('cpu'),sy.detach().to('cpu')) sx,sy=torch.from_numpy(sx).to(device),torch.from_numpy(sy).to(device)
有效果的话点个赞吧