detectRecog / CCPD

[ECCV 2018] CCPD: a diverse and well-annotated dataset for license plate detection and recognition
MIT License
2.21k stars 564 forks source link

train 的时候 报错 #53

Open hry8310 opened 4 years ago

hry8310 commented 4 years ago

使用命令 : python wR2.py -i /root/mt/cimg/home/booy/booy/ccpd_dataset/ccpd_db/ -b 4

报错内容 /usr/local/lib/python3.6/dist-packages/torch/optim/lr_scheduler.py:100: UserWarning: Detected call of lr_scheduler.step() before optimizer.step(). In PyTorch 1.1.0 and later, you should call them in the opposite order: optimizer.step() before lr_scheduler.step(). Failure to do this will result in PyTorch skipping the first value of the learning rate schedule.See more details at https://pytorch.org/docs/stable/optim.html#how-to-adjust-learning-rate "https://pytorch.org/docs/stable/optim.html#how-to-adjust-learning-rate", UserWarning) Traceback (most recent call last): File "wR2.py", line 230, in model_conv = train_model(model_conv, criterion, optimizer_conv, num_epochs=epochs) File "wR2.py", line 213, in train_model lossAver.append(loss.data[0]) IndexError: invalid index of a 0-dim tensor. Use tensor.item() to convert a 0-dim tensor to a Python number

检查了一下。是

            lossAver.append(loss.data[0]) 报错了。请问是不是我的执行命令有问题
dabblle commented 4 years ago

lossAver.append(loss.data[0]) ----------> lossAver.append(loss.item())

hry8310 commented 4 years ago

您好!       谢谢你的回复,我有时间重试一下       再次感谢

------------------ 原始邮件 ------------------ 发件人: "JpDing"<notifications@github.com>; 发送时间: 2019年12月12日(星期四) 下午2:59 收件人: "detectRecog/CCPD"<CCPD@noreply.github.com>; 抄送: "黄日燕-男的"<247403822@qq.com>;"Author"<author@noreply.github.com>; 主题: Re: [detectRecog/CCPD] train 的时候 报错 (#53)

lossAver.append(loss.data[0]) ----------> lossAver.append(loss.item())

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.