Skip to content

Commit

Permalink
add resnets
Browse files Browse the repository at this point in the history
  • Loading branch information
Wenliang Dai committed Jul 28, 2018
1 parent 204a9c7 commit d7fc52d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions main/models/fcn32.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def __init__(self, num_classes=21, pretrained=False, depth=18):
elif 'ReLU' in f.__class__.__name__:
f.inplace = True

self.features5 = nn.Sequential(*features)
self.features = nn.Sequential(*features)

final = nn.Conv2d(512, num_classes, kernel_size=1)
final.weight.data.zero_()
Expand All @@ -164,7 +164,7 @@ def __init__(self, num_classes=21, pretrained=False, depth=18):

def forward(self, x):
this_shape = x.size()
x = self.features5(x)
x = self.features(x)
x = self.final(x)
x = F.upsample(input=x, size=this_shape[2:], mode='bilinear', align_corners=True)
return x
Expand Down Expand Up @@ -192,7 +192,7 @@ def __init__(self, num_classes=[21,20], pretrained=False, depth=18):
elif 'ReLU' in f.__class__.__name__:
f.inplace = True

self.features5 = nn.Sequential(*features)
self.features = nn.Sequential(*features)

final1 = nn.Conv2d(512, num_classes[0], kernel_size=1)
final1.weight.data.zero_()
Expand All @@ -216,7 +216,7 @@ def __init__(self, num_classes=[21,20], pretrained=False, depth=18):

def forward(self, x, task):
this_shape = x.size()
x = self.features5(x)
x = self.features(x)
x = self.final1(x) if task == 0 else self.final2(x)
x = F.upsample(input=x, size=this_shape[2:], mode='bilinear', align_corners=True)
return x

0 comments on commit d7fc52d

Please sign in to comment.