umautobots / bidirection-trajectory-predicter

The code for Bi-directional Trajectory Prediction (BiTraP).
Other
78 stars 23 forks source link

Question - Encoded vector for observed trajectory X #5

Closed ksachdeva closed 2 years ago

ksachdeva commented 3 years ago

Hi @MoonBlvd

image

In the paper, the observed trajectory X is passed through a GRU and the output is called h_t. Similar is the case for the Y.

From the paper, it would not be clear if the encoded vector is the "output" of the GRU or the last "hidden" state of the GRU. Most likely guess will be that it is the last hidden state since you used h

After reading your code, I saw that

Output & hidden state of the GRU are returned here https://github.com/umautobots/bidireaction-trajectory-prediction/blob/42375028bcd2a4f0d2e32c5fe320e34aa3d5a0d3/bitrap/modeling/bitrap_np.py#L175

Hidden state (h_x) is ignored https://github.com/umautobots/bidireaction-trajectory-prediction/blob/42375028bcd2a4f0d2e32c5fe320e34aa3d5a0d3/bitrap/modeling/bitrap_np.py#L181

In the subsequent code, you still refer to the output of the observation encoder as h_x. for e.g. https://github.com/umautobots/bidireaction-trajectory-prediction/blob/42375028bcd2a4f0d2e32c5fe320e34aa3d5a0d3/bitrap/modeling/bitrap_np.py#L211

https://github.com/umautobots/bidireaction-trajectory-prediction/blob/42375028bcd2a4f0d2e32c5fe320e34aa3d5a0d3/bitrap/modeling/bitrap_np.py#L109

I am mentioning all this to simply bring it to your attention that there is no typo here. Typically one uses h for the hidden state and hence the concern. Python is not the best language when it comes to preventing typos and hence bringing it to your attention

Regards Kapil

MoonBlvd commented 2 years ago

Thank you Kapil and sorry for the late response. We used outputs rather than h_x in line 181 because outputs consstains the states of the whole sequence while h_x is only the final hidden state. We refer to the encoder output as h_x because we used the final state in output here , but I agree that the naming is confusing.