PaddleOCR ch_PP-OCRv3_rotnet.yml方向分类器训练两类会报错。

hiz5n14c  于 2023-02-04  发布在  其他
关注(0)|答案(5)|浏览(443)

将ch_PP-OCRv3_rotnet.yml中的class_dim改成2后,会报下面的错误。

Error: /paddle/paddle/fluid/operators/softmax_with_cross_entropy_op.cu:536 Assertion `labels_[idx_lbl] >= 0 && labels_[idx_lbl] < d_ || labels_[idx_lbl] == ignore_idx_` failed. The value of label[83] expected >= 0 and < 2, or == -100,but got 3. Please check input value.
Error: /paddle/paddle/fluid/operators/softmax_with_cross_entropy_op.cu:536 Assertion `labels_[idx_lbl] >= 0 && labels_[idx_lbl] < d_ || labels_[idx_lbl] == ignore_idx_` failed. The value of label[83] expected >= 0 and < 2, or == -100,but got 3. Please check input value.
Error: /paddle/paddle/fluid/operators/softmax_with_cross_entropy_op.cu:536 Assertion `labels_[idx_lbl] >= 0 && labels_[idx_lbl] < d_ || labels_[idx_lbl] == ignore_idx_` failed. The value of label[86] expected >= 0 and < 2, or == -100,but got 2. Please check input value.
Error: /paddle/paddle/fluid/operators/softmax_with_cross_entropy_op.cu:536 Assertion `labels_[idx_lbl] >= 0 && labels_[idx_lbl] < d_ || labels_[idx_lbl] == ignore_idx_` failed. The value of label[86] expected >= 0 and < 2, or == -100,but got 2. Please check input value.
Error: /paddle/paddle/fluid/operators/softmax_with_cross_entropy_op.cu:536 Assertion `labels_[idx_lbl] >= 0 && labels_[idx_lbl] < d_ || labels_[idx_lbl] == ignore_idx_` failed. The value of label[87] expected >= 0 and < 2, or == -100,but got 3. Please check input value.
Error: /paddle/paddle/fluid/operators/softmax_with_cross_entropy_op.cu:536 Assertion `labels_[idx_lbl] >= 0 && labels_[idx_lbl] < d_ || labels_[idx_lbl] == ignore_idx_` failed. The value of label[87] expected >= 0 and < 2, or == -100,but got 3. Please check input value.
Error: /paddle/paddle/fluid/operators/softmax_with_cross_entropy_op.cu:536 Assertion `labels_[idx_lbl] >= 0 && labels_[idx_lbl] < d_ || labels_[idx_lbl] == ignore_idx_` failed. The value of label[90] expected >= 0 and < 2, or == -100,but got 2. Please check input value.
Error: /paddle/paddle/fluid/operators/softmax_with_cross_entropy_op.cu:536 Assertion `labels_[idx_lbl] >= 0 && labels_[idx_lbl] < d_ || labels_[idx_lbl] == ignore_idx_` failed. The value of label[90] expected >= 0 and < 2, or == -100,but got 2. Please check input value.
Error: /paddle/paddle/fluid/operators/softmax_with_cross_entropy_op.cu:536 Assertion `labels_[idx_lbl] >= 0 && labels_[idx_lbl] < d_ || labels_[idx_lbl] == ignore_idx_` failed. The value of label[91] expected >= 0 and < 2, or == -100,but got 3. Please check input value.
Error: /paddle/paddle/fluid/operators/softmax_with_cross_entropy_op.cu:536 Assertion `labels_[idx_lbl] >= 0 && labels_[idx_lbl] < d_ || labels_[idx_lbl] == ignore_idx_` failed. The value of label[91] expected >= 0 and < 2, or == -100,but got 3. Please check input value.
Error: /paddle/paddle/fluid/operators/softmax_with_cross_entropy_op.cu:536 Assertion `labels_[idx_lbl] >= 0 && labels_[idx_lbl] < d_ || labels_[idx_lbl] == ignore_idx_` failed. The value of label[94] expected >= 0 and < 2, or == -100,but got 2. Please check input value.
Error: /paddle/paddle/fluid/operators/softmax_with_cross_entropy_op.cu:536 Assertion `labels_[idx_lbl] >= 0 && labels_[idx_lbl] < d_ || labels_[idx_lbl] == ignore_idx_` failed. The value of label[94] expected >= 0 and < 2, or == -100,but got 2. Please check input value.
Error: /paddle/paddle/fluid/operators/softmax_with_cross_entropy_op.cu:536 Assertion `labels_[idx_lbl] >= 0 && labels_[idx_lbl] < d_ || labels_[idx_lbl] == ignore_idx_` failed. The value of label[95] expected >= 0 and < 2, or == -100,but got 3. Please check input value.
Error: /paddle/paddle/fluid/operators/softmax_with_cross_entropy_op.cu:536 Assertion `labels_[idx_lbl] >= 0 && labels_[idx_lbl] < d_ || labels_[idx_lbl] == ignore_idx_` failed. The value of label[95] expected >= 0 and < 2, or == -100,but got 3. Please check input value.
Traceback (most recent call last):
  File "tools/train.py", line 191, in <module>
    main(config, device, logger, vdl_writer)
  File "tools/train.py", line 164, in main
    program.train(config, train_dataloader, valid_dataloader, device, model,
  File "/home/zhengtian/PaddleOCR/tools/program.py", line 276, in train
    avg_loss.backward()
  File "<decorator-gen-123>", line 2, in backward
  File "/home/zhengtian/anaconda3/envs/paddle_env/lib/python3.8/site-packages/paddle/fluid/wrapped_decorator.py", line 25, in __impl__
    return wrapped_func(*args, **kwargs)
  File "/home/zhengtian/anaconda3/envs/paddle_env/lib/python3.8/site-packages/paddle/fluid/framework.py", line 227, in __impl__
    return func(*args, **kwargs)
  File "/home/zhengtian/anaconda3/envs/paddle_env/lib/python3.8/site-packages/paddle/fluid/dygraph/varbase_patch_methods.py", line 238, in backward
    core.dygraph_run_backward([self], [grad_tensor], retain_graph,
OSError: (External)  Cudnn error, CUDNN_STATUS_INTERNAL_ERROR  (at /paddle/paddle/fluid/operators/conv_cudnn_op.cu:790)

label就是0和180两类,在yml中加入label_list: ['0','180']也会报类似的错误。

carvr3hs

carvr3hs1#

看报错应该是你的label有问题,label应该是0,1 ,不能超过2

k7fdbhmy

k7fdbhmy2#

看报错应该是你的label有问题,label应该是0,1 ,不能超过2

label 0,1也会报错

n is run every 200 iterations
Traceback (most recent call last):
  File "tools/train.py", line 191, in <module>
    main(config, device, logger, vdl_writer)
  File "tools/train.py", line 164, in main
    program.train(config, train_dataloader, valid_dataloader, device, model,
  File "/home/zhengtian/PaddleOCR/tools/program.py", line 276, in train
    avg_loss.backward()
  File "<decorator-gen-123>", line 2, in backward
  File "/home/zhengtian/anaconda3/envs/paddle_env/lib/python3.8/site-packages/paddle/fluid/wrapped_decorator.py", line 25, in __impl__
    return wrapped_func(*args, **kwargs)
  File "/home/zhengtian/anaconda3/envs/paddle_env/lib/python3.8/site-packages/paddle/fluid/framework.py", line 227, in __impl__
    return func(*args, **kwargs)
  File "/home/zhengtian/anaconda3/envs/paddle_env/lib/python3.8/site-packages/paddle/fluid/dygraph/varbase_patch_methods.py", line 238, in backward
    core.dygraph_run_backward([self], [grad_tensor], retain_graph,
OSError: (External)  Cudnn error, CUDNN_STATUS_INTERNAL_ERROR  (at /paddle/paddle/fluid/operators/conv_cudnn_op.cu:790)

跑其他的det rec都顺利,以及cls_mv3.yml也正常

kcwpcxri

kcwpcxri3#

你好,目前这个是基于自监督的训练方式,默认是4分类训练,如果想要二分类,你可以把这里的参数修改为 False

PaddleOCR/ppocr/data/imaug/ssl_img_aug.py

Line 28 in 1696b36

| | select_all=True, |

同时也把配置文件里面的class num修改为2

fumotvh3

fumotvh34#

select_all

好的,谢谢!

fdbelqdn

fdbelqdn5#

@littletomatodonkey 我想问一下,我按照你的要求改好了,但是inference也需要改一些东西?因为train的acc能到0.99, 但inference效果比较差.

相关问题