leaderj1001 / BottleneckTransformers

Bottleneck Transformers for Visual Recognition
MIT License
274 stars 50 forks source link

error!!!!!!!!!!!!!!!!!!!! #6

Open ami66 opened 3 years ago

ami66 commented 3 years ago

when I first step to run the model.py, An error occurred:

The size of tensor a (196) must match the size of tensor b (256) at non-singleton dimension 1

leaderj1001 commented 3 years ago

Hi, Thanks for comments ! You need to use same size of resolution parameters.

def ResNet50(num_classes=1000, resolution=(224, 224)):
    return ResNet(Bottleneck, [3, 4, 6, 3], num_classes=num_classes, resolution=resolution)

def main():
    model = ResNet50()
    x = torch.randn([2, 3, 224, 224])
    print(model(x).size())
    print(get_n_params(model))