I got bad values for the validation loss as the first epoch has
ep001 : loss: 4.473 val_loss : 5.635
val_loss after that became increasing and that is cause overfitting , i think the problem with the way i extract the features from the images as I got negative values like that
1.06231242e-01, -4.80975091e-01, -2.29298934e-01, -2.22610545e+00,
-1.70528257e+00, 1.00546718e+00, -3.37958717e+00, 8.62520158e-01,
1.09218419e+00, 1.02676439e+00, -5.19405723e-01, -1.97264120e-01,
6.29661739e-01, 8.84239256e-01, -2.18081331e+00, 1.23091125e+00,
-1.20287977e-01, 7.21974909e-01, 2.16648507e+00, 4.63137746e-01,
4.28042859e-01, -7.97591209e-01, -7.74370611e-01, -4.94653493e-01,
1.33503842e+00, 5.22300005e-01, -2.49824524e+00, -4.03152406e-01,
-1.78791010e+00, -1.03124011e+00, 8.80928874e-01, -1.29657283e-01,
-2.61071831e-01, -3.11868429e-01, 5.31454265e-01, 4.07434464e-01,
-3.46822053e-01, 7.70217240e-01, 1.25887111e-01, -1.67335427e+00, ....
the code is
class Identity(nn.Module):
def init(self):
super().init()
def forward(self, x):
return x
File = ‘file.pth.tar’
model = create_model(My_model’,pretrained=False)
model.load_state_dict(torch.load(File))
model.head = Identity()
model.eval()
I found this way in this forum to freeze the last layer as I don’t need to make a classification