GRMenon commited on
Commit
62a43b6
1 Parent(s): 52c9cff

Upload 6 files

Browse files
.gitattributes CHANGED
@@ -33,3 +33,5 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ gradio_check1.png filter=lfs diff=lfs merge=lfs -text
37
+ gradio_check13.png filter=lfs diff=lfs merge=lfs -text
dehazing_gen.py ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import torch
2
+ import torch.nn as nn
3
+
4
+
5
+ class ConvBlock(nn.Module):
6
+ def __init__(self, in_channels: int, out_channels: int, downsample: bool = True, use_act: bool = True,
7
+ use_dropout: bool = False, **kwargs):
8
+ super(ConvBlock, self).__init__()
9
+
10
+ self.conv_block = nn.Sequential(
11
+ nn.Conv2d(in_channels=in_channels, out_channels=out_channels, padding_mode="reflect", **kwargs)
12
+
13
+ if downsample
14
+ else nn.ConvTranspose2d(in_channels=in_channels, out_channels=out_channels, **kwargs),
15
+
16
+ nn.InstanceNorm2d(num_features=out_channels),
17
+ nn.ReLU(inplace=True) if use_act else nn.Identity()
18
+ )
19
+ if use_dropout:
20
+ self.conv_block = nn.Sequential(self.conv_block, nn.Dropout(p=0.5))
21
+
22
+ def forward(self, x):
23
+ return self.conv_block(x)
24
+
25
+
26
+ class ResidualBlock(nn.Module):
27
+ def __init__(self, features: int):
28
+ super(ResidualBlock, self).__init__()
29
+ self.residual_block = nn.Sequential(
30
+ ConvBlock(in_channels=features, out_channels=features, kernel_size=3, padding=1),
31
+ ConvBlock(in_channels=features, out_channels=features, kernel_size=3, padding=1, use_act=False),
32
+ )
33
+
34
+ def forward(self, x):
35
+ return x + self.residual_block(x)
36
+
37
+
38
+ class CycleGenerator(nn.Module):
39
+ def __init__(self, img_channels: int = 3, latent_dim: int = 64, num_residuals: int = 9):
40
+ super(CycleGenerator, self).__init__()
41
+
42
+ self.base = nn.Sequential(
43
+ nn.Conv2d(in_channels=img_channels, out_channels=latent_dim, kernel_size=7, stride=1, padding=3,
44
+ padding_mode="reflect"),
45
+ nn.ReLU(inplace=True)
46
+ )
47
+
48
+ self.down_blocks = nn.ModuleList(
49
+ [
50
+ ConvBlock(in_channels=latent_dim, out_channels=latent_dim * 2, kernel_size=3, stride=2, padding=1),
51
+ ConvBlock(in_channels=latent_dim * 2, out_channels=latent_dim * 4, kernel_size=3, stride=2, padding=1),
52
+ ]
53
+ )
54
+
55
+ self.residual_blocks = nn.Sequential(
56
+ *[ResidualBlock(features=latent_dim * 4) for _ in range(num_residuals)]
57
+ )
58
+
59
+ self.up_blocks = nn.ModuleList(
60
+ [
61
+ ConvBlock(in_channels=latent_dim * 4, out_channels=latent_dim * 2, kernel_size=3, stride=2, padding=1,
62
+ output_padding=1,
63
+ downsample=False),
64
+ ConvBlock(in_channels=latent_dim * 2, out_channels=latent_dim, kernel_size=3, stride=2, padding=1,
65
+ output_padding=1,
66
+ downsample=False),
67
+ ]
68
+ )
69
+
70
+ self.head = nn.Conv2d(in_channels=latent_dim, out_channels=img_channels, kernel_size=7, stride=1, padding=3,
71
+ padding_mode="reflect")
72
+
73
+ def forward(self, x):
74
+ x = self.base(x)
75
+
76
+ for layer in self.down_blocks:
77
+ x = layer(x)
78
+
79
+ x = self.residual_blocks(x)
80
+
81
+ for layer in self.up_blocks:
82
+ x = layer(x)
83
+
84
+ x = self.head(x)
85
+
86
+ return torch.tanh(x)
genC.pth.tar ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:83c998de8c48e350a93fd204db7bf56739b7fd1e068a8bc73e80baf326c3ea30
3
+ size 156833914
gradio_check1.png ADDED

Git LFS Details

  • SHA256: e47feab1fcad26e518ca5bee80084d0956bf999d5bee52cf5f9fb2a65e35d358
  • Pointer size: 132 Bytes
  • Size of remote file: 1.63 MB
gradio_check10.png ADDED
gradio_check13.png ADDED

Git LFS Details

  • SHA256: bae9ea1ab443a897c3df1e6f40cb1ff42c11d750445cf82da0521a3c44b3d12b
  • Pointer size: 132 Bytes
  • Size of remote file: 1.56 MB
gradio_check5.png ADDED