mirror of
https://github.com/facebookresearch/pytorch3d.git
synced 2025-08-02 20:02:49 +08:00
Add annotations to vision/fair/pytorch3d
Reviewed By: shannonzhu Differential Revision: D35513897 fbshipit-source-id: 1ca12671df1bd6608a7dce9193c145d5985c0b45
This commit is contained in:
parent
3809b6094c
commit
4b94649f7b
@ -219,7 +219,7 @@ def _sample_network(
|
|||||||
surface_dists,
|
surface_dists,
|
||||||
surface_cam_loc,
|
surface_cam_loc,
|
||||||
surface_ray_dirs,
|
surface_ray_dirs,
|
||||||
eps=1e-4,
|
eps: float = 1e-4,
|
||||||
):
|
):
|
||||||
# t -> t(theta)
|
# t -> t(theta)
|
||||||
surface_ray_dirs_0 = surface_ray_dirs.detach()
|
surface_ray_dirs_0 = surface_ray_dirs.detach()
|
||||||
|
@ -412,7 +412,7 @@ class AngleWeightedIdentityFeatureAggregator(torch.nn.Module, FeatureAggregatorB
|
|||||||
def _get_reduction_aggregator_feature_dim(
|
def _get_reduction_aggregator_feature_dim(
|
||||||
feats_or_feats_dim: Union[Dict[str, torch.Tensor], int],
|
feats_or_feats_dim: Union[Dict[str, torch.Tensor], int],
|
||||||
reduction_functions: Sequence[ReductionFunction],
|
reduction_functions: Sequence[ReductionFunction],
|
||||||
):
|
) -> int:
|
||||||
if isinstance(feats_or_feats_dim, int):
|
if isinstance(feats_or_feats_dim, int):
|
||||||
feat_dim = feats_or_feats_dim
|
feat_dim = feats_or_feats_dim
|
||||||
else:
|
else:
|
||||||
|
@ -167,7 +167,7 @@ def estimate_pointcloud_local_coord_frames(
|
|||||||
return curvatures, local_coord_frames
|
return curvatures, local_coord_frames
|
||||||
|
|
||||||
|
|
||||||
def _disambiguate_vector_directions(pcl, knns, vecs):
|
def _disambiguate_vector_directions(pcl, knns, vecs: float) -> float:
|
||||||
"""
|
"""
|
||||||
Disambiguates normal directions according to [1].
|
Disambiguates normal directions according to [1].
|
||||||
|
|
||||||
@ -181,6 +181,7 @@ def _disambiguate_vector_directions(pcl, knns, vecs):
|
|||||||
# each element of the neighborhood
|
# each element of the neighborhood
|
||||||
df = knns - pcl[:, :, None]
|
df = knns - pcl[:, :, None]
|
||||||
# projection of the difference on the principal direction
|
# projection of the difference on the principal direction
|
||||||
|
# pyre-fixme[16]: `float` has no attribute `__getitem__`.
|
||||||
proj = (vecs[:, :, None] * df).sum(3)
|
proj = (vecs[:, :, None] * df).sum(3)
|
||||||
# check how many projections are positive
|
# check how many projections are positive
|
||||||
n_pos = (proj > 0).type_as(knns).sum(2, keepdim=True)
|
n_pos = (proj > 0).type_as(knns).sum(2, keepdim=True)
|
||||||
|
@ -400,7 +400,7 @@ def create_verts_index(verts_per_mesh, edges_per_mesh, device=None):
|
|||||||
return verts_idx
|
return verts_idx
|
||||||
|
|
||||||
|
|
||||||
def create_faces_index(faces_per_mesh, device=None):
|
def create_faces_index(faces_per_mesh: int, device=None):
|
||||||
"""
|
"""
|
||||||
Helper function to group the faces indices for each mesh. New faces are
|
Helper function to group the faces indices for each mesh. New faces are
|
||||||
stacked at the end of the original faces tensor, so in order to have
|
stacked at the end of the original faces tensor, so in order to have
|
||||||
@ -417,7 +417,9 @@ def create_faces_index(faces_per_mesh, device=None):
|
|||||||
"""
|
"""
|
||||||
# e.g. faces_per_mesh = [2, 5, 3]
|
# e.g. faces_per_mesh = [2, 5, 3]
|
||||||
|
|
||||||
|
# pyre-fixme[16]: `int` has no attribute `sum`.
|
||||||
F = faces_per_mesh.sum() # e.g. 10
|
F = faces_per_mesh.sum() # e.g. 10
|
||||||
|
# pyre-fixme[16]: `int` has no attribute `cumsum`.
|
||||||
faces_per_mesh_cumsum = faces_per_mesh.cumsum(dim=0) # (N,) e.g. (2, 7, 10)
|
faces_per_mesh_cumsum = faces_per_mesh.cumsum(dim=0) # (N,) e.g. (2, 7, 10)
|
||||||
|
|
||||||
switch1_idx = faces_per_mesh_cumsum.clone()
|
switch1_idx = faces_per_mesh_cumsum.clone()
|
||||||
|
@ -427,10 +427,10 @@ class CamerasBase(TensorProperties):
|
|||||||
|
|
||||||
|
|
||||||
def OpenGLPerspectiveCameras(
|
def OpenGLPerspectiveCameras(
|
||||||
znear=1.0,
|
znear: float = 1.0,
|
||||||
zfar=100.0,
|
zfar: float = 100.0,
|
||||||
aspect_ratio=1.0,
|
aspect_ratio: float = 1.0,
|
||||||
fov=60.0,
|
fov: float = 60.0,
|
||||||
degrees: bool = True,
|
degrees: bool = True,
|
||||||
R: torch.Tensor = _R,
|
R: torch.Tensor = _R,
|
||||||
T: torch.Tensor = _T,
|
T: torch.Tensor = _T,
|
||||||
@ -709,12 +709,12 @@ class FoVPerspectiveCameras(CamerasBase):
|
|||||||
|
|
||||||
|
|
||||||
def OpenGLOrthographicCameras(
|
def OpenGLOrthographicCameras(
|
||||||
znear=1.0,
|
znear: float = 1.0,
|
||||||
zfar=100.0,
|
zfar: float = 100.0,
|
||||||
top=1.0,
|
top: float = 1.0,
|
||||||
bottom=-1.0,
|
bottom: float = -1.0,
|
||||||
left=-1.0,
|
left: float = -1.0,
|
||||||
right=1.0,
|
right: float = 1.0,
|
||||||
scale_xyz=((1.0, 1.0, 1.0),), # (1, 3)
|
scale_xyz=((1.0, 1.0, 1.0),), # (1, 3)
|
||||||
R: torch.Tensor = _R,
|
R: torch.Tensor = _R,
|
||||||
T: torch.Tensor = _T,
|
T: torch.Tensor = _T,
|
||||||
@ -956,7 +956,7 @@ Note that the MultiView Cameras accept parameters in NDC space.
|
|||||||
|
|
||||||
|
|
||||||
def SfMPerspectiveCameras(
|
def SfMPerspectiveCameras(
|
||||||
focal_length=1.0,
|
focal_length: float = 1.0,
|
||||||
principal_point=((0.0, 0.0),),
|
principal_point=((0.0, 0.0),),
|
||||||
R: torch.Tensor = _R,
|
R: torch.Tensor = _R,
|
||||||
T: torch.Tensor = _T,
|
T: torch.Tensor = _T,
|
||||||
@ -1194,7 +1194,7 @@ class PerspectiveCameras(CamerasBase):
|
|||||||
|
|
||||||
|
|
||||||
def SfMOrthographicCameras(
|
def SfMOrthographicCameras(
|
||||||
focal_length=1.0,
|
focal_length: float = 1.0,
|
||||||
principal_point=((0.0, 0.0),),
|
principal_point=((0.0, 0.0),),
|
||||||
R: torch.Tensor = _R,
|
R: torch.Tensor = _R,
|
||||||
T: torch.Tensor = _T,
|
T: torch.Tensor = _T,
|
||||||
@ -1645,9 +1645,9 @@ def look_at_rotation(
|
|||||||
|
|
||||||
|
|
||||||
def look_at_view_transform(
|
def look_at_view_transform(
|
||||||
dist=1.0,
|
dist: float = 1.0,
|
||||||
elev=0.0,
|
elev: float = 0.0,
|
||||||
azim=0.0,
|
azim: float = 0.0,
|
||||||
degrees: bool = True,
|
degrees: bool = True,
|
||||||
eye: Optional[Union[Sequence, torch.Tensor]] = None,
|
eye: Optional[Union[Sequence, torch.Tensor]] = None,
|
||||||
at=((0, 0, 0),), # (1, 3)
|
at=((0, 0, 0),), # (1, 3)
|
||||||
|
@ -65,7 +65,7 @@ def texturesuv_image_PIL(
|
|||||||
*,
|
*,
|
||||||
texture_index: int = 0,
|
texture_index: int = 0,
|
||||||
radius: float = 1,
|
radius: float = 1,
|
||||||
color="red",
|
color: str = "red",
|
||||||
subsample: Optional[int] = 10000,
|
subsample: Optional[int] = 10000,
|
||||||
): # pragma: no cover
|
): # pragma: no cover
|
||||||
"""
|
"""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user