MCPcopy Create free account
hub / github.com/MotrixLab/AiOS / get_camera_param

Method get_camera_param

detrsmpl/models/heads/expose_head.py:242–262  ·  view source on GitHub ↗

Build camera param.

(self, camera_cfg)

Source from the content-addressed store, hash-verified

240 return start, mean_lst
241
242 def get_camera_param(self, camera_cfg):
243 """Build camera param."""
244 camera_pos_scale = camera_cfg.get('pos_func')
245 if camera_pos_scale == 'softplus':
246 camera_scale_func = F.softplus
247 elif camera_pos_scale == 'exp':
248 camera_scale_func = torch.exp
249 elif camera_pos_scale == 'none' or camera_pos_scale == 'None':
250
251 def func(x):
252 return x
253
254 camera_scale_func = func
255 mean_scale = camera_cfg.get('mean_scale', 0.9)
256 if camera_pos_scale == 'softplus':
257 mean_scale = np.log(np.exp(mean_scale) - 1)
258 elif camera_pos_scale == 'exp':
259 mean_scale = np.log(mean_scale)
260 camera_mean = torch.tensor([mean_scale, 0.0, 0.0], dtype=torch.float32)
261 camera_param_dim = 3
262 return camera_mean, camera_param_dim, camera_scale_func
263
264 def flat_params_to_dict(self, param_tensor):
265 """Turn param tensors to dict."""

Callers 3

__init__Method · 0.80
__init__Method · 0.80
__init__Method · 0.80

Calls 1

getMethod · 0.45

Tested by

no test coverage detected