Skip to content

Commit

Permalink
mypy fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin de La Gorce committed Oct 23, 2024
1 parent eb62bcb commit bacc11b
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion deodr/differentiable_renderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ def world_to_camera(self, points_3d: np.ndarray) -> np.ndarray:
return points_3d.dot(self.extrinsic[:3, :3].T) + self.extrinsic[:3, 3]

def camera_to_world_mtx_4x4(self) -> np.ndarray:
return np.row_stack(
return np.vstack(
(
np.column_stack((self.extrinsic[:, :3].T, self.get_center())),
np.array((0, 0, 0, 1)),
Expand Down
2 changes: 1 addition & 1 deletion deodr/examples/rgb_image_hand_fitting.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def run(
hand_fitter.reset()

background_color = np.median(
np.row_stack(
np.vstack(
(
hand_image[:10, :10, :].reshape(-1, 3),
hand_image[-10:, :10, :].reshape(-1, 3),
Expand Down
6 changes: 3 additions & 3 deletions deodr/examples/rgb_multiview_hand.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def run(
default_light_ambient = 0.6
# default_light = {'directional':np.array([0.0,0.0,0.0]),'ambient':np.array([0.6])}

euler_init = np.row_stack([np.array([0, yrot, 0]) for yrot in np.linspace(-0.5, 0.5, 3)])
euler_init = np.vstack([np.array([0, yrot, 0]) for yrot in np.linspace(-0.5, 0.5, 3)])

vertices = vertices - np.mean(vertices, axis=0)
t_init = np.array([0, -0.2, 0.2])
Expand Down Expand Up @@ -69,7 +69,7 @@ def run(

hand_image = hand_images[0]
background_color = np.median(
np.row_stack(
np.vstack(
(
hand_image[:10, :10, :].reshape(-1, 3),
hand_image[-10:, :10, :].reshape(-1, 3),
Expand Down Expand Up @@ -97,7 +97,7 @@ def run(
if display or save_images:
combined_image = np.column_stack(
(
np.row_stack(hand_images),
np.vstack(hand_images),
image,
np.tile(np.minimum(diff_image, 1)[:, :, None], (1, 1, 3)),
)
Expand Down
4 changes: 2 additions & 2 deletions deodr/obj.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ def read_obj(filename: str) -> Tuple[np.ndarray, np.ndarray]:
cleaned_fields.append(v)
faces.append(np.array(cleaned_fields))

faces_np = np.row_stack(faces)
vertices_np = np.row_stack(vertices)
faces_np = np.vstack(faces)
vertices_np = np.vstack(vertices)
return faces_np, vertices_np


Expand Down
2 changes: 1 addition & 1 deletion deodr/opengl/moderngl.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def set_texture(self, texture: np.ndarray) -> None:
# texture.build_mipmaps()

def set_camera(self, camera: Camera) -> None:
extrinsic = np.row_stack((camera.extrinsic, [0, 0, 0, 1]))
extrinsic = np.vstack((camera.extrinsic, [0, 0, 0, 1]))

intrinsic = Matrix44(
np.diag([1, -1, -1, 1]).dot(
Expand Down
2 changes: 1 addition & 1 deletion deodr/tensorflow/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@

def scipy_sparse_matrix_to_tensorflow(x: scipy.sparse.spmatrix) -> tf.SparseTensor:
coo = x.tocoo()
indices = np.mat([coo.row, coo.col]).transpose()
indices = np.array([coo.row, coo.col]).transpose()
return tf.SparseTensor(indices, coo.data, coo.shape)
2 changes: 1 addition & 1 deletion deodr/triangulated_mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ def loop_subdivision(mesh: ColoredTriMesh, n_iter: int = 1) -> ColoredTriMesh:
mesh.adjacencies.faces_edges[:, 2] + mesh.nb_vertices,
)
)
new_faces = np.row_stack((faces1, faces2, faces3, faces4))
new_faces = np.vstack((faces1, faces2, faces3, faces4))
if mesh.uv is not None:
raise BaseException("Textured mesh not supported yet in subdivision.")
if mesh.vertices_colors is not None:
Expand Down

0 comments on commit bacc11b

Please sign in to comment.