champ
champ copied to clipboard
KeyError: 'scaled_focal_length is not a file in the archive' in 4.Transfer SMPL step
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?
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
It's a bug. We will fix it in the following couple of days.
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.