pyiqa.archs.uranker_arch¶
URanker model.
This file contains the code for the URanker model, as described in the paper:
Underwater Ranker: Learn Which Is Better and How to Be Better Chunle Guo#, Ruiqi Wu#, Xin Jin, Linghao Han, Zhi Chai, Weidong Zhang, Chongyi Li* Proceedings of the AAAI conference on artificial intelligence (AAAI), 2023
Official codes: https://github.com/RQ-Wu/UnderwaterRanker
Module Contents¶
- class pyiqa.archs.uranker_arch.Mlp(in_features, hidden_features=None, out_features=None, act_layer=nn.GELU, drop=0.0)[source]¶
Bases:
torch.nn.ModuleFeed-forward network (FFN, a.k.a. MLP) class.
- class pyiqa.archs.uranker_arch.ConvRelPosEnc(Ch, h, window)[source]¶
Bases:
torch.nn.ModuleConvolutional relative position encoding.
- class pyiqa.archs.uranker_arch.FactorAtt_ConvRelPosEnc(dim, num_heads=8, qkv_bias=False, qk_scale=None, attn_drop=0.0, proj_drop=0.0, shared_crpe=None)[source]¶
Bases:
torch.nn.ModuleFactorized attention with convolutional relative position encoding class.
- class pyiqa.archs.uranker_arch.ConvPosEnc(dim, k=3)[source]¶
Bases:
torch.nn.ModuleConvolutional Position Encoding. Note: This module is similar to the conditional position encoding in CPVT.
- class pyiqa.archs.uranker_arch.SerialBlock(dim, num_heads, mlp_ratio=4.0, qkv_bias=False, qk_scale=None, drop=0.0, attn_drop=0.0, drop_path=0.0, act_layer=nn.GELU, norm_layer=nn.LayerNorm, shared_cpe=None, shared_crpe=None)[source]¶
Bases:
torch.nn.ModuleSerial block class. Note: In this implementation, each serial block only contains a conv-attention and a FFN (MLP) module.
- class pyiqa.archs.uranker_arch.ParallelBlock(dims, num_heads, mlp_ratios=[], qkv_bias=False, qk_scale=None, drop=0.0, attn_drop=0.0, drop_path=0.0, act_layer=nn.GELU, norm_layer=nn.LayerNorm, shared_cpes=None, shared_crpes=None, connect_type='neighbor')[source]¶
Bases:
torch.nn.ModuleParallel block class.
- class pyiqa.archs.uranker_arch.PatchEmbed(patch_size=16, in_chans=3, embed_dim=768)[source]¶
Bases:
torch.nn.ModuleImage to Patch Embedding
- class pyiqa.archs.uranker_arch.URanker(patch_size=4, in_chans=3, num_classes=1, embed_dims=[152, 320, 320, 320], serial_depths=[2, 2, 2, 2], parallel_depth=6, num_heads=8, mlp_ratios=[4, 4, 4, 4], qkv_bias=True, qk_scale=None, drop_rate=0.0, attn_drop_rate=0.0, drop_path_rate=0.0, norm_layer=partial(nn.LayerNorm, eps=1e-06), return_interm_layers=False, out_features=None, crpe_window={3: 2, 5: 3, 7: 3}, add_historgram=True, his_channel=192, connect_type='dynamic', pretrained=True, pretrained_model_path=None, **kwargs)[source]¶
Bases:
torch.nn.Module