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

Class SimplePointersect

pointersect/models/pointersect.py:16–543  ·  view source on GitHub ↗

This is just a simple transformer with a learned token whose output token is used to infer t and surface normal.

Source from the content-addressed store, hash-verified

14
15
16class SimplePointersect(torch.nn.Module):
17 """
18 This is just a simple transformer with a learned token whose
19 output token is used to infer t and surface normal.
20 """
21
22 def __init__(
23 self,
24 learn_dist: bool,
25 num_layers: int,
26 dim_feature: int,
27 num_heads: int,
28 positional_encoding_num_functions: int,
29 positional_encoding_include_input: bool,
30 positional_encoding_log_sampling: bool,
31 nonlinearity: str,
32 dim_mlp: int,
33 encoding_type: str = 'pos', # currently only support classic positional encoding
34 dropout: float = 0.1,
35 direction_param: str = 'norm_vec', # 'theta_phi'
36 estimate_surface_normal_weights: bool = True,
37 estimate_image_rendering_weights: bool = False,
38 use_layer_norm: bool = False,
39 dim_point_feature: int = 0, # additional feature description of points (other than xyz)
40 use_rgb_as_input: bool = False,
41 use_dist_as_input: bool = False, # if true, use |x|,|y|,|z| and sqrt(x^2+y^2) in ray space as input
42 use_zdir_as_input: bool = False, # if true, use camera viewing direction (2 vector, 3 dim) as input
43 use_dps_as_input: bool = False, # if true, use local frame width (1 value, 1 dim) as input
44 use_dpsuv_as_input: bool = False, # if true, use local frame (2 vectors, 6 dim) as input
45 use_pr: bool = False, # if true, learn a token to replace invalid input
46 use_additional_invalid_token: bool = False, # if true, an invalid_token is added as a k+1 th input
47 dim_input_layers: T.List[int] = None, # dimension of the linear layers (nLayer-1)
48 use_vdir_as_input: bool = False, # if true, use camera viewing direction (1 vector, 3 dim) as input
49 use_rgb_indicator: bool = False, # whether to add a binary indicator saying input has valid rgb
50 use_feature_indicator: bool = False, # whether to add a binary indicator saying input has valid feature
51 weight_layer_type: str = 'multihead',
52 # 'multihead' or 'dot_prod', the layer type at the end to compute the combination weights
53 ):
54 super().__init__()
55
56 self.learn_dist = learn_dist
57 self.num_layers = num_layers
58 self.dim_feature = dim_feature
59 self.num_heads = num_heads
60 self.encoding_type = encoding_type
61 self.positional_encoding_num_functions = positional_encoding_num_functions
62 self.positional_encoding_include_input = positional_encoding_include_input
63 self.positional_encoding_log_sampling = positional_encoding_log_sampling
64 self.nonlinearity = nonlinearity
65 self.dim_mlp = dim_mlp
66 self.direction_param = direction_param
67 self.estimate_surface_normal_weights = estimate_surface_normal_weights
68 self.estimate_image_rendering_weights = estimate_image_rendering_weights
69 self.use_layer_norm = use_layer_norm
70 self.dim_point_feature = dim_point_feature
71 self.use_rgb_as_input = use_rgb_as_input
72 self.use_dist_as_input = use_dist_as_input
73 self.use_zdir_as_input = use_zdir_as_input

Callers 1

testMethod · 0.90

Calls

no outgoing calls

Tested by 1

testMethod · 0.72