well it was bit wrong but this is correct I got 85% accuracy on VGG with 50 epochs I think it can be increased if I use modified resnet in same manner
class Mymodel(nn.Module):
def __init__(self):
super(Mymodel, self).__init__()
self.hidden_layer_output = nn.Sequential(*list(vgg.children())[:-1])
self.vow_output = nn.Sequential(
nn.Linear(512 * 7 * 7,4096),
nn.ReLU(True),
nn.Dropout(),
nn.Linear(4096, 4096),
nn.ReLU(True),
nn.Dropout(),
nn.Linear(4096, 10)
)
self.const_output = nn.Sequential(
nn.Linear(512 * 7 * 7,4096),
nn.ReLU(True),
nn.Dropout(),
nn.Linear(4096, 4096),
nn.ReLU(True),
nn.Dropout(),
nn.Linear(4096, 10)
)
def forward(self, x):
x=self.hidden_layer_output(x)
x = x.view(x.size(0),-1)
x_vow_output = self.vow_output(x)
y_const_output = self.const_output(x)
return x_vow_output,y_const_output