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

Method __init__

pointersect/script/train_v2.py:31–292  ·  view source on GitHub ↗
(
            self,
            ## dataset_info
            dataset_name: str = 'tex',  # name of the dataset to train on, determines which dataset to download
            dataset_root_dir: str = 'datasets/tex-models',  # where the meshes are
            mesh_filename: T.Union[str, T.List[str]] = 'bunny.obj',
            test_mesh_filename: str = 'cat.obj',
            batch_size: int = 2,
            n_target_imgs: int = 2,
            n_imgs: int = 3,
            width_px: int = 200,
            height_px: int = 200,
            target_width_px: int = 20,
            target_height_px: int = 20,
            fov: int = 60.,
            max_angle: float = 30.,
            local_max_angle: float = 3.,
            max_translate_ratio: float = 2.0,  # not used
            ray_perturbation_angle: float = 3,  # not used
            total: int = 10000,
            pcd_subsample: int = 1,  # not used, replaced by min_subsample
            dataset_rng_seed: int = 0,
            k: int = 40,
            randomize_translate: bool = False,
            # not used  # whether translation amount is randomized, see utils.rectify_points
            ray_radius: float = 0.1,  # radius of the ray, used in pr
            num_threads: int = 0,
            train_cam_path_mode: str = 'random',  # not used  # random/circle # support different camera trajectory
            generate_point_cloud_input: bool = False,  # not used
            clean_mesh: bool = True,  # not used  # if true, clean the obj file
            cleaned_root_dir: str = 'datasets/cleaned_models',  # not used  # where the cleaned obj meshes are saved
            skip_existed_cleaned_mesh: bool = False,  # if true, will not clean the obj file again if existed
            render_method: str = 'ray_cast',  # 'ray_cast', 'rasterization'
            min_subsample: int = 1,
            max_subsample: int = 1,  # None: same as min_subsample
            min_k_ratio: float = 1.,
            max_k_ratio: float = 1.,  # None: same as max_k_ratio
            mesh_scale: float = 1.,
            min_r: float = 0.5,
            max_r: float = 3.,
            rand_r: float = 0.,
            texture_mode: str = 'ori',  # 'files', 'imagenet'
            texture_crop_method: T.Union[int, str] = 'ori',  # or an int p indiciating the min p * p crop
            texture_filenames: T.List[str] = None,
            use_bucket_sampler: bool = True,
            mix_meshes: bool = False,
            min_num_mesh: int = 1,
            max_num_mesh: int = 2,
            radius_scale: float = 2.,
            total_combined: int = None,
            ## model_info
            learn_dist: bool = False,
            num_layers: int = 4,  # 4,  # 3,
            dim_feature: int = 512,  # 256,
            num_heads: int = 4,
            encoding_type: str = 'pos',  # pos/ siren  # support different ways of position encoding
            positional_encoding_num_functions: int = 10,  # to turn off position encoding, set to 0
            positional_encoding_include_input: bool = True,
            positional_encoding_log_sampling: bool = True,
            nonlinearity: str = 'silu',
            dim_mlp: int = 512,  # 1024,  # 512,
            dropout: float = 0.1,
            direction_param: str = 'norm_vec',
            estimate_surface_normal_weights: bool = False,
            estimate_image_rendering_weights: bool = True,
            use_rgb_as_input: bool = False,
            use_dist_as_input: bool = False,  # if true, use |x|,|y|,|z| and sqrt(x^2+y^2) in ray space as input
            use_zdir_as_input: bool = False,  # if true, use camera viewing direction (2 vector, 3 dim) as input
            use_dps_as_input: bool = False,  # if true, use local frame width (1 value, 1 dim) as input
            use_dpsuv_as_input: bool = False,  # if true, use local frame (2 vectors, 6 dim) as input
            use_layer_norm: bool = False,  # if true, enable layer norm
            use_pr: bool = False,  # if true, use pr to find neighbor points within a fixed distance to ray
            use_additional_invalid_token: bool = False,  # if true, an extra invalid token will be used in transformer
            dim_input_layers: T.List[int] = None,
            use_vdir_as_input: bool = False,
            use_rgb_indicator: bool = False,  # whether to add a binary indicator saying input has valid rgb
            use_feature_indicator: bool = False,  # whether to add a binary indicator saying input has valid feature
            ## optim_info
            optim_method: str = 'adam',  # 'adam_tf'
            learning_rate: float = 1.0e-4,
            lr_factor: float = 0.1,
            num_warmup_steps: int = 4000,
            max_grad_val: float = 1.0,
            use_amp: bool = False,
            loss_weight_t: float = 10.,
            loss_weight_t_l1: float = 0.,
            loss_weight_normal: float = 1.,
            loss_weight_normal_l1: float = 0.,
            loss_weight_plane_normal: float = 1.,
            loss_weight_plane_normal_l1: float = 0.,
            loss_weight_hit: float = 1.0,
            loss_weight_rgb: float = 1.0,
            loss_weight_rgb_normal: float = 0,
            loss_weight_rgb_normal_dot: float = 0,
            loss_weight_rgb_normal_dot_l1: float = 0,
            loss_rgb_type: str = 'l1',  # 'l2'
            focal_loss_gamma: float = 2.0,
            focal_loss_alpha: float = 0.5,
            learn_ray_rgb: bool = True,
            random_drop_rgb_rate: float = 0,  # probability that the rgb will be randomly dropped
            random_drop_sample_feature_rate: float = 0,  # probability that zdir, dps, dpsuv will be randomly dropped
            pcd_noise_std: float = 0,  # std of the gaussian noise added to the input point cloud
            *args,
            **kwargs,
    )

