I want to use Feature Fusion to improve the VGG19’s performance in classification. my plan is to extract the Conv layers 8，12, 16 and use the torch.cat() to imply the feature fusion. but i don’t konw how to change my code to finish it. this is my code, it will be very grateful to tell me how to do it.
class VGG(nn.Module): def __init__(self, vgg_name): super(VGG, self).__init__() self.features = self._make_layers(cfg[vgg_name]) self.classifier = nn.Linear(512, 7) def forward(self, x): out = self.features(x) out = out.view(out.size(0), -1) out = F.dropout(out, p=0.5, training=self.training) out = self.classifier(out) return out def _make_layers(self, cfg): layers =  in_channels = 3 for x in cfg: if x == 'M': layers += [nn.MaxPool2d(kernel_size=2, stride=2)] else: layers += [nn.Conv2d(in_channels, x, kernel_size=3, padding=1), nn.BatchNorm2d(x), nn.ReLU(inplace=True)] in_channels = x # print(layers) layers += [nn.AvgPool2d(kernel_size=1, stride=1)] return nn.Sequential(*layers)