def __init__(self, config):
    super(ResNetCBAM, self).__init__()
    embedding_size = config.embedding_size
    drop_ratio = config.drop_ratio
    model_dic = MODEL[config.num_layers_c]
    layers = model_dic['layers']
    block = Bottleneck
    self.inplanes = 64
    self.conv1 = nn.Conv2d(3, 64, kernel_size=7, stride=2, padding=3, bias=False)
    self.bn1 = nn.BatchNorm2d(64)
    self.relu = nn.ReLU(inplace=True)
    self.maxpool = nn.MaxPool2d(kernel_size=3, stride=2, padding=1)
    self.layer1 = self._make_layer(block, 64, layers[0])
    self.layer2 = self._make_layer(block, 128, layers[1], stride=2)
    self.layer3 = self._make_layer(block, 256, layers[2], stride=2)
    self.layer4 = self._make_layer(block, 512, layers[3], stride=1)
    self.avgpool = nn.AdaptiveAvgPool2d((1, 1))
    self.bn_last = nn.BatchNorm1d(embedding_size)
    self.bn_last.bias.requires_grad_(False)
    'if not config.resume:\n            self._initialize_weights()                               \n'
def __init__(self, config):
    super(ResNetCBAM, self).__init__()
    embedding_size = config.embedding_size
    drop_ratio = config.drop_ratio
    model_dic = MODEL[config.num_layers_c]
    layers = model_dic['layers']
    block = Bottleneck
    self.inplanes = 64
    self.conv1 = nn.Conv2d(3, 64, kernel_size=7, stride=2, padding=3, bias=False)
    self.bn1 = nn.BatchNorm2d(64)
    self.relu = nn.ReLU(inplace=True)
    self.maxpool = nn.MaxPool2d(kernel_size=3, stride=2, padding=1)
    self.layer1 = self._make_layer(block, 64, layers[0])
    self.layer2 = self._make_layer(block, 128, layers[1], stride=2)
    self.layer3 = self._make_layer(block, 256, layers[2], stride=2)
    self.layer4 = self._make_layer(block, 512, layers[3], stride=1)
    self.avgpool = nn.AdaptiveAvgPool2d((1, 1))
    self.bn_last = nn.BatchNorm1d(embedding_size)
    self.bn_last.bias.requires_grad_(False)
    'if not config.resume:\n            self._initialize_weights()                               \n'