self.featureExtract = nn.Sequential( # 271
nn.Conv2d(configs[0], configs[1] , kernel_size=11, stride=2), # 131
nn.BatchNorm2d(configs[1]),
nn.MaxPool2d(kernel_size=3, stride=2), #65
nn.ReLU(inplace=True),
nn.Conv2d(configs[1], configs[2], kernel_size=5), #61
nn.BatchNorm2d(configs[2]),
nn.MaxPool2d(kernel_size=3, stride=2), #30
nn.ReLU(inplace=True),
nn.Conv2d(configs[2], configs[3], kernel_size=3), #28
nn.BatchNorm2d(configs[3]),
nn.ReLU(inplace=True),
nn.Conv2d(configs[3], configs[4], kernel_size=3), #26
nn.BatchNorm2d(configs[4]),
nn.ReLU(inplace=True),
nn.Conv2d(configs[4], configs[5], kernel_size=3), #24
nn.BatchNorm2d(configs[5]),
)
self.conv_r1 = nn.Conv2d(feat_in, feature_out*4*anchor, 3)
self.conv_r2 = nn.Conv2d(feat_in, feature_out, 3)
self.conv_cls1 = nn.Conv2d(feat_in, feature_out*2*anchor, 3)
self.conv_cls2 = nn.Conv2d(feat_in, feature_out, 3)
self.regress_adjust = nn.Conv2d(4*anchor, 4*anchor, 1)
Above is the nn module of my defined class, now I only want to use the pre-trained parameters of the self.featureExtract part but not the later part,
so how should I do in order to load only partial parameters of the
net.load_state_dict(torch.load(net_file))
(This above is going to load all the params but I just want to load some specific part)