agrimgupta92 / sgan

Code for "Social GAN: Socially Acceptable Trajectories with Generative Adversarial Networks", Gupta et al, CVPR 2018
MIT License
819 stars 260 forks source link

Varying length trajectories #21

Closed jagjeet-singh closed 5 years ago

jagjeet-singh commented 5 years ago

I noticed that the trajectories with length less than desired sequence length are filtered out in trajectories.py. Is it possible to make it work for varying trajectory lengths, with lengths being anything between 1 to seq_len?

agrimgupta92 commented 5 years ago

You can remove the filtering and pad the sequence with zeros (in relative coordinates). The only caveat with this approach is you will have very limited history of the person and you can't predict a reliable trajectory with just 1 or 2 time step information.

jagjeet-singh commented 5 years ago

Thank you for the reply. On the same lines, isn't it better to also consider the frame? If a pedestrian was present from frame # 5 to # 15. We can pad the frames 1-4 with the position at # 5 and frames 16-20 with the position at # 15. The intuition is that the pedestrian must have entered the scene at # 5 and left the scene at # 15. This might be better than padding with zeros and encountering huge jumps. As long as the first frame of pedestrian is before frame # 8, the model need not have to predict when the pedestrian started walking.

agrimgupta92 commented 5 years ago

See the updated comment. I meant relative coordinates.

jagjeet-singh commented 5 years ago

But from what I understand, the relative coordinates also contain the first coordinate as the absolute one. Thereon it has delta x and delta y. So are you suggesting padding zeros for the frames prior to that one absolute coordinate?

agrimgupta92 commented 5 years ago

Let us assume that seq_len is 5. We have a trajectory which is [0, 0, 0, 5, 6] (this is only the x-coordinate). Now, if we pad with initial position we will have [5, 5, 5, 5, 6]. The corresponding relative coordinates will be [0, 0, 0, 0, 1]. I meant this when I said pad with zeros in the relative coordinates. Sorry for the confusion but I think we both are on the same page. Now, two cases are possible. Consider if this was part of observed sequence. As opposed to other trajectories the model does not have sufficient context to predict the future. If the observed sequence was instead [0, 0, 0, 0, 0] and prediction was [0, 0, 0, 5, 6]. Then you are asking the model to basically predict when the person started walking (or entered the frame).

jagjeet-singh commented 5 years ago

Thank you! That was really helpful. I'm training Social-GAN on an autonomous driving dataset and it would be a bad idea to ignore partial trajectories there. I've done zero padding as you suggested and started training.

w00zie commented 5 years ago

@jagjeet-singh I'm trying to expand Social-GAN into an automotive context, using the KITTI dataset. Do you have any suggestion based on your work? Thank you.

RebornHugo commented 5 years ago

Can we simply set min_ped=len(peds_in_curr_seq) to ensure that no neighbors are filtered?