Shortcuts

SDMGRPostProcessor

class mmocr.models.kie.SDMGRPostProcessor(link_type='none', key_node_idx=None, value_node_idx=None)[source]

Postprocessor for SDMGR. It converts the node and edge scores into labels and edge labels. If the link_type is not “none”, it reconstructs the edge labels with different strategies specified by link_type, which is generally known as the “openset” mode. In “openset” mode, only the edges connecting from “key” to “value” nodes will be constructed.

Parameters
  • link_type (str) –

    The type of link to be constructed. Defaults to ‘none’. Options are:

    • ’none’: The simplest link type involving no edge postprocessing. The edge prediction will be returned as-is.

    • ’one-to-one’: One key node can be connected to one value node.

    • ’one-to-many’: One key node can be connected to multiple value nodes.

    • ’many-to-one’: Multiple key nodes can be connected to one value node.

    • ’many-to-many’: No restrictions on the number of edges that a key/value node can have.

  • key_node_idx (int, optional) – The label index of the key node. It must be specified if link_type is not “none”. Defaults to None.

  • value_node_idx (int, optional) – The index of the value node. It must be specified if link_type is not “none”. Defaults to None.

decode_edges(node_labels, edge_scores, edge_labels)[source]

Reconstruct the edges and update edge scores according to link_type.

Parameters
Returns

  • edge_scores (Tensor): A float tensor of shape (N, N)

    indicating the confidence scores for edge predictions.

  • edge_labels (Tensor): An integer tensor of shape (N, N)

    indicating the connection between nodes. Options are 0, 1.

Return type

tuple(Tensor, 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.