SER index error: IndexError: (OutOfRange) label value should less than the shape of axis dimension when label value(2) not equal to ignore_index(-100) #13090
-
问题描述 / Problem DescriptionI want to train the SER model using my custom dataset which has 2 class labels in total, but I am getting an error when it comes to training. What could be the problem here? 运行环境 / Runtime Environment
复现代码 / Reproduction Code完整报错 / Complete Error Message(luks_paddleOCR) PS C:\Users\piade\LUKS\luks_ocr> python tools/train.py -c configs/kie/vi_layoutxlm/ser_vi_layoutxlm_xfund_zh.yml 可能解决方案 / Possible solutions附件 / Appendix |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
num_classes设置错了,由于采用BIO标注,假设字典中包含n个字段(包含other)时,则类别数为2n-1; 假设字典中包含n个字段(不含other)时,则类别数为2n+1。否则在train过程会报:IndexError: (OutOfRange) label value should less than the shape of axis dimension 。 参考官方文档:https://paddlepaddle.github.io/PaddleOCR/main/ppocr/model_train/kie.html#21 |
Beta Was this translation helpful? Give feedback.
num_classes设置错了,由于采用BIO标注,假设字典中包含n个字段(包含other)时,则类别数为2n-1; 假设字典中包含n个字段(不含other)时,则类别数为2n+1。否则在train过程会报:IndexError: (OutOfRange) label value should less than the shape of axis dimension 。
参考官方文档:https://paddlepaddle.github.io/PaddleOCR/main/ppocr/model_train/kie.html#21