BenjaminFiltjens/MS-GCN

function getfeatures() error

Closed this issue · 1 comments

Hi,
Many thanks for sharing the code. I met trouble when execute function getfeatures() -> get_relative_coordinates.
My understanding of this function is to calculate the displacements compared to 4 root nodes (joint index: 4 8 12 16 defined as NTU_RGBD).

The error appears when execute code:
coords_diff = (sample.transpose((2, 0, 1, 3)) - ref_loc).transpose((1, 2, 0, 3))
ERROR: The numpy can't broadcast with shapes (25,3,1838,1) v.s. (3,1838,4,1)

Then the code shows:
# Shape: 4*C, t, V, M
rel_coords = np.vstack(rel_coords)
so I modified the code as:

    for ref in references:
        ref_loc = sample[:, :, ref, :]
        coords_diff = (sample.transpose((2, 0, 1, 3)) - ref_loc).transpose((1, 2, 0, 3))
        rel_coords.append(coords_diff)

The code runs correctly then.
However,

# Shape: 4*C, t, V, M 
rel_coords = np.vstack(rel_coords)
# Shape: C, T, V, M
final_sample[:, start:end, :, :] = rel_coords

can't runs correctly because [4*C, t, V, M] can't adjust to [C, t, V, M]
Could you help to solve this problem? thanks.

Thank you for reporting this error. We updated the code to more clearly indicate that we only evaluated the function for a single reference node (e.g., reference=(0)).

The function was adapted from pb-gcn: https://github.com/kalpitthakkar/pb-gcn/tree/master/data/signals
If you'd like to use multiple reference nodes, you can find the answer in the pb-gcn code. I hope that this will address your problem.