MCPcopy
hub / github.com/zju3dv/4K4D / __init__

Method __init__

easyvolcap/models/cameras/optimizable_camera.py:61–96  ·  view source on GitHub ↗
(self,
                 n_views: int = n_views,
                 n_frames: int = n_frames,
                 moves_through_time: bool = moves_through_time,
                 pretrained_camera: str = '',
                 freeze_camera: bool = False,
                 freeze_extri: bool = False,
                 freeze_intri: bool = False,
                 focal_limit: float = 10.0,
                 shift_limit: float = 0.05,  # extremely unstable
                 dtype: str = 'float',
                 **kwargs,
                 )

Source from the content-addressed store, hash-verified

59 moves_through_time = not exists(join(data_root, intri_file)) or not exists(join(data_root, extri_file))
60
61 def __init__(self,
62 n_views: int = n_views,
63 n_frames: int = n_frames,
64 moves_through_time: bool = moves_through_time,
65 pretrained_camera: str = '',
66 freeze_camera: bool = False,
67 freeze_extri: bool = False,
68 freeze_intri: bool = False,
69 focal_limit: float = 10.0,
70 shift_limit: float = 0.05, # extremely unstable
71 dtype: str = 'float',
72 **kwargs,
73 ):
74 super().__init__()
75 self.n_views = n_views
76 self.n_frames = n_frames if moves_through_time else 1
77 self.dtype = getattr(torch, dtype) if isinstance(dtype, str) else dtype
78
79 self.extri_resd = make_params(torch.zeros(self.n_frames, self.n_views, 6, dtype=self.dtype)) # F, V, 6
80 self.intri_resd = make_params(torch.zeros(self.n_frames, self.n_views, 4, dtype=self.dtype)) # F, V, 4
81 self.focal_limit = focal_limit
82 self.shift_limit = shift_limit
83
84 if exists(pretrained_camera):
85 load_network(self, pretrained_camera, prefix='camera.') # will load some of the parameters from this model
86
87 if freeze_camera:
88 freeze_module(self)
89
90 if freeze_extri:
91 self.extri_resd.requires_grad_(False)
92
93 if freeze_intri:
94 self.intri_resd.requires_grad_(False)
95
96 self.pre_handle = self._register_load_state_dict_pre_hook(self._load_state_dict_pre_hook)
97
98 def _load_state_dict_pre_hook(self, state_dict, prefix, local_metadata, strict, missing_keys, unexpected_keys, error_msgs):
99

Callers

nothing calls this directly

Calls 4

make_paramsFunction · 0.90
load_networkFunction · 0.90
freeze_moduleFunction · 0.90
existsFunction · 0.85

Tested by

no test coverage detected