yolov5运行报错,
Output 0 of SelectBackward0 is a view and is being modified inplace
File "D:\project\detect\yolov5_wx_55681\det_check\detect_3d_cls.py", line 110, in run
pred = non_max_suppression(pred, conf_thres, iou_thres, opt.classes, opt.agnostic_nms, max_det=max_det)
File "D:\project\detect\yolov5_wx_55681\utils\general.py", line 728, in non_max_suppression
x[((x[..., 2:4] < min_wh) | (x[..., 2:4] > max_wh)).any(1), 4] = 0 # width-height
RuntimeError: Output 0 of SelectBackward0 is a view and is being modified inplace. This view is the output of a function that returns multiple views. Such functions do not allow the output views to be modified inplace. You should replace the inplace operation by an out-of-place one.
解决方法:需要加上@torch.no_grad()
@torch.no_grad() def run(opt):