garyzhao / SemGCN

The Pytorch implementation for "Semantic Graph Convolutional Networks for 3D Human Pose Regression" (CVPR 2019).
https://arxiv.org/abs/1904.03345
Apache License 2.0
467 stars 78 forks source link

RuntimeError: mat1 dim 1 must match mat2 dim 0 #44

Open AminAnsarian opened 3 years ago

AminAnsarian commented 3 years ago

I get this error with this Traceback when trying to train non-local on ground truth h36m:

Traceback (most recent call last):

File "/mnt/466a95be-9c12-4e2c-9e95-7d037205b249/Amin/SemGCN/main_gcn.py", line 287, in main(parse_args())

File "/mnt/466a95be-9c12-4e2c-9e95-7d037205b249/Amin/SemGCN/main_gcn.py", line 176, in main epoch_loss, lr_now, glob_step = train(train_loader, model_pos, criterion, optimizer, device, args.lr, lr_now,

File "/mnt/466a95be-9c12-4e2c-9e95-7d037205b249/Amin/SemGCN/main_gcn.py", line 223, in train outputs_3d = model_pos(inputs_2d)

File "/home/amin/anaconda3/envs/torch/lib/python3.8/site-packages/torch/nn/modules/module.py", line 727, in _call_impl result = self.forward(*input, **kwargs)

File "/mnt/466a95be-9c12-4e2c-9e95-7d037205b249/Amin/SemGCN/models/sem_gcn.py", line 93, in forward out = self.gconv_input(x)

File "/home/amin/anaconda3/envs/torch/lib/python3.8/site-packages/torch/nn/modules/module.py", line 727, in _call_impl result = self.forward(*input, **kwargs)

File "/home/amin/anaconda3/envs/torch/lib/python3.8/site-packages/torch/nn/modules/container.py", line 117, in forward input = module(input)

File "/home/amin/anaconda3/envs/torch/lib/python3.8/site-packages/torch/nn/modules/module.py", line 727, in _call_impl result = self.forward(*input, **kwargs)

File "/mnt/466a95be-9c12-4e2c-9e95-7d037205b249/Amin/SemGCN/models/sem_gcn.py", line 23, in forward x = self.gconv(x).transpose(1, 2)

File "/home/amin/anaconda3/envs/torch/lib/python3.8/site-packages/torch/nn/modules/module.py", line 727, in _call_impl result = self.forward(*input, **kwargs)

File "/mnt/466a95be-9c12-4e2c-9e95-7d037205b249/Amin/SemGCN/models/sem_graph_conv.py", line 43, in forward output = torch.matmul(adj M, h0) + torch.matmul(adj (1 - M), h1)

RuntimeError: mat1 dim 1 must match mat2 dim 0

and these are the input parameters: Using settings Namespace(actions='*', batch_size=64, checkpoint='checkpoint', dataset='h36m', downsample=1, dropout=0.0, epochs=100, evaluate='', hid_dim=128, keypoints='gt', lr=0.001, lr_decay=100000, lr_gamma=0.96, max_norm=True, non_local=True, num_layers=4, num_workers=8, resume='', snapshot=5)

the matrix multiplication dimensions are not matching apparently:

adj is 16x16 M is 16x16

and h0 is 64x17x128.

Does anybody know how to fix this? Thanks in advance!

koustav123 commented 3 years ago

For me, it was due to using preprocessed npz files from another repository (VideoPose3D). I instead downloaded a fresh zip file and ran the processing script and now it works all right.

Check here. https://github.com/garyzhao/SemGCN/tree/master/data