# Fused Node-Level Residual Structure Edge Graph Neural Network for Few-Shot Image Classification
## 3 Methods
### EGNN + Node Hierarchical Residual Model Architecture  
The EGNN + Node Hierarchical Residual for few-shot classification is described in this section. It is seen in Figure 1. An initial fully connected graph is built using the feature representations of all samples for the target task (extracted from a jointly trained Convolutional Neural Network), where each node represents a sample and each edge reflects the sort of link between two connected nodes. Let \(G=(V;E;T)\) represent the graph that was created using samples from the task \(T\), with \(V:=\left\{V_{i}\right\}_{i=1,\ldots,|T|}\) and \(E:=\left\{E_{ij}\right\}_{i,j=1,\ldots,|T|}\) standing in for the graph's node set and edge set, respectively. Let \(v_{i}\) be the node feature and \(e_{ij}\) be the edge feature of \(V_{i}\) and \(E_{ij}\), respectively. The number of samples in task \(T\) as a whole is represented by \(|T|=N\times K+T\). The ground truth node labels describe each ground truth label \(y_{ij}\) as follows:  
\[y_{ij}=\left\{ \begin{array}{ll}1,&\text{if }y_{i}=y_{j},\\ 0,&\text{if otherwise.}\end{array} \right. \tag{1}\]  
Figure 1: EGNN + Node Hierarchical Residual architecture diagram. Each edge feature \(e_{ij}=\left\{e_{ijd}\right\}_{d=1}^{2}\in\left[0,1\right]^{2}\) in EGNN + Node Hierarchical Residuals is a two-dimensional vector that depicts the (normalized) strength of the intra-class and inter-class ties that bind two connected nodes. This enables the independent use of cluster-level similarity and cluster-level dissimilarity. The convolutional embedding network's output \(v_{i}^{0}=f_{emb}(x_{i};\theta_{emb})\), where \(\theta_{emb}\) stands for the related parameter set, is used to initialize node features (as illustrated in Figure 2a). Edge features are initialized as follows with edge labels:  
\[e_{ij}^{0}=\left\{ \begin{array}{l}[1\|0],\text{ if }y_{ij}=1\text{ and }i,j\leq N \times k,\\ \\ [1\|0],\text{ if }y_{ij}=0\text{ and }i,j\leq N\times k,\\ \\ [0.5\|0.5],\text{ otherwise,}\end{array} \right. \tag{2}\]  
In this case, \(\|\) signifies the concatenation operation. EGNNs consist of L layers that process the graph. The forward propagation inference of EGNNs involves the alternating update of node features and edge features. The node feature in this situation is updated using a neighborhood aggregation procedure given a node \(v_{i}^{l-1}\) and an edge feature \(e_{ij}^{l-1}\) in layer \(l-1\). A feature transformation is used to update the features of nodes at layer \(l\) after aggregating the features of other nodes that are proportional to the edge feature. This produces version \(v_{i}^{l}\). It works like an  
Figure 2: Detailed network architecture used in EGNN + Node Hierarchical Residuals. (**a**) Embedding network. (**b**) Feature (node) transformation network. (**c**) Metric network. **Algorithm 1:** EGNN + Node Hierarchical Residual  
**Input:**\(G=(V;E;T)\), where \(T=S\cup Q\)  
\(S=\{(x_{i},y_{i})\}_{i=1}^{N\times K}\), \(Q=\{(x_{i},y_{i})\}_{i=N\times K+1}^{N\times K+T}\)  
**Parameters:**\(\theta_{\text{emb}}\cup\left\{\theta_{\
u}^{l},\theta_{e}^{l}\right\}_{i=1}^{L}\)  
**Output:**\(\{\hat{y}_{i}\}_{i=N\times K+1}^{N\times K+T}\)  
**Initialize:**\(\triangleright_{i}^{0}=f_{\text{emb}}(x_{i};\theta_{\text{emb}})\), \(\epsilon_{ij}^{0}\), \(\forall i,j\)  
```
1:for\(l=1,\ldots,L\)do
2:/*Node feature update */
3:for\(i=1,\ldots,\ |V|\)do
4:\(v_{i}^{l}\leftarrow\text{EdgeUpdate}(|v_{i}^{l-1}|_{i}|e_{ij}^{l-1}|_{i},\)\(\theta_{e}^{l})\)
5:end
6:/*Edge feature update */
7:for(\(i\),\(j\)) = 1,\(\ldots,\ |E|\)do
8:\(e_{ij}^{l}\leftarrow\text{EdgeUpdate}(\{v_{i}^{l}\}|_{i}^{l-1}|_{i},\)\(\theta_{e}^{l})\)
9:end
10:\(v_{i}^{l}\leftarrow\text{Hierarchical residual}(|v_{i}^{l-1}|_{i}v_{i}^{l}|)\)
11:end/*Query node label prediction */
12:\(\{\hat{y}_{i}\}_{i=N\times K+1}^{N\times K+T}\leftarrow\)Edge2 NodePred\((\{y_{i}\}_{i=1}^{N\times K},\left\{e_{ij}^{L}\right\})\)

Figure 3: Convolutional residual structure.