mirror of
https://github.com/facebookresearch/pytorch3d.git
synced 2025-12-21 14:50:36 +08:00
suppress errors in vision - batch 1
Summary: This diff is auto-generated to upgrade the Pyre version and suppress errors in vision. The upgrade will affect Pyre local configurations in the following directories: ``` vision/ale/search vision/fair/fvcore vision/fair/pytorch3d vision/ocr/rosetta_hash vision/vogue/personalization ``` Differential Revision: D21688454 fbshipit-source-id: 1f3c3fee42b6da2e162fd0932742ab8c5c96aa45
This commit is contained in:
committed by
Facebook GitHub Bot
parent
d689baac5e
commit
ae68a54f67
@@ -51,6 +51,7 @@ def make_mesh_texture_atlas(
|
||||
|
||||
# Initialize the per face texture map to a white color.
|
||||
# TODO: allow customization of this base color?
|
||||
# pyre-fixme[16]: `Tensor` has no attribute `new_ones`.
|
||||
atlas = faces_verts_uvs.new_ones(size=(F, R, R, 3))
|
||||
|
||||
# Check for empty materials.
|
||||
@@ -63,10 +64,13 @@ def make_mesh_texture_atlas(
|
||||
# will be ignored and a repeating pattern is formed.
|
||||
# Shapenet data uses this format see:
|
||||
# https://shapenet.org/qaforum/index.php?qa=15&qa_1=why-is-the-texture-coordinate-in-the-obj-file-not-in-the-range # noqa: B950
|
||||
# pyre-fixme[16]: `ByteTensor` has no attribute `any`.
|
||||
if (faces_verts_uvs > 1).any() or (faces_verts_uvs < 0).any():
|
||||
msg = "Texture UV coordinates outside the range [0, 1]. \
|
||||
The integer part will be ignored to form a repeating pattern."
|
||||
warnings.warn(msg)
|
||||
# pyre-fixme[9]: faces_verts_uvs has type `Tensor`; used as `int`.
|
||||
# pyre-fixme[6]: Expected `int` for 1st param but got `Tensor`.
|
||||
faces_verts_uvs = faces_verts_uvs % 1
|
||||
elif texture_wrap == "clamp":
|
||||
# Clamp uv coordinates to the [0, 1] range.
|
||||
@@ -257,6 +261,7 @@ def make_material_atlas(
|
||||
# Meshgrid returns (row, column) i.e (Y, X)
|
||||
# Change order to (X, Y) to make the grid.
|
||||
Y, X = torch.meshgrid(rng, rng)
|
||||
# pyre-fixme[28]: Unexpected keyword argument `axis`.
|
||||
grid = torch.stack([X, Y], axis=-1) # (R, R, 2)
|
||||
|
||||
# Grid cells below the diagonal: x + y < R.
|
||||
@@ -269,6 +274,7 @@ def make_material_atlas(
|
||||
# w0, w1
|
||||
bary[below_diag, slc] = ((grid[below_diag] + 1.0 / 3.0) / R).T
|
||||
# w0, w1 for above diagonal grid cells.
|
||||
# pyre-fixme[16]: `float` has no attribute `T`.
|
||||
bary[~below_diag, slc] = (((R - 1.0 - grid[~below_diag]) + 2.0 / 3.0) / R).T
|
||||
# w2 = 1. - w0 - w1
|
||||
bary[..., -1] = 1 - bary[..., :2].sum(dim=-1)
|
||||
|
||||
@@ -213,6 +213,8 @@ def load_obj(
|
||||
"""
|
||||
data_dir = "./"
|
||||
if isinstance(f_obj, (str, bytes, os.PathLike)):
|
||||
# pyre-fixme[6]: Expected `_PathLike[Variable[typing.AnyStr <: [str,
|
||||
# bytes]]]` for 1st param but got `Union[_PathLike[typing.Any], bytes, str]`.
|
||||
data_dir = os.path.dirname(f_obj)
|
||||
f_obj, new_f = _open_file(f_obj)
|
||||
try:
|
||||
@@ -453,6 +455,8 @@ def _load(
|
||||
material_colors, texture_images, texture_atlas = None, None, None
|
||||
if load_textures:
|
||||
if (len(material_names) > 0) and (f_mtl is not None):
|
||||
# pyre-fixme[6]: Expected `Union[_PathLike[typing.Any], bytes, str]` for
|
||||
# 1st param but got `Optional[str]`.
|
||||
if os.path.isfile(f_mtl):
|
||||
# Texture mode uv wrap
|
||||
material_colors, texture_images = load_mtl(
|
||||
|
||||
@@ -30,6 +30,8 @@ def _read_image(file_name: str, format=None):
|
||||
if format not in ["RGB", "BGR"]:
|
||||
raise ValueError("format can only be one of [RGB, BGR]; got %s", format)
|
||||
with PathManager.open(file_name, "rb") as f:
|
||||
# pyre-fixme[6]: Expected `Union[str, typing.BinaryIO]` for 1st param but
|
||||
# got `Union[typing.IO[bytes], typing.IO[str]]`.
|
||||
image = Image.open(f)
|
||||
if format is not None:
|
||||
# PIL only supports RGB. First convert to RGB and flip channels
|
||||
|
||||
Reference in New Issue
Block a user