Complextext2animation icon indicating copy to clipboard operation
Complextext2animation copied to clipboard

fke2rifke slicing in data.py

Open Mathux opened this issue 2 years ago • 5 comments

Hello,

In data.pyline 381, you define rifke_dict which seems to give correspondances between "part of the body" and indices.

Line 164-166, you are using some of the indexes, to extract the feet positions.

fid_l, fid_r = self.rifke_dict['fid_l'], self.rifke_dict['fid_r']
foot_heights = np.minimum(
     positions[:, fid_l, 1], positions[:, fid_r, 1]).min(axis=1)
floor_height = softmin(foot_heights, softness=0.5, axis=0)

If I understand correctly, the shape of positions is [number_of_frames, number_of_joints, 3].

Line 176-177, you are adding the "reference joint" by concatenating it in the "joints" axis at the beginning:

positions = np.concatenate(
          [reference[:, np.newaxis], positions], axis=1)

From now on, I think the indices are shifted (by 1). So when you use again the correspondance table rifke_dict, the indexes doesn't match the part of the body.

Line 182:

feet_l_x = (positions[1:, fid_l, 0] - positions[:-1, fid_l, 0])**2

Or line 205-209:

sdr_l, sdr_r, hip_l, hip_r = self.rifke_dict['sdr_l'], self.rifke_dict[
       'sdr_r'], self.rifke_dict['hip_l'], self.rifke_dict['hip_r']

across1 = positions[:, hip_l] - positions[:, hip_r]
across0 = positions[:, sdr_l] - positions[:, sdr_r]

What do you think of it?

Thanks

Mathux avatar Mar 04 '22 12:03 Mathux

As this part of the code is borrowed from language2pose repository, I duplicate the issue there: https://github.com/chahuja/language2pose/issues/22

Mathux avatar Mar 09 '22 11:03 Mathux

I think they calculated the index in rifke_dict after adding reference. So we don't need to modify it I think. :)

dwro0121 avatar Mar 23 '22 10:03 dwro0121

As fid_l and fid_r are used before (line 164) and after shifting the indexes (line 182), one or the other should be wrong I think.

Mathux avatar Mar 23 '22 13:03 Mathux

As fid_l and fid_r are used before (line 164) and after shifting the indexes (line 182), one or the other should be wrong I think.

I didn't find the one used earlier, are you referring to line 163 comments?

dwro0121 avatar Mar 23 '22 15:03 dwro0121

I didn't find the one used earlier, are you referring to line 163 comments?

I was refering to line 166 https://github.com/anindita127/Complextext2animation/blob/d89730c17580c5b9ccb767d55257f6781eec062a/src/data.py#L166

Then, the shifting on indexes in line 177 https://github.com/anindita127/Complextext2animation/blob/d89730c17580c5b9ccb767d55257f6781eec062a/src/data.py#L177

Then the reindexing line 182 https://github.com/anindita127/Complextext2animation/blob/d89730c17580c5b9ccb767d55257f6781eec062a/src/data.py#L182

Mathux avatar Apr 14 '22 09:04 Mathux