Hi Jason!



 Jason_Yuen:

        criterion = nn.CrossEntropyLoss()
        loss = criterion(output, target[:, 0])
...
        predicted = torch.argmax(output.data, 1)



This looks a little suspicious.  First you use CrossEntropyLoss to
compare output with target, but with one dimension selected
away.  But then in your accuracy calculation you perform the .eq()
test on output with one dimension reduced away by .argmax()
with target with all of its dimensions.
What are the shapes of output and target?  What are the meanings
of their elements?  In particular, why are you selecting away one of
target's dimensions in your loss calculation?  (Is it a “channels” or
“classes” dimension?)
Also, could you outline in a short sentence the problem you are
working on?


Also the output of loss
1 0.5320905093947355
2.0186073773985127
2 0.5344406446928762
1.8902393944431681
...
5 0.5387050243204894
1.7177013124582658



It’s hard to have much certainty without knowing the details of your
use case, but it’s not at all clear that your training isn’t progressing
reasonably.
Your loss is moving steadily down, and your accuracy is moving
up, albeit slowly, with a slight downtick for the last epoch for which
you gave us results.  This doesn’t seem so bad.
Also, for many realistic problems, five epochs is just getting started,
and not really enough to draw conclusions about the training (but
this depends on your use case and how large your training set is).
What do the loss and accuracy curves look like if you train for, say,
a hundred or several hundred epochs?
Best.
K. Frank