def __init__(self, feats=256, fc=(1,), score2prob=nn.Sigmoid()): nn.Module.__init__(self) self.meta = { 'mean': [0.485, 0.456, 0.406], 'std': [0.229, 0.224, 0.225], 'imageSize': [256, 128] } self.pair2bi = Pair2Bi() self.pair2braid = Pair2Braid() self.bi = osnet_x1_0(feats=feats) self.bi.classifier = nn.Identity() self.bi2braid = Bi2Braid() self.braid = LinearMin2Block(feats, feats) self.y = MinMaxY(feats, linear=True) fc_blocks = [] channel_in = feats * 2 for i, sub_fc in enumerate(fc): is_tail = (i + 1 == len(fc)) fc_blocks.append(FCBlock(channel_in, sub_fc, is_tail=is_tail)) channel_in = sub_fc self.fc = nn.Sequential(*fc_blocks) self.score2prob = score2prob # initialize parameters for m in [self.braid, self.fc]: weights_init_kaiming(m) self.correct_params()
def __init__(self, feats=512, num_classes=1000, **kwargs): nn.Module.__init__(self) self.meta = { 'mean': [0.485, 0.456, 0.406], 'std': [0.229, 0.224, 0.225], 'imageSize': [256, 128] } self.pair2bi = Pair2Bi() self.bi = osnet_x1_0(feats=feats, num_classes=num_classes) self.dist = nn.CosineSimilarity(dim=1, eps=1e-6)
def __init__(self, feats=256, fc=(1,), score2prob=nn.Sigmoid()): nn.Module.__init__(self) self.meta = { 'mean': [0.485, 0.456, 0.406], 'std': [0.229, 0.224, 0.225], 'imageSize': [256, 128] } self.pair2bi = Pair2Bi() self.pair2braid = Pair2Braid() self.bi = osnet_x1_0(feats=feats) self.bi.classifier = nn.Identity() self.bi2braid = Bi2Braid() self.braid = nn.Identity() self.y = SumSquareY(feats, linear=True) self.fc = nn.Identity() # initialize parameters for m in [self.braid, self.fc]: weights_init_kaiming(m) self.correct_params()