we0091234 / Chinese_license_plate_detection_recognition

yolov5 车牌检测 车牌识别 中文车牌识别 检测 支持12种中文车牌 支持双层车牌
GNU General Public License v3.0
1.34k stars 224 forks source link

感谢开源。训练过程遇到one of the variables needed for gradient computation has been modified by an inplace operation #11

Open chunmengcai opened 1 year ago

chunmengcai commented 1 year ago

File "E:\work\code\Car_recognition-master\train.py", line 521, in train(hyp, opt, device, tb_writer, wandb) File "E:\work\code\Car_recognition-master\train.py", line 291, in train loss, loss_items = compute_loss(pred, targets.to(device), model) # loss scaled by batch_size File "E:\work\code\Car_recognition-master\utils\loss.py", line 163, in compute_loss lcls += BCEcls(ps[:, 13:], t) # BCE File "E:\soft1\conda\lib\site-packages\torch\nn\modules\module.py", line 1190, in _call_impl return forward_call(*input, **kwargs) File "E:\soft1\conda\lib\site-packages\torch\nn\modules\loss.py", line 720, in forward return F.binary_cross_entropy_with_logits(input, target, File "E:\soft1\conda\lib\site-packages\torch\nn\functional.py", line 3162, in binary_cross_entropy_with_logits return torch.binary_cross_entropy_with_logits(input, target, weight, pos_weight, reduction_enum) File "E:\soft1\conda\lib\site-packages\torch\fx\traceback.py", line 57, in format_stack return traceback.format_stack() (Triggered internally at C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\torch\csrc\autograd\python_anomaly_mode.cpp:119.) Variable._execution_engine.run_backward( # Calls into the C++ engine to run the backward pass 0%| | 0/24 [00:00<?, ?it/s] Traceback (most recent call last): File "E:\work\code\Car_recognition-master\train.py", line 521, in train(hyp, opt, device, tb_writer, wandb) File "E:\work\code\Car_recognition-master\train.py", line 296, in train scaler.scale(loss).backward() File "E:\soft1\conda\lib\site-packages\torch_tensor.py", line 487, in backward torch.autograd.backward( File "E:\soft1\conda\lib\site-packages\torch\autograd__init__.py", line 197, in backward Variable._execution_engine.run_backward( # Calls into the C++ engine to run the backward pass RuntimeError: one of the variables needed for gradient computation has been modified by an inplace operation: [torch.FloatTensor [30, 2]], which is output 0 of AsStridedBackward0, is at version 4; expected version 0 instead. Hint: the backtrace further above shows the operation that failed to compute its gradient. The variable in question was changed in there or anywhere later. Good luck!

Jane42070 commented 1 year ago

我也是这样,找了几天解决方法了,版本也换了很多,都没有解决,希望作者可以提醒一下,遇到这种情况是什么原因,解决方法

we0091234 commented 1 year ago

加群问问,好像这个问题很熟悉

CopyABCs commented 1 year ago

请问这个问题各位解决了吗,可以说一下是怎么解决的吗

1m82 commented 1 year ago

我也遇到了,请问解决了吗

1m82 commented 1 year ago

@we0091234 @chunmengcai