Hi, I would like to use just the beginnig part of resnet, so I did the thing below:
feature_map_extractor = torch.hub.load('pytorch/vision:v0.10.0', 'resnet50', pretrained=True) feature_map_extractor.layer1 = nn.Sequential() feature_map_extractor.layer2 = nn.Sequential() feature_map_extractor.layer3 = nn.Sequential() feature_map_extractor.layer4 = nn.Sequential() feature_map_extractor.fc = nn.Sequential() feature_map_extractor.avgpool = nn.Sequential() feature_map_extractor.maxpool = nn.Sequential()
and the model is like this as I expected:
(conv1): Conv2d(3, 64, kernel_size=(7, 7), stride=(2, 2), padding=(3, 3), bias=False)
(bn1): BatchNorm2d(64, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
and I would like to get the things that has a shape like square cause my image has square shape and resnet applies conv2d. But I got the shape below:
image = torch.randn((1,3,256,256)) a = feature_map_extractor(image) a.shape
Why is that ?