jadechoghari
commited on
Commit
•
4dbdea8
1
Parent(s):
351d27a
Update processor.py
Browse files- processor.py +0 -7
processor.py
CHANGED
@@ -19,9 +19,7 @@ import kiui
|
|
19 |
|
20 |
class LRMImageProcessor(BaseImageProcessorFast):
|
21 |
def __init__(self, source_size=512, *args, **kwargs):
|
22 |
-
print("add super")
|
23 |
super().__init__(*args, **kwargs)
|
24 |
-
print("Add source")
|
25 |
self.source_size = source_size
|
26 |
self.session = None
|
27 |
self.rembg_remove = None
|
@@ -54,7 +52,6 @@ class LRMImageProcessor(BaseImageProcessorFast):
|
|
54 |
return fx, fy, cx, cy
|
55 |
|
56 |
def build_camera_principle(self, RT: torch.Tensor, intrinsics: torch.Tensor):
|
57 |
-
print("build_camera_principle")
|
58 |
fx, fy, cx, cy = self.get_normalized_camera_intrinsics(intrinsics)
|
59 |
return torch.cat([
|
60 |
RT.reshape(-1, 12),
|
@@ -65,7 +62,6 @@ class LRMImageProcessor(BaseImageProcessorFast):
|
|
65 |
], dim=-1)
|
66 |
|
67 |
def _default_intrinsics(self):
|
68 |
-
print("_default_intrinsics")
|
69 |
fx = fy = 384
|
70 |
cx = cy = 256
|
71 |
w = h = 512
|
@@ -77,7 +73,6 @@ class LRMImageProcessor(BaseImageProcessorFast):
|
|
77 |
return intrinsics
|
78 |
|
79 |
def _default_source_camera(self, batch_size: int = 1):
|
80 |
-
print("_default_source_camera")
|
81 |
dist_to_center = 1.5
|
82 |
canonical_camera_extrinsics = torch.tensor([[
|
83 |
[0, 0, 1, 1],
|
@@ -89,8 +84,6 @@ class LRMImageProcessor(BaseImageProcessorFast):
|
|
89 |
return source_camera.repeat(batch_size, 1)
|
90 |
|
91 |
def __call__(self, image, *args, **kwargs):
|
92 |
-
print("processing...")
|
93 |
processed_image = self.preprocess_image(image)
|
94 |
-
print("processed done")
|
95 |
source_camera = self._default_source_camera(batch_size=1)
|
96 |
return processed_image, source_camera
|
|
|
19 |
|
20 |
class LRMImageProcessor(BaseImageProcessorFast):
|
21 |
def __init__(self, source_size=512, *args, **kwargs):
|
|
|
22 |
super().__init__(*args, **kwargs)
|
|
|
23 |
self.source_size = source_size
|
24 |
self.session = None
|
25 |
self.rembg_remove = None
|
|
|
52 |
return fx, fy, cx, cy
|
53 |
|
54 |
def build_camera_principle(self, RT: torch.Tensor, intrinsics: torch.Tensor):
|
|
|
55 |
fx, fy, cx, cy = self.get_normalized_camera_intrinsics(intrinsics)
|
56 |
return torch.cat([
|
57 |
RT.reshape(-1, 12),
|
|
|
62 |
], dim=-1)
|
63 |
|
64 |
def _default_intrinsics(self):
|
|
|
65 |
fx = fy = 384
|
66 |
cx = cy = 256
|
67 |
w = h = 512
|
|
|
73 |
return intrinsics
|
74 |
|
75 |
def _default_source_camera(self, batch_size: int = 1):
|
|
|
76 |
dist_to_center = 1.5
|
77 |
canonical_camera_extrinsics = torch.tensor([[
|
78 |
[0, 0, 1, 1],
|
|
|
84 |
return source_camera.repeat(batch_size, 1)
|
85 |
|
86 |
def __call__(self, image, *args, **kwargs):
|
|
|
87 |
processed_image = self.preprocess_image(image)
|
|
|
88 |
source_camera = self._default_source_camera(batch_size=1)
|
89 |
return processed_image, source_camera
|