def __init__(self, phase, pretrained: bool):
    super().__init__()
    self.phase = phase
    self.num_classes = 2
    self.model0 = Conv_head(3, 16, 16)
    self.model1 = Conv4layerBlock(16, 64)
    self.model2 = Conv4layerBlock(64, 64)
    self.model3 = Conv4layerBlock(64, 64)
    self.model4 = Conv4layerBlock(64, 64)
    self.model5 = Conv4layerBlock(64, 64)
    self.model6 = Conv4layerBlock(64, 64)
    self.head = nn.Sequential(Conv4layerBlock(64, (3 * ((14 + 2) + 1)), False), Conv4layerBlock(64, (2 * ((14 + 2) + 1)), False), Conv4layerBlock(64, (2 * ((14 + 2) + 1)), False), Conv4layerBlock(64, (3 * ((14 + 2) + 1)), False))
    if (self.phase == 'train'):
        for m in self.modules():
            if isinstance(m, nn.Conv2d):
                if (m.bias is not None):
                    nn.init.xavier_normal_(m.weight.data)
                    m.bias.data.fill_(0.02)
                else:
                    m.weight.data.normal_(0, 0.01)
            elif isinstance(m, nn.BatchNorm2d):
                m.weight.data.fill_(1)
                m.bias.data.zero_()
    if pretrained:
        pretrained_dict = torch.hub.load_state_dict_from_url(url, map_location=(lambda storage, loc: storage))
        self.load_state_dict(pretrained_dict, strict=True)
    self.eval()
def __init__(self, phase, pretrained: bool):
    super().__init__()
    self.phase = phase
    self.num_classes = 2
    self.model0 = Conv_head(3, 16, 16)
    self.model1 = Conv4layerBlock(16, 64)
    self.model2 = Conv4layerBlock(64, 64)
    self.model3 = Conv4layerBlock(64, 64)
    self.model4 = Conv4layerBlock(64, 64)
    self.model5 = Conv4layerBlock(64, 64)
    self.model6 = Conv4layerBlock(64, 64)
    self.head = nn.Sequential(Conv4layerBlock(64, (3 * ((14 + 2) + 1)), False), Conv4layerBlock(64, (2 * ((14 + 2) + 1)), False), Conv4layerBlock(64, (2 * ((14 + 2) + 1)), False), Conv4layerBlock(64, (3 * ((14 + 2) + 1)), False))
    if (self.phase == 'train'):
        for m in self.modules():
            if isinstance(m, nn.Conv2d):
                if (m.bias is not None):
                    nn.init.xavier_normal_(m.weight.data)
                    m.bias.data.fill_(0.02)
                else:
                    m.weight.data.normal_(0, 0.01)
            elif isinstance(m, nn.BatchNorm2d):
                m.weight.data.fill_(1)
                m.bias.data.zero_()
    if pretrained:
        pretrained_dict = torch.hub.load_state_dict_from_url(url, map_location=(lambda storage, loc: storage))
        self.load_state_dict(pretrained_dict, strict=True)
    self.eval()