z1069614715 / objectdetection_script

一些关于目标检测的脚本的改进思路代码,详细请看readme.md
5.08k stars 461 forks source link

RuntimeError: one of the variables needed for gradient computation has been modified by an inplace operation #1

Closed sunzhcas closed 1 year ago

sunzhcas commented 1 year ago

Transferred 348/349 items 0%| | 0/504 [00:00<?, ?it/s] Traceback (most recent call last): File "yolov5_heatmap.py", line 117, in model(r'E:\test\envyolo5\yolov5C3\datasets\00194.jpg', 'result') File "yolov5_heatmap.py", line 81, in call score.backward(retain_graph=True) File "E:\test\envyolo5\lib\site-packages\torch\tensor.py", line 245, in backward torch.autograd.backward(self, gradient, retain_graph, create_graph, inputs=inputs) File "E:\test\envyolo5\lib\site-packages\torch\autograd__init__.py", line 147, in backward allow_unreachable=True, accumulate_grad=True) # allow_unreachable flag RuntimeError: one of the variables needed for gradient computation has been modified by an inplace operation: [torch.cuda.FloatTensor [1, 3, 20, 20, 7]], which is output 0 of SigmoidBackward, is at version 2; expected version 0 instead. Hint: enable anomaly detection to find the operation that failed to compute its gradient, with torch.autograd.set_detect_anomaly(True).

请问UP这个怎么破,谢谢

z1069614715 commented 1 year ago

你这个是yolov5的什么版本?

sunzhcas commented 1 year ago

yolov5 v6.2

z1069614715 commented 1 year ago

注意事项已经写了 我是在v7.0编写和测试的 之前的版本有可能跑不通

sunzhcas commented 1 year ago

哦哦,好的,谢谢UP,我再试试。