sha2nkt / moyo_toolkit

This is a repository for download, preprocessing, visualizing, running evaluations on the MOYO dataset.
Other
78 stars 5 forks source link

No SensorMat Markers #11

Closed YoloZyk closed 3 months ago

YoloZyk commented 5 months ago

Hi,

I have some issues extracting pressure mat markers using the following code in pressure_mat_utils.py,

marker_id_one = np.where(data.point_labels == 'SensorMat:M_1                  ')[0]
marker_id_two = np.where(data.point_labels == 'SensorMat:M_2                  ')[0]
marker_id_three = np.where(data.point_labels == 'SensorMat:M_3               ')[0]
marker_id_four = np.where(data.point_labels == 'SensorMat:M_4                 ')[0]
marker_ids_unordered = [marker_id_one, marker_id_two, marker_id_three, marker_id_four]

I checked the point_labels in the c3d file, and there are no markers for the sensor mat?

array(['LFHD                          ', 'RFHD                          ',
       'LBHD                          ', 'RBHD                          ',
       'C7                            ', 'T10                           ',
       'CLAV                          ', 'STRN                          ',
       'RBAK                          ', 'LSHO                          ',
       'LUPA                          ', 'LELB                          ',
       'LFRM                          ', 'LWRA                          ',
       'LWRB                          ', 'LFIN                          ',
       'RSHO                          ', 'RUPA                          ',
       'RELB                          ', 'RFRM                          ',
       'RWRA                          ', 'RWRB                          ',
       'RFIN                          ', 'LASI                          ',
       'RASI                          ', 'LPSI                          ',
       'RPSI                          ', 'LTHI                          ',
       'LKNE                          ', 'LTIB                          ',
       'LANK                          ', 'LHEE                          ',
       'LTOE                          ', 'RTHI                          ',
       'RKNE                          ', 'RTIB                          ',
       'RANK                          ', 'RHEE                          ',
       'RTOE                          ', 'PELO                          ',
       'PELA                          ', 'PELL                          ',
       'PELP                          ', 'LFEO                          ',
       'LFEA                          ', 'LFEL                          ',
       'LFEP                          ', 'LTIO                          ',
       'LTIA                          ', 'LTIL                          ',
       'LTIP                          ', 'LFOO                          ',
       'LFOA                          ', 'LFOL                          ',
       'LFOP                          ', 'LTOO                          ',
       'LTOA                          ', 'LTOL                          ',
       'LTOP                          ', 'RFEO                          ',
       'RFEA                          ', 'RFEL                          ',
       'RFEP                          ', 'RTIO                          ',
       'RTIA                          ', 'RTIL                          ',
       'RTIP                          ', 'RFOO                          ',
       'RFOA                          ', 'RFOL                          ',
       'RFOP                          ', 'RTOO                          ',
       'RTOA                          ', 'RTOL                          ',
       'RTOP                          ', 'HEDO                          ',
       'HEDA                          ', 'HEDL                          ',
       'HEDP                          ', 'LCLO                          ',
       'LCLA                          ', 'LCLL                          ',
       'LCLP                          ', 'RCLO                          ',
       'RCLA                          ', 'RCLL                          ',
       'RCLP                          ', 'TRXO                          ',
       'TRXA                          ', 'TRXL                          ',
       'TRXP                          ', 'LHUO                          ',
       'LHUA                          ', 'LHUL                          ',
       'LHUP                          ', 'LRAO                          ',
       'LRAA                          ', 'LRAL                          ',
       'LRAP                          ', 'LHNO                          ',
       'LHNA                          ', 'LHNL                          ',
       'LHNP                          ', 'RHUO                          ',
       'RHUA                          ', 'RHUL                          ',
       'RHUP                          ', 'RRAO                          ',
       'RRAA                          ', 'RRAL                          ',
       'RRAP                          ', 'RHNO                          ',
       'RHNA                          ', 'RHNL                          ',
       'RHNP                          ', '*115                          ',
       '*116                          ', '*117                          ',
       '*118                          ', '*119                          ',
       '*120                          ', '*121                          ',
       '*122                          ', '*123                          ',
       '*124                          ', '*125                          ',
       'LHipAngles                    ', 'LKneeAngles                   ',
       'LAbsAnkleAngle                ', 'LAnkleAngles                  ',
       'RHipAngles                    ', 'RKneeAngles                   ',
       'RAnkleAngles                  ', 'RAbsAnkleAngle                ',
       'LPelvisAngles                 ', 'RPelvisAngles                 ',
       'LFootProgressAngles           ', 'RFootProgressAngles           ',
       'RNeckAngles                   ', 'LNeckAngles                   ',
       'RSpineAngles                  ', 'LSpineAngles                  ',
       'LShoulderAngles               ', 'LElbowAngles                  ',
       'LWristAngles                  ', 'RShoulderAngles               ',
       'RElbowAngles                  ', 'RWristAngles                  ',
       'LWaistMoment                  ', 'RWaistMoment                  ',
       'LNeckMoment                   ', 'RNeckMoment                   ',
       'LShoulderMoment               ', 'RShoulderMoment               ',
       'LElbowMoment                  ', 'RElbowMoment                  ',
       'LWristMoment                  ', 'RWristMoment                  ',
       'CentreOfMass                  ', 'CentreOfMassFloor             '],
      dtype=object)
sha2nkt commented 5 months ago

Hi,

Just want to confirm if you are using the correct c3d: In the released pressure folder, we have two c3ds, and I recommend using the pressure_mat_c3d.

image

You can also refer to this line where we initialize the PressureMat() object correctly

