def __init__(self, nblock=4): super(E2ETransformer, self).__init__() self.fvextractor = extractor.Resnet(nblock) self.fvdim = 512 // (2**(4 - nblock)) # self.transformer = Transformer(self.fvdim) self.transformer = Transformer(self.fvdim, NUM_HEADS=3, NUM_LAYERS=2)
def __init__(self, k=10, agg='l1', nblock=4, feat='resnet'): super(NAggN, self).__init__() if feat == 'resnet': self.fvextractor = extractor.Resnet(nblock) fvdim = 512 // (2**(4 - nblock)) elif feat == 'small': self.fvextractor = extractor.SmallFeat() fvdim = 512 else: raise Exception("Not Implemented") if agg == 'l1': self.aggregator = L1Aggregator(fvdim) elif agg == 'l2': self.aggregator = L2Aggregator(fvdim) elif agg == 'avg': self.aggregator = AvgAggregator() else: raise Exception("unknown aggregator") self.proj = nn.Linear(fvdim, k)
def __init__(self, nblock=4, k=10): super(Resnet50, self).__init__() self.fvextractor = extractor.Resnet(nblock, basic='resnet50') fvdim = 2048 // (2**(4 - nblock)) self.proj = nn.Linear(fvdim, k)
def __init__(self, nblock=4, k=10): super(SiNet, self).__init__() self.fvextractor = extractor.Resnet(nblock) fvdim = 512 // (2**(4 - nblock)) self.proj = nn.Linear(fvdim, k)