Spaces:
Sleeping
Sleeping
Update archs/arch_util_freq.py
Browse files- archs/arch_util_freq.py +1 -20
archs/arch_util_freq.py
CHANGED
|
@@ -14,25 +14,6 @@ except:
|
|
| 14 |
https://github.com/wangchx67/FourLLIE.git
|
| 15 |
'''
|
| 16 |
|
| 17 |
-
def initialize_weights(net_l, scale=1):
|
| 18 |
-
if not isinstance(net_l, list):
|
| 19 |
-
net_l = [net_l]
|
| 20 |
-
for net in net_l:
|
| 21 |
-
for m in net.modules():
|
| 22 |
-
if isinstance(m, nn.Conv2d):
|
| 23 |
-
init.kaiming_normal_(m.weight, a=0, mode='fan_in')
|
| 24 |
-
m.weight.data *= scale # for residual block
|
| 25 |
-
if m.bias is not None:
|
| 26 |
-
m.bias.data.zero_()
|
| 27 |
-
elif isinstance(m, nn.Linear):
|
| 28 |
-
init.kaiming_normal_(m.weight, a=0, mode='fan_in')
|
| 29 |
-
m.weight.data *= scale
|
| 30 |
-
if m.bias is not None:
|
| 31 |
-
m.bias.data.zero_()
|
| 32 |
-
elif isinstance(m, nn.BatchNorm2d):
|
| 33 |
-
init.constant_(m.weight, 1)
|
| 34 |
-
init.constant_(m.bias.data, 0.0)
|
| 35 |
-
|
| 36 |
class FreNAFBlock(nn.Module):
|
| 37 |
|
| 38 |
def __init__(self, nc, expand = 2):
|
|
@@ -135,7 +116,7 @@ if __name__ == '__main__':
|
|
| 135 |
|
| 136 |
# net = NAFNet(img_channel=img_channel, width=width, middle_blk_num=middle_blk_num,
|
| 137 |
# enc_blk_nums=enc_blks, dec_blk_nums=dec_blks)
|
| 138 |
-
net =
|
| 139 |
dilations = dilations,
|
| 140 |
extra_depth_wise=extra_depth_wise)
|
| 141 |
|
|
|
|
| 14 |
https://github.com/wangchx67/FourLLIE.git
|
| 15 |
'''
|
| 16 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
class FreNAFBlock(nn.Module):
|
| 18 |
|
| 19 |
def __init__(self, nc, expand = 2):
|
|
|
|
| 116 |
|
| 117 |
# net = NAFNet(img_channel=img_channel, width=width, middle_blk_num=middle_blk_num,
|
| 118 |
# enc_blk_nums=enc_blks, dec_blk_nums=dec_blks)
|
| 119 |
+
net = EBlock_freq(c = img_channel,
|
| 120 |
dilations = dilations,
|
| 121 |
extra_depth_wise=extra_depth_wise)
|
| 122 |
|