YoloZyk commented 5 months ago

Yeah, I am sure I used the pressure_mat_c3d file you mentioned, but it does contain only the fields I listed above. I also checked other c3d files, including the dataset in 20220923_20220926_with_hands, and got the same result. Here is a snippet of my script to initialize PressureMat(), which may help to prove that I am using it correctly.

csv_path = '../data/moyo/20221004_with_com/pressure/train/single_csv/'
xml_path = '../data/moyo/20221004_with_com/pressure/train/xml/'
c3d_path = '../data/moyo/20221004_with_com/pressure/train/pressure_mat_c3d/'

def check_pressure_util(csv, xml, c3d, index=666):
    pm = PressureMat(csv, xml, c3d)
        gt_pressures = pm.gt_pressures
    gt_heatmaps = pm.gt_heatmaps
        ...

if __name__ == '__main__':
        ...
        check_pressure_util(csv_path + filename + '.csv', xml_path + filename + '.xml', c3d_path + filename + '.c3d', index=index)
sha2nkt commented 4 months ago

Hello,

Sorry for the delay in my response. I looked at the c3d files in ../data/moyo/20220923_20220926_with_hands/pressure/train/pressure_mat_c3d/ and they do contain SensorMat labels.

I ran the following code snippet:

import c3d

c3d_file = "/ps/project/datasets/MOYO/20220923_20220926_with_hands/pressure/train/pressure_mat_c3d/220926_yogi_body_hands_03596_Reclining_Hand-to-Big-Toe_Pose_or_Supta_Padangusthasana_-a.c3d"

with open(c3d_file, 'rb') as f:
        data = c3d.Reader(f)  # data contains the header of the c3d files, info such as the label name
        for frame in data.read_frames():  # call read_frames() to iterate across the marker positions
            frame = frame[1][:, :3]  # this contains the marker positions
            break

print(data.point_labels)

And the output is

array(['SensorMat:M_1                                                   ',
       'SensorMat:M_2                                                   ',
       'SensorMat:M_3                                                   ',
       'SensorMat:M_4                                                   ',
       'YogiMat:M_1                                                     ',
       'YogiMat:M_2                                                     ',
       'YogiMat:M_3                                                     ',
       'YogiMat:M_4                                                     ',
       'YogiMat:M_5                                                     ',
       'YogiMat:M_6                                                     ',
       '_03596:ARIEL                                                    ',
       '_03596:LFHD                                                     ',
       '_03596:LBHD                                                     ',
       '_03596:RFHD                                                     ',
       '_03596:RBHD                                                     ',
       '_03596:C7                                                       ',
       '_03596:T10                                                      ',
       '_03596:CLAV                                                     ',
       '_03596:STRN                                                     ',
       '_03596:LFSH                                                     ',
       '_03596:LBSH                                                     ',
       '_03596:LUPA                                                     ',
       '_03596:LELB                                                     ',
       '_03596:LIEL                                                     ',
       '_03596:LFRM                                                     ',
       '_03596:LIWR                                                     ',
       '_03596:LOWR                                                     ',
       '_03596:LIHAND                                                   ',
       '_03596:LOHAND                                                   ',
       '_03596:LTHM3                                                    ',
       '_03596:LTHM6                                                    ',
       '_03596:LIDX3                                                    ',
       '_03596:LIDX6                                                    ',
       '_03596:LMID0                                                    ',
       '_03596:LMID6                                                    ',
       '_03596:LRNG3                                                    ',
       '_03596:LRNG6                                                    ',
       '_03596:LPNK3                                                    ',
       '_03596:LPNK6                                                    ',
       '_03596:RFSH                                                     ',
       '_03596:RBSH                                                     ',
       '_03596:RUPA                                                     ',
       '_03596:RELB                                                     ',
       '_03596:RIEL                                                     ',
       '_03596:RFRM                                                     ',
       '_03596:RIWR                                                     ',
       '_03596:ROWR                                                     ',
       '_03596:RIHAND                                                   ',
       '_03596:ROHAND                                                   ',
       '_03596:RTHM3                                                    ',
       '_03596:RTHM6                                                    ',
       '_03596:RIDX3                                                    ',
       '_03596:RIDX6                                                    ',
       '_03596:RMID0                                                    ',
       '_03596:RMID6                                                    ',
       '_03596:RRNG3                                                    ',
       '_03596:RRNG6                                                    ',
       '_03596:RPNK3                                                    ',
       '_03596:RPNK6                                                    ',
       '_03596:LFWT                                                     ',
       '_03596:MFWT                                                     ',
       '_03596:RFWT                                                     ',
       '_03596:LBWT                                                     ',
       '_03596:MBWT                                                     ',
       '_03596:RBWT                                                     ',
       '_03596:LTHI                                                     ',
       '_03596:LKNE                                                     ',
       '_03596:LKNI                                                     ',
       '_03596:LSHN                                                     ',
       '_03596:LANK                                                     ',
       '_03596:LHEL                                                     ',
       '_03596:LMT5                                                     ',
       '_03596:LMT1                                                     ',
       '_03596:LTOE                                                     ',
       '_03596:RTHI                                                     ',
       '_03596:RKNE                                                     ',
       '_03596:RKNI                                                     ',
       '_03596:RSHN                                                     ',
       '_03596:RANK                                                     ',
       '_03596:RHEL                                                     ',
       '_03596:RMT5                                                     ',
       '_03596:RMT1                                                     ',
       '_03596:RTOE                                                     '],
      dtype=object)

In my the repository, I read the c3d file here. Could you run the above snippet and confirm if you still don't see the SensorMarkers?