The CrossEntropy loss for the train dataset alwas styas around 0.7


I have a problem and I hope someone could help me through this.
I am training a resnet34 to classify the gender (male or female) in the CelebA dataset, and I use the nn.CrossentropyLoss() for this task. However, the training loss always stays around 0.7 !! I cannot even overfit my train dataset.

  • I have checked the dataset (images match the annotations).
  • I have checked the networks. Parameters.require_grad. they are all True.

    I have also added the network information if it helps. My classification problem is a part of the whole multi-task problem (classification and regression).
    I really don’t know where I have missed what.
    Thank you so much.

class ClassifierLocalizer(nn.Module):

def __init__(self, model_name, num_classes=2):

    super(ClassifierLocalizer, self).__init__()

    self.num_classes = num_classes


    # create cnn model

    model = getattr(models, model_name)(pretrained=True)


    # remove fc layers and add a new fc layer

    num_features = model.fc.in_features

    model.fc = nn.Linear(num_features, 6) # classifier + localizer

    self.model = model

def forward(self, x):

    x = self.model(x)                    # extract features from CNN

    scores = x[:, :self.num_classes]     # class scores

    coords = x[:, self.num_classes:]     # coordinates

    return scores, coords