- pytorch=1.12.0=py3.9_cuda11.6_cudnn8.3.2_0 - pytorch-mutex=1.0=cuda - torchaudio=0.12.0=py39_cu116 - torchvision=0.13.0=py39_cu116报错
build target indices.append((b, a, gj.clamp_(0, gain[3] - 1), gi.clamp_(0, gain[2] - 1))) # image, anchor, grid indices runtimeerror: result type float can't be cast to the desired output type long int
解决方案
RuntimeError: result type Float can't be cast to the desired output type long int · Issue #35 · WongKinYiu/yolov7 · GitHub
在loss.py文件下修改
gain = torch.ones(7, device = device)
替换为
gain = torch.ones(7, device = device).long()暑期编程PK赛 得CSDN机械键盘等精美礼品!



