agrimgupta92 / sgan

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

ValueError: could not broadcast input array from shape (2,15) into shape (2,16) #107

Open liusui652 opened 2 years ago

liusui652 commented 2 years ago

image When I ran train.py, this bug appeared. Later, I adjusted the torch version and no longer reported the error, but it appeared again when I ran evaluate_model.py. I don't know what caused it?

eunjic commented 2 years ago

@liusui652 I'm having same problem when I run train.py. What torch version did you adjusted?

lsch0lz commented 1 year ago

Hi @liusui652 ! Did you yolved the problem? I'm currently facing the same issue

Nadzi77 commented 1 year ago

It is because some person is not in all 16 positions (8 observed, 8 predicted) - in your case, "(2,15)" means there are 15 positions of some person in dataset instead of 16. I had the same issue so I added these lines in trajectory.py under line curr_ped_seq = np.transpose(curr_ped_seq[:, 2:]):

if curr_ped_seq.shape != (2,16): continue

(in case you are predicting 12 positions, use (2,20) )