geopavlakos / hamer

HaMeR: Reconstructing Hands in 3D with Transformers
https://geopavlakos.github.io/hamer/
MIT License
326 stars 28 forks source link

Error relates to adjusting the model_cfg.EXTRA.FOCAL_LENGTH from 5000 to 1000 #19

Closed Zi-ang-Cao closed 6 months ago

Zi-ang-Cao commented 7 months ago

Hey authors, Thanks for your excellent job! Based on the discussion here, I tried to change the focal length from 5000 to 1000. As the model_cfg.EXTRA.FOCAL_LENGTH is immutable, I turn to change the source definition of 5000 focal length.

AttributeError: Attempted to set FOCAL_LENGTH to 1000, but CfgNode is immutable

However, after editing two following places, I still can not change the FOCAL_LENGTH from 5000 to 1000.

Besides of those two places, I can not find any other place to change the FOCAL_LENGTH. Hence, what's the official way to do so? Will it require re-training from scratch? And in a high-level view, why you choose f=5000 for the demo?

Zi-ang-Cao commented 7 months ago

To be more specific, I am aware of there is a variable in demo.py called scaled_focal_length and that is mutable. But is this a safe manner to do so?

Before calling cam_crop_to_full() with scaled_focal_length, I found that HAMER.forward_step() has already used the OLD self.cfg.EXTRA.FOCAL_LENGTH in line.

Will this two different focal lengths cause inconsistency error?

linjiangya commented 7 months ago

I think you should change it in model_config.yaml in the checkpoints folder, instead of these two places you pointed out because the model_config.yaml will overwrite them anyway when you load the checkpoints.