Shortcuts

SDMGRModuleLoss

class mmocr.models.kie.SDMGRModuleLoss(weight_node=1.0, weight_edge=1.0, ignore_idx=- 100)[源代码]

The implementation the loss of key information extraction proposed in the paper: Spatial Dual-Modality Graph Reasoning for Key Information Extraction.

参数
  • weight_node (float) – Weight of node loss. Defaults to 1.0.

  • weight_edge (float) – Weight of edge loss. Defaults to 1.0.

  • ignore_idx (int) – Node label to ignore. Defaults to -100.

返回类型

None

forward(preds, data_samples)[源代码]

Forward function.

参数
  • preds (tuple(Tensor, Tensor)) –

  • data_samples (list[KIEDataSample]) – A list of datasamples containing gt_instances.labels and gt_instances.edge_labels.

返回

Loss dict, containing loss_node, loss_edge, acc_node and acc_edge.

返回类型

dict(str, Tensor)

Read the Docs v: dev-1.x
Versions
latest
stable
0.x
dev-1.x
Downloads
pdf
html
epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.