Models

class core.net.RX50GCN3Head4Channel(out_channels=7, pretrained=True, nodes=(32, 32), dropout=0, enhance_diag=True, aux_pred=True)
__init__(out_channels=7, pretrained=True, nodes=(32, 32), dropout=0, enhance_diag=True, aux_pred=True)
Parameters
  • out_channels

  • pretrained

  • nodes

  • dropout

  • enhance_diag

  • aux_pred

forward(x)

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class core.net.RX101GCN3Head4Channel(out_channels=7, pretrained=True, nodes=(32, 32), dropout=0, enhance_diag=True, aux_pred=True)
__init__(out_channels=7, pretrained=True, nodes=(32, 32), dropout=0, enhance_diag=True, aux_pred=True)
Parameters
  • out_channels

  • pretrained

  • nodes

  • dropout

  • enhance_diag

  • aux_pred

apply(fn)

Applies fn recursively to every submodule (as returned by .children()) as well as self. Typical use includes initializing the parameters of a model (see also nn-init-doc).

Parameters

fn (Module -> None) – function to be applied to each submodule

Returns

self

Return type

Module

Example:

>>> @torch.no_grad()
>>> def init_weights(m):
>>>     print(m)
>>>     if type(m) == nn.Linear:
>>>         m.weight.fill_(1.0)
>>>         print(m.weight)
>>> net = nn.Sequential(nn.Linear(2, 2), nn.Linear(2, 2))
>>> net.apply(init_weights)
Linear(in_features=2, out_features=2, bias=True)
Parameter containing:
tensor([[ 1.,  1.],
        [ 1.,  1.]])
Linear(in_features=2, out_features=2, bias=True)
Parameter containing:
tensor([[ 1.,  1.],
        [ 1.,  1.]])
Sequential(
  (0): Linear(in_features=2, out_features=2, bias=True)
  (1): Linear(in_features=2, out_features=2, bias=True)
)
Sequential(
  (0): Linear(in_features=2, out_features=2, bias=True)
  (1): Linear(in_features=2, out_features=2, bias=True)
)
forward(x)
Parameters

x

Returns

class core.net.SCGBlock(in_ch, hidden_ch=6, node_size=(32, 32), add_diag=True, dropout=0.2)
__init__(in_ch, hidden_ch=6, node_size=(32, 32), add_diag=True, dropout=0.2)

Self-Constructing Graph module facilitating construction of undirected graphs

Module for creating undirected graphs and capturing relations across images from feature maps (weight adjacency matrices) by learning the mean matrix and a standard deviation matrix of a Gaussian using 2 single-layer CNNs. Parameter free adaptive average pooling is used to reduce the spatial dimensions of the input. Usage of diagonal regularization is applied to stabilize training and to preserve local information. The output of the of module is a symmetric adjacency matrix and an adaptive residual prediction (used to refine the final prediction after information propogation along the graph)

Feature Map

\[X \in \mathbb{R}^{h\times w \times d}\]

Graph of Converted Feature Map

\[G = (\hat{A},X')\mid X'\in \mathbb{R}^{n\times d}, n=h'\times w' \mid (h'\times w')\lt(h\times w)\]

Standard deviation of the output

\[\log({\sigma})\]

of the module follows the convention of variational autoencoders to ensure stability during training

Mean Matrix

\[\mu \in \mathbb{R}^{n \times c}\]

Standard Deviation Matrix

\[\sigma \in \mathbb{R}^{n \times c}\]

Latent Embedding

\[Z \leftarrow \mu + \sigma\cdot\epsilon \mid \epsilon\in\mathbb{R^{N'\times C}}\]

Auxiliary Noise initialized from a standard normal distribution

\[\epsilon\in \mathbb{R^{N'\times C}} \mid \epsilon\sim N(0,1)\]

From the learned latent embeddings, we have activation .. math:: A’ computed as

\[A' = \text{ReLU}(ZZ^T)\]

such that activations

\[A'_{ij}>0\]

denote the presence of an edge between the nodes

\[i,j\]

Usage of diagonal regularization for stabilizing training and preservie local information

forward(x)
classmethod laplacian_matrix(A, self_loop=False)

Computes normalized Laplacian matrix: A (B, N, N)

class core.net.GCNLayer(in_features, out_features, bnorm=True, activation=ReLU(), dropout=None)
__init__(in_features, out_features, bnorm=True, activation=ReLU(), dropout=None)

Initializes internal Module state, shared by both nn.Module and ScriptModule.

forward(data)

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class core.net.BatchNormGCN(num_features)

Batch normalization over GCN features

__init__(num_features)

Initializes internal Module state, shared by both nn.Module and ScriptModule.

forward(x)

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.