una-dinosauria/human-motion-prediction

A question about sampling_based loss

KavinduZoysa opened this issue · 6 comments

Hi @una-dinosauria

I have a question about sampling_based loss.

According to my understanding, the sampling_based loss means giving the previous output to the current input inside the decoder. Also, I think it is done inside the seq2seq_model.py file and the corresponding line is mentioned below(loop function).

def lf(prev, i): # function for sampling_based loss

Could you please tell me that my understanding is correct or wrong?
If I am wrong can you please explain me how the sampling_based loss is calculated in the code.

Your response is highly appreciated.

Thank you,
Kavindu

That is correct.

Hi @una-dinosauria,

Thanks a lot for your verification. I have one more question. Why do we use the word "loss"(sampling_based loss) here? (According to my understanding we are not doing any loss calculation here)

Thank you,
Kavindu

Oh this just means that, while training, we minimize the loss that is the difference between the ground truth and what our network predicts during k timesteps (as opposed to the usual training, where you minimize the difference between ground truth and what your network predicts at each timestep, after being fed the ground truth).

Hi @una-dinosauria,

Thank you for the information. But still, I am confusing because simply sampling_based loss means adding the previous prediction to the current input. Here we do not consider the ground truth when we are getting the sampling_based loss. Can you please help me to clear this problem.

According to the code, I cannot see that we are getting the difference between the ground truth and what network predicts during k timesteps under sampling_based loss.
I think the sampling_based loss is indicated by the blue broken line in the below figure.

rp

Thank you,
Kavindu

Here we do not consider the ground truth when we are getting the sampling_based loss. Can you please help me to clear this problem.

We do. The prediction is on the upper right, and the loss is computed between that and the ground truth (not shown in the diagram).

According to the code, I cannot see that we are getting the difference between the ground truth and what network predicts during k timesteps under sampling_based loss.

The loss is right here:

loss_angles = tf.reduce_mean(tf.square(tf.subtract(dec_out, outputs)))

dec_out is the ground truth.

I think the sampling_based loss is indicated by the blue broken line in the below figure.

Yes, as opposed to always giving the ground truth as input to the decoder.

Thanks a lot for the explanation.