bnu-wangxun / Deep_Metric

Deep Metric Learning

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

trainloader issues

CandiceUIC opened this issue · comments

Hey I saw you updated your work recently, that is so nice of you.

I got a question about trainloader here. As I posted before, when I ran your code on my own computer, the loss function is increasing. The problem may be the trainloader. I found that in each epoch, the train loader only load about 480 images which is strange. The number of iterations in each epoch is only 6. I was trying to fix it by myself but it looks a little bit difficult to fully understand your code. Do you have any suggestions for me to fix this problem?

Cheers
Candice

For every epoch, we do not use all the samples. We just randomly choose K (num_instances in the code) samples from each classes. So only 6 iterations for every epoch.

For the problem of loss function, I need to see your log to know the problem.

Ps: pytorch version is required to be 0.2.30

Thanks for your reply.
The version of pytorch I am using is 0.2.30. If you say that 6 iterations is correct, I would say that the codes are running well on my computer.
I am just a little bit curious why each epoch does not go through all the training set. That is a little bit weird to me.

  1. For easy Implementation, and the performance is good.
  2. PK (P classes , K samples/class) minibatch. Since the number of samples in every class is different, it is hard to go through all the train set.

@CandiceUIC Have you reached the performance as me?

@bnulihaixia For the Binomial Loss, I did reached a performance like you posted. But for other losses, for example triplet, I did not. I think that might be the reason of parameter choosing. I am now working on it.

Anyway, thank you so much for posting your work!

cheers