From df064f45386340ad648bafd9cfe87f8d89c4ddff Mon Sep 17 00:00:00 2001 From: tanjh Date: Wed, 28 Jun 2023 13:26:48 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A1=A5=E5=85=85FAQ=20(#10074)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 增加两个实际训练过程中遇到的问题及解决方案 --- doc/doc_ch/kie.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/doc/doc_ch/kie.md b/doc/doc_ch/kie.md index 26d2e560f..a79ce3ebc 100644 --- a/doc/doc_ch/kie.md +++ b/doc/doc_ch/kie.md @@ -505,3 +505,13 @@ RE可视化结果默认保存到`./output`文件夹里面,结果示例如下 Q1: 训练模型转inference 模型之后预测效果不一致? **A**:该问题多是trained model预测时候的预处理、后处理参数和inference model预测的时候的预处理、后处理参数不一致导致的。可以对比训练使用的配置文件中的预处理、后处理和预测时是否存在差异。 + +Q2: 训练过程中报如下错误: +ValueError: (InvalidArgument) The 'shape' attribute in ReshapeOp is invalid. The input tensor X'size must be divisible by known capacity of 'shape'. But received X's shape = [4, 512, 23], X's size = 47104, 'shape' is [-1, 7], known capacity of 'shape' is -7. +**A**:是由于训练使用的配置文件ser_vi_layoutxlm_xfund_zh.yml中Architecture.Backbone.num_classes的值与Loss.num_classes的值不一致导致。 + +Q3: 训练过程中报如下错误: +IndexError: (OutOfRange) label value should less than the shape of axis dimension when label value(23) not equal to ignore_index(-100), But received label value as 23 and shape of axis dimension is 23. +**A**:是由于训练使用的配置文件ser_vi_layoutxlm_xfund_zh.yml中Architecture.Backbone.num_classes的值与Loss.num_classes的值不正确。 +由于采用BIO标注,所以默认会有一个"O"标签,同时会忽略"OTHER", "OTHERS", "IGNORE"三个标签。PostProcess.class_path设置的字典文件中的每种类型会自动扩展成"B-"和"I-"为前缀的标签。 +所以假设字典文件中包含n个类型(包含OTHER)时,num_classes应该为2n-1;假设字典文件中包含n个类型(不含OTHER)时,num_classes应该为2n+1。