Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KeyError: 'scaled_focal_length is not a file in the archive' in 4.Transfer SMPL step #105

Open
lognat0704 opened this issue May 2, 2024 · 3 comments

Comments

@lognat0704
Copy link

Hi I follow the instruction trying to build up my own motion data. In the 4.Transfer SMPL step. I encounter the following error:

CACHE_DIR_4DHUMANS: /home/nelson/.cache/4DHumans
Lightning automatically upgraded your loaded checkpoint from v1.8.1 to v2.2.2. To apply the upgrade to your files permanently, run `python -m pytorch_lightning.utilities.upgrade_checkpoint ../.cache/4DHumans/logs/train/multiruns/hmr2/0/checkpoints/epoch=35-step=1000000.ckpt`
WARNING: You are using a SMPL model, with only 10 shape coefficients.
['images', 'smpl_results']
Traceback (most recent call last):
  File "/opt/conda/envs/champ/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/opt/conda/envs/champ/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/home/nelson/champ/scripts/data_processors/smpl/smpl_transfer.py", line 103, in <module>
    zip(result_dict_list["smpl"], result_dict_list["camera"], result_dict_list["scaled_focal_length"], driving_paths)
  File "/opt/conda/envs/champ/lib/python3.10/site-packages/numpy/lib/npyio.py", line 260, in __getitem__
    raise KeyError("%s is not a file in the archive" % key)
KeyError: 'scaled_focal_length is not a file in the archive'

How do I solve the issue?

@TianQi-777
Copy link

TianQi-777 commented May 6, 2024

Same problem. Try the following changes.

old

if os.path.exists(group_smpl_path):
    result_dict_list = np.load(group_smpl_path, allow_pickle=True)
    result_dict_first = np.load(driving_paths[0], allow_pickle=True).item()
    i = 0
    for smpl_outs, cam_t, foc_len, file_path in tqdm(
        zip(result_dict_list["smpl"], result_dict_list["camera"], result_dict_list["scaled_focal_length"], driving_paths)
    ):
        img_fn, _ = os.path.splitext(os.path.basename(file_path))
        result_dict = {key: value for key, value in result_dict_first.items()}
        result_dict["smpls"] = smpl_outs
        result_dict["cam_t"] = cam_t
        result_dict["scaled_focal_length"] = foc_len
        if args.view_transfer:
            scaled_focal_length = reference_dict["scaled_focal_length"]
            result_dict["cam_t"] = reference_dict["cam_t"]
            result_dict["scaled_focal_length"] = scaled_focal_length

new

if os.path.exists(group_smpl_path):
    result_dict_list = np.load(group_smpl_path, allow_pickle=True)
    result_dict_first = np.load(driving_paths[0], allow_pickle=True).item()
    i = 0
    for smpl_outs, cam_t, file_path in tqdm(
        zip(result_dict_list["smpl"], result_dict_list["camera"], driving_paths)
    ):
        img_fn, _ = os.path.splitext(os.path.basename(file_path))
        result_dict = {key: value for key, value in result_dict_first.items()}
        result_dict["smpls"] = smpl_outs
        result_dict["cam_t"] = cam_t
        if args.view_transfer:
            scaled_focal_length = reference_dict["scaled_focal_length"]
            result_dict["cam_t"] = reference_dict["cam_t"]
            result_dict["scaled_focal_length"] = scaled_focal_length

@subazinga
Copy link
Contributor

It's a bug. We will fix it in the following couple of days.

@faiimea
Copy link
Contributor

faiimea commented May 8, 2024

for smpl_outs, cam_t, file_path in tqdm(
zip(result_dict_list["smpl"], result_dict_list["camera"], driving_paths)
):
img_fn, _ = os.path.splitext(os.path.basename(file_path))
result_dict = {key: value for key, value in result_dict_first.items()}
result_dict["smpls"] = smpl_outs
result_dict["cam_t"] = cam_t
if args.view_transfer:
scaled_focal_length = reference_dict["scaled_focal_length"]
result_dict["cam_t"] = reference_dict["cam_t"]
result_dict["scaled_focal_length"] = scaled_focal_length

It works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants