Hi Mahbubul!



 Mahbubcse:

I am estimating age from face images where the number of classes is 101(0…100).
…
I am estimating the real age through classification.


If you are working on this as a semi-realistic problem (in contrast to
a pure learning exercise), I would strongly suggest that you treat this
as regression problem rather than a classification problem.
You would have your final layer be a Linear with out_features = 1,
and the output value would be the predicted age.  Your target
(ground-truth annotation) would be the actual age.  Then use something
like MSELoss as your loss criterion.
If the true age is 50 then classifying the image as class 49 or 51
is no better or worse than classifying it as 0 or 100.  So in training
you would be throwing away the (very useful) information that your
prediction was almost exactly right (even though not spot on).
On the other hand, using a regression-type loss (such as MSELoss)
would heavily penalize a prediction of 0, but only modestly disfavor a
prediction of 49 in comparison with the correct result of 50 (and this
is logically what you want).
Best.
K. Frank