yizt / crnn.pytorch

crnn实现水平和垂直方向中文文字识别, 提供在3w多个中文字符训练的水平识别和垂直识别的预训练模型; 欢迎关注,试用和反馈问题... ...
Apache License 2.0
241 stars 52 forks source link

接着预训练模型接着训练一直是inf? #27

Open RobertXiaobinW opened 3 years ago

RobertXiaobinW commented 3 years ago

有同学接着楼主的模型训练吗?为啥我训练后一直是INF呀。。。调小了学习率也没用。。。

yizt commented 3 years ago

@RobertXiaobinW 您好,需要提供更详细的信息,最好是能够复现问题粒度

RobertXiaobinW commented 3 years ago

这个是loss:tensor(inf, device='cuda:0', grad_fn = '<' MeanBackward0 '>' ) 这个是input_length: tensor([1, 1, 1, 1, 1, 1, 1, 1]) 这个是target_length: tensor([18, 9, 17, 6, 20, 11, 15, 13]) 这个是target: tensor([[ 788, 12398, 16864, 10277, 27893, 26725, 11970, 12494, 24441, 12486, 651, 25194, 21985, 10739, 28449, 18115, 24168, 24136, 0, 0, 0, 0, 0, 0, 0, 0], [18490, 13217, 26361, 8336, 13865, 21787, 8350, 9127, 14206, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [21562, 11474, 8698, 8510, 26653, 98, 9792, 26585, 18390, 9982, 12594, 27589, 15995, 1506, 25033, 29164, 27935, 0, 0, 0, 0, 0, 0, 0, 0, 0], [22313, 20842, 22277, 28439, 26443, 9748, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [30493, 20836, 25265, 23656, 24147, 15982, 27451, 28809, 28860, 11399, 16812, 8996, 17091, 27334, 10614, 16839, 28066, 15049, 21229, 21864, 0, 0, 0, 0, 0, 0], [14392, 28384, 12272, 22050, 13004, 16370, 19666, 8364, 47, 18037, 15336, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [25636, 16725, 755, 24788, 11787, 17582, 20783, 26430, 24712, 8278, 25356, 13494, 13120, 29164, 9054, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [24467, 10223, 13797, 9870, 17309, 28066, 14946, 14523, 10659, 8469, 27858, 9383, 19832, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]])

是CTC方面出了问题么?

GraceKafuu commented 3 years ago

我从0开始训练也是inf,怎么解决