Shortcuts

SDMGRModuleLoss

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

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

Parameters
  • 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.

Return type

None

forward(preds, data_samples)[source]

Forward function.

Parameters
  • preds (tuple(Tensor, Tensor)) –

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

Returns

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

Return type

dict(str, Tensor)

Read the Docs v: dev-1.x
Versions
latest
stable
v1.0.1
v1.0.0
0.x
v0.6.3
v0.6.2
v0.6.1
v0.6.0
v0.5.0
v0.4.1
v0.4.0
v0.3.0
v0.2.1
v0.2.0
v0.1.0
dev-1.x
Downloads
pdf
html
epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.