Source from the content-addressed store, hash-verified

29class TrainPointersectProcess(BaseTrainProcess):
30
31 def __init__(
32 self,
33 ## dataset_info
34 dataset_name: str = 'tex', # name of the dataset to train on, determines which dataset to download
35 dataset_root_dir: str = 'datasets/tex-models', # where the meshes are
36 mesh_filename: T.Union[str, T.List[str]] = 'bunny.obj',
37 test_mesh_filename: str = 'cat.obj',
38 batch_size: int = 2,
39 n_target_imgs: int = 2,
40 n_imgs: int = 3,
41 width_px: int = 200,
42 height_px: int = 200,
43 target_width_px: int = 20,
44 target_height_px: int = 20,
45 fov: int = 60.,
46 max_angle: float = 30.,
47 local_max_angle: float = 3.,
48 max_translate_ratio: float = 2.0, # not used
49 ray_perturbation_angle: float = 3, # not used
50 total: int = 10000,
51 pcd_subsample: int = 1, # not used, replaced by min_subsample
52 dataset_rng_seed: int = 0,
53 k: int = 40,
54 randomize_translate: bool = False,
55 # not used # whether translation amount is randomized, see utils.rectify_points
56 ray_radius: float = 0.1, # radius of the ray, used in pr
57 num_threads: int = 0,
58 train_cam_path_mode: str = 'random', # not used # random/circle # support different camera trajectory
59 generate_point_cloud_input: bool = False, # not used
60 clean_mesh: bool = True, # not used # if true, clean the obj file
61 cleaned_root_dir: str = 'datasets/cleaned_models', # not used # where the cleaned obj meshes are saved
62 skip_existed_cleaned_mesh: bool = False, # if true, will not clean the obj file again if existed
63 render_method: str = 'ray_cast', # 'ray_cast', 'rasterization'
64 min_subsample: int = 1,
65 max_subsample: int = 1, # None: same as min_subsample
66 min_k_ratio: float = 1.,
67 max_k_ratio: float = 1., # None: same as max_k_ratio
68 mesh_scale: float = 1.,
69 min_r: float = 0.5,
70 max_r: float = 3.,
71 rand_r: float = 0.,
72 texture_mode: str = 'ori', # 'files', 'imagenet'
73 texture_crop_method: T.Union[int, str] = 'ori', # or an int p indiciating the min p * p crop
74 texture_filenames: T.List[str] = None,
75 use_bucket_sampler: bool = True,
76 mix_meshes: bool = False,
77 min_num_mesh: int = 1,
78 max_num_mesh: int = 2,
79 radius_scale: float = 2.,
80 total_combined: int = None,
81 ## model_info
82 learn_dist: bool = False,
83 num_layers: int = 4, # 4, # 3,
84 dim_feature: int = 512, # 256,
85 num_heads: int = 4,
86 encoding_type: str = 'pos', # pos/ siren # support different ways of position encoding
87 positional_encoding_num_functions: int = 10, # to turn off position encoding, set to 0
88 positional_encoding_include_input: bool = True,

Callers

nothing calls this directly

Calls 6

_register_outputMethod · 0.95
_register_lossMethod · 0.95
getMethod · 0.80
_register_var_to_saveMethod · 0.80
_register_var_to_loadMethod · 0.80
load_optionsMethod · 0.80

Tested by

no test coverage detected