try
Browse files
gradio_app/custom_models/mvimg_prediction.py
CHANGED
@@ -12,10 +12,10 @@ from scripts.utils import session, simple_preprocess
|
|
12 |
training_config = "gradio_app/custom_models/image2mvimage.yaml"
|
13 |
checkpoint_path = "ckpt/img2mvimg/unet_state_dict.pth"
|
14 |
|
|
|
|
|
|
|
15 |
def predict(img_list: List[Image.Image], guidance_scale=2., **kwargs):
|
16 |
-
trainer, pipeline = load_pipeline(training_config, checkpoint_path)
|
17 |
-
pipeline.enable_model_cpu_offload()
|
18 |
-
|
19 |
if isinstance(img_list, Image.Image):
|
20 |
img_list = [img_list]
|
21 |
img_list = [rgba_to_rgb(i) if i.mode == 'RGBA' else i for i in img_list]
|
|
|
12 |
training_config = "gradio_app/custom_models/image2mvimage.yaml"
|
13 |
checkpoint_path = "ckpt/img2mvimg/unet_state_dict.pth"
|
14 |
|
15 |
+
trainer, pipeline = load_pipeline(training_config, checkpoint_path)
|
16 |
+
pipeline.enable_model_cpu_offload()
|
17 |
+
|
18 |
def predict(img_list: List[Image.Image], guidance_scale=2., **kwargs):
|
|
|
|
|
|
|
19 |
if isinstance(img_list, Image.Image):
|
20 |
img_list = [img_list]
|
21 |
img_list = [rgba_to_rgb(i) if i.mode == 'RGBA' else i for i in img_list]
|
scripts/project_mesh.py
CHANGED
@@ -98,6 +98,7 @@ class Pix2FacesRenderer:
|
|
98 |
pix2faces_renderer = None
|
99 |
|
100 |
def get_visible_faces(meshes: Meshes, cameras: CamerasBase, resolution=1024):
|
|
|
101 |
if pix2faces_renderer is None:
|
102 |
pix2faces_renderer = Pix2FacesRenderer()
|
103 |
# pix_to_face = render_pix2faces_py3d(meshes, cameras, H=resolution, W=resolution)['pix_to_face']
|
|
|
98 |
pix2faces_renderer = None
|
99 |
|
100 |
def get_visible_faces(meshes: Meshes, cameras: CamerasBase, resolution=1024):
|
101 |
+
global pix2faces_renderer
|
102 |
if pix2faces_renderer is None:
|
103 |
pix2faces_renderer = Pix2FacesRenderer()
|
104 |
# pix_to_face = render_pix2faces_py3d(meshes, cameras, H=resolution, W=resolution)['pix_to_face']
|