dylanebert
commited on
Commit
·
167816e
1
Parent(s):
96772ae
update pipeline
Browse files- pipeline.py +3 -12
pipeline.py
CHANGED
|
@@ -2,13 +2,10 @@ from dataclasses import dataclass
|
|
| 2 |
|
| 3 |
import cv2
|
| 4 |
import numpy as np
|
| 5 |
-
import rembg
|
| 6 |
import torch
|
| 7 |
import torch.nn.functional as F
|
| 8 |
from diffusers import DiffusionPipeline
|
| 9 |
from diffusers.utils import BaseOutput
|
| 10 |
-
from PIL import Image
|
| 11 |
-
from torchvision.transforms import v2
|
| 12 |
|
| 13 |
|
| 14 |
def pad_camera_extrinsics_4x4(extrinsics):
|
|
@@ -99,15 +96,9 @@ class InstantMeshPipeline(DiffusionPipeline):
|
|
| 99 |
self.lrm = lrm
|
| 100 |
self.register_modules(lrm=self.lrm)
|
| 101 |
|
| 102 |
-
self.multi_view_diffusion = DiffusionPipeline.from_pretrained(
|
| 103 |
-
"dylanebert/zero123plus-instantmesh",
|
| 104 |
-
custom_pipeline="sudo-ai/zero123plus-pipeline",
|
| 105 |
-
torch_dtype=torch.float16,
|
| 106 |
-
)
|
| 107 |
-
|
| 108 |
@torch.no_grad()
|
| 109 |
-
def __call__(self,
|
| 110 |
-
if remove_bg:
|
| 111 |
image = rembg.remove(image)
|
| 112 |
|
| 113 |
image = np.array(image)
|
|
@@ -156,7 +147,7 @@ class InstantMeshPipeline(DiffusionPipeline):
|
|
| 156 |
images = images.unsqueeze(0)
|
| 157 |
images = v2.functional.resize(
|
| 158 |
images, 320, interpolation=3, antialias=True
|
| 159 |
-
).clamp(0, 1)
|
| 160 |
|
| 161 |
self.lrm.init_flexicubes_geometry(self._execution_device, fovy=30.0)
|
| 162 |
cameras = get_zero123plus_input_cameras().to(self._execution_device)
|
|
|
|
| 2 |
|
| 3 |
import cv2
|
| 4 |
import numpy as np
|
|
|
|
| 5 |
import torch
|
| 6 |
import torch.nn.functional as F
|
| 7 |
from diffusers import DiffusionPipeline
|
| 8 |
from diffusers.utils import BaseOutput
|
|
|
|
|
|
|
| 9 |
|
| 10 |
|
| 11 |
def pad_camera_extrinsics_4x4(extrinsics):
|
|
|
|
| 96 |
self.lrm = lrm
|
| 97 |
self.register_modules(lrm=self.lrm)
|
| 98 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 99 |
@torch.no_grad()
|
| 100 |
+
def __call__(self, images: torch.Tensor):
|
| 101 |
+
"""if remove_bg:
|
| 102 |
image = rembg.remove(image)
|
| 103 |
|
| 104 |
image = np.array(image)
|
|
|
|
| 147 |
images = images.unsqueeze(0)
|
| 148 |
images = v2.functional.resize(
|
| 149 |
images, 320, interpolation=3, antialias=True
|
| 150 |
+
).clamp(0, 1)"""
|
| 151 |
|
| 152 |
self.lrm.init_flexicubes_geometry(self._execution_device, fovy=30.0)
|
| 153 |
cameras = get_zero123plus_input_cameras().to(self._execution_device)
|