MCPcopy Index your code
hub / github.com/apple/ml-pointersect / __init__

Method __init__

pointersect/inference/structures.py:3661–3766  ·  view source on GitHub ↗

Args: mode: n_imgs: number of cameras in a set total: total number of sets rng_seed: random seed params: parameters for the mode

(
            self,
            mode: str,
            n_imgs: int,
            total: int,
            rng_seed: T.Union[np.random.RandomState, int] = 0,
            params: T.Dict[str, T.Any] = None,
            dtype: np.dtype = np.float32,
    )

Source from the content-addressed store, hash-verified

3659 """
3660
3661 def __init__(
3662 self,
3663 mode: str,
3664 n_imgs: int,
3665 total: int,
3666 rng_seed: T.Union[np.random.RandomState, int] = 0,
3667 params: T.Dict[str, T.Any] = None,
3668 dtype: np.dtype = np.float32,
3669 ):
3670 """
3671 Args:
3672 mode:
3673
3674 n_imgs:
3675 number of cameras in a set
3676 total:
3677 total number of sets
3678 rng_seed:
3679 random seed
3680 params:
3681 parameters for the mode
3682 """
3683 self.mode = mode
3684 self.n_imgs = n_imgs
3685 self.total = total
3686 self.np_dtype = sample_utils.get_np_dtype(dtype)
3687 self.torch_dtype = sample_utils.get_torch_dtype(dtype)
3688
3689 if rng_seed is not None:
3690 if isinstance(rng_seed, int):
3691 self.rng = np.random.RandomState(seed=rng_seed)
3692 elif isinstance(rng_seed, np.random.RandomState):
3693 self.rng = rng_seed
3694 else:
3695 self.rng = rng_seed
3696 else:
3697 self.rng = np.random
3698
3699 if params is None:
3700 params = dict()
3701
3702 self.params = params
3703
3704 if self.mode == 'assign':
3705 assert self.params.get('H_c2w', None) is not None
3706 H_c2w = self.params['H_c2w']
3707 if H_c2w.ndim == 3:
3708 self.n_imgs = H_c2w.size(0)
3709 self.cam_poses = H_c2w
3710 elif H_c2w.ndim == 4:
3711 self.n_imgs = H_c2w.size(1)
3712 self.total = H_c2w.size(0)
3713 self.cam_poses = H_c2w
3714 else:
3715 raise NotImplementedError
3716 elif self.mode == 'random':
3717 # within random camera in a random cone
3718 self._set_random()

Callers

nothing calls this directly

Calls 13

_set_randomMethod · 0.95
_set_circleMethod · 0.95
_set_udlrfbMethod · 0.95
_set_spiralMethod · 0.95
_set_manualMethod · 0.95
load_state_dictMethod · 0.95
uniformly_sampleMethod · 0.95
CameraClass · 0.85
getMethod · 0.80
sizeMethod · 0.80
loadMethod · 0.80
deviceMethod · 0.80

Tested by

no test coverage detected