openxrlab / xrmocap

OpenXRLab Multi-view Motion Capture Toolbox and Benchmark
https://xrmocap.readthedocs.io/
Other
348 stars 42 forks source link

SMPLData does not update mask when loading SMPLify results #83

Closed LazyBusyYang closed 1 year ago

LazyBusyYang commented 1 year ago

Length of mask is 1 when a SMPLData instance is being constructed with default arguments. After it loads SMPLify results(or results from body_model), everything changes except mask. Below is a script to reproduce the issue.

import numpy as np
from xrprimer.utils.log_utils import get_logger
from xrmocap.data_structure.body_model import SMPLData

logger = get_logger()
smpl_data = SMPLData()
logger.info(
    'Init:\n' +
    f'batch_size: {smpl_data.get_batch_size()}\n' +
    f'mask len: {smpl_data.get_mask().shape[0]}\n')

param_dict = dict(
    global_orient=np.zeros((10, 3)),
    transl=np.zeros((10, 3)),
    body_pose=np.zeros((10, 23, 3)),
    betas=np.zeros((10, 10)),
)
smpl_data.from_param_dict(param_dict)
logger.info(
    'After loading param_dict:\n' +
    f'batch_size: {smpl_data.get_batch_size()}\n' +
    f'mask len: {smpl_data.get_mask().shape[0]}\n')

And the output is:

2023-03-02 09:30:04,734 - root - INFO - Init:
batch_size: 1
mask len: 1

2023-03-02 09:30:04,734 - root - INFO - After loading param_dict:
batch_size: 10
mask len: 1
haolyuan commented 1 year ago

The error was caused by lacking of mask's updating in function from_param_dict in xrmocap/xrmocap/data_structure/body_model/smpl_data.py. We have fixed the bug in https://github.com/openxrlab/xrmocap/pull/89.