| 10 | from method.nn_util import PatchEmbedIR, PatchUnEmbedIR, IdentityMod, SkipConnection |
| 11 | |
| 12 | class Bokehlicious(Module): |
| 13 | |
| 14 | def __init__(self, |
| 15 | # General Args |
| 16 | in_chans=3, img_range=1., dynamic_conv_k=4, |
| 17 | # In Stage Args |
| 18 | in_stage_use_pos_map: bool = True, |
| 19 | in_stage_use_bokeh_strength_map: bool = False, |
| 20 | # UNet Args |
| 21 | u_width=32, |
| 22 | u_depth=2, |
| 23 | u_block_config=None, |
| 24 | u_skip_connections=None, |
| 25 | # Enc Args |
| 26 | enc_blk_nums: List[int] = None, |
| 27 | enc_blks_use_pos_map: List[bool] = None, |
| 28 | # Deep Feature Extractor args |
| 29 | embed_dims=None, |
| 30 | depths=None, |
| 31 | num_heads=None, |
| 32 | init_values=None, |
| 33 | heads_ranges=None, |
| 34 | mlp_ratios=None, |
| 35 | drop_path_rate=0.1, |
| 36 | norm_layer=LayerNorm, |
| 37 | patch_norm=True, |
| 38 | use_checkpoints=None, |
| 39 | chunkwise_recurrents=None, |
| 40 | layerscales=None, |
| 41 | layer_init_values=1e-6, |
| 42 | positional_dfe=False, |
| 43 | use_dfe_norm_layer=True, |
| 44 | positional_conv_last=False, |
| 45 | # Dec Args |
| 46 | dec_blk_nums: List[int] = None, |
| 47 | dec_blks_use_pos_map: List[bool] = None, |
| 48 | # Out Stage Args |
| 49 | out_stage_use_pos_map: bool = True |
| 50 | ): |
| 51 | super().__init__() |
| 52 | |
| 53 | self.in_chans = in_chans |
| 54 | self.img_range = img_range |
| 55 | |
| 56 | # In Stage Args |
| 57 | self.in_stage_use_pos_map = in_stage_use_pos_map |
| 58 | self.in_stage_use_bokeh_strength_map = in_stage_use_bokeh_strength_map |
| 59 | |
| 60 | self.u_width = u_width |
| 61 | self.u_depth = u_depth |
| 62 | self.u_block_config = u_block_config or {'dw_expand': 1., 'ffn_expand': 2., |
| 63 | 'drop_out_rate': 0, 'attention_type': 'CA', |
| 64 | 'activation_type': 'GELU', 'kernel_size': 3, |
| 65 | 'inverted_conv': True, |
| 66 | } |
| 67 | |
| 68 | self.u_skip_connections = u_skip_connections or [True for _ in range(u_depth)] |
| 69 |
no outgoing calls
no test coverage detected