Vig¶
- class mmpretrain.models.backbones.Vig(arch, in_channels=3, k=9, out_indices=-1, act_cfg={'type': 'GELU'}, norm_cfg={'type': 'BN'}, graph_conv_bias=True, graph_conv_type='mr', epsilon=0.2, use_dilation=True, use_stochastic=False, drop_path=0.0, relative_pos=False, norm_eval=False, frozen_stages=0, init_cfg=None)[source]¶
Vision GNN backbone.
A PyTorch implementation of Vision GNN: An Image is Worth Graph of Nodes.
Modified from the official implementation https://github.com/huawei-noah/Efficient-AI-Backbones/tree/master/vig_pytorch
- Parameters:
arch (str) – Vision GNN architecture, choose from ‘tiny’, ‘small’ and ‘base’.
in_channels (int) – The number of channels of input images. Defaults to 3.
k (int) – The number of KNN’s k. Defaults to 9.
out_indices (Sequence | int) – Output from which blocks. Defaults to -1, means the last block.
act_cfg (dict) – The config of activative functions. Defaults to
dict(type='GELU'))
.norm_cfg (dict) – The config of normalization layers. Defaults to
dict(type='BN', eps=1e-6)
.graph_conv_bias (bool) – Whether to use bias in the convolution layers in Grapher. Defaults to True.
graph_conv_type (str) – The type of graph convolution,choose from ‘edge’, ‘mr’, ‘sage’ and ‘gin’. Defaults to ‘mr’.
epsilon (float) – Probability of random arrangement in KNN. It only works when
use_dilation=True
anduse_stochastic=True
. Defaults to 0.2.use_dilation (bool) – Whether to use dilation in KNN. Defaults to True.
use_stochastic (bool) – Whether to use stochastic in KNN. Defaults to False.
drop_path (float) – stochastic depth rate. Default 0.0
relative_pos (bool) – Whether to use relative position embedding. Defaults to False.
norm_eval (bool) – Whether to set the normalization layer to eval mode. Defaults to False.
frozen_stages (int) – Blocks to be frozen (all param fixed). Defaults to 0, which means not freezing any parameters.
init_cfg (dict, optional) – The initialization configs. Defaults to None.