JiantaoLin
commited on
Commit
Β·
ca4eb15
1
Parent(s):
a00a59a
new
Browse files
models/ISOMER/scripts/project_mesh.py
CHANGED
@@ -13,6 +13,7 @@ from pytorch3d.renderer import (
|
|
13 |
FoVOrthographicCameras,
|
14 |
)
|
15 |
from pytorch3d.renderer import MeshRasterizer
|
|
|
16 |
|
17 |
def get_camera(world_to_cam, fov_in_degrees=60, focal_length=1 / (2**0.5), cam_type='fov'):
|
18 |
# pytorch3d expects transforms as row-vectors, so flip rotation: https://github.com/facebookresearch/pytorch3d/issues/1183
|
@@ -68,6 +69,7 @@ def _warmup(glctx, device=None):
|
|
68 |
dr.rasterize(glctx, pos, tri, resolution=[256, 256])
|
69 |
|
70 |
class Pix2FacesRenderer:
|
|
|
71 |
def __init__(self, device="cuda"):
|
72 |
# self._glctx = dr.RasterizeGLContext(output_db=False, device=device)
|
73 |
self._glctx = dr.RasterizeCudaContext(device=device)
|
|
|
13 |
FoVOrthographicCameras,
|
14 |
)
|
15 |
from pytorch3d.renderer import MeshRasterizer
|
16 |
+
import spaces
|
17 |
|
18 |
def get_camera(world_to_cam, fov_in_degrees=60, focal_length=1 / (2**0.5), cam_type='fov'):
|
19 |
# pytorch3d expects transforms as row-vectors, so flip rotation: https://github.com/facebookresearch/pytorch3d/issues/1183
|
|
|
69 |
dr.rasterize(glctx, pos, tri, resolution=[256, 256])
|
70 |
|
71 |
class Pix2FacesRenderer:
|
72 |
+
@spaces.GPU
|
73 |
def __init__(self, device="cuda"):
|
74 |
# self._glctx = dr.RasterizeGLContext(output_db=False, device=device)
|
75 |
self._glctx = dr.RasterizeCudaContext(device=device)
|