Spaces:
Running
on
L40S
Running
on
L40S
Upload ./third_party/mesh_baker.py with huggingface_hub
Browse files- third_party/mesh_baker.py +10 -6
third_party/mesh_baker.py
CHANGED
@@ -52,7 +52,7 @@ class MeshBaker:
|
|
52 |
best_aligned_image, best_info = aligned_image, info
|
53 |
if info['mask_iou'] < self.iou_thresh:
|
54 |
break
|
55 |
-
print(f"Best Baking Info:{best_info['mask_iou']}")
|
56 |
best_baking_flag = best_info['mask_iou'] > self.iou_thresh
|
57 |
return best_aligned_image, best_info, best_baking_flag
|
58 |
except Exception as e:
|
@@ -112,19 +112,19 @@ class MeshBaker:
|
|
112 |
print(f"\n Baking view ele_{ele} ...")
|
113 |
|
114 |
if ele == 0:
|
115 |
-
if front == '
|
116 |
aligned_cond, cond_info, _ = self.align_and_check(cond_pil, rendered_views[0], align_times=self.align_times)
|
117 |
if cond_info is None: continue
|
118 |
aligned_cond.convert("RGB").save(save_folder + f'/aligned_cond.jpg')
|
119 |
if front == 'multi-view front view':
|
120 |
aligned_img, info = aligned_cond, cond_info
|
121 |
-
print("Using
|
122 |
|
123 |
-
if front == '
|
124 |
aligned_img, info, _ = self.align_and_check(views[0], rendered_views[0], align_times=self.align_times)
|
125 |
if info is None: continue
|
126 |
aligned_img.save(save_folder + f'/aligned_{ele}.jpg')
|
127 |
-
print("Using
|
128 |
|
129 |
if front == 'auto' and info['mask_iou'] < cond_info['mask_iou']:
|
130 |
print("Auto using Cond Image to bake front view")
|
@@ -133,7 +133,11 @@ class MeshBaker:
|
|
133 |
need_baking = info['mask_iou'] > self.iou_thresh
|
134 |
|
135 |
else:
|
136 |
-
aligned_img, info, need_baking = self.align_and_check(
|
|
|
|
|
|
|
|
|
137 |
if info is None: continue
|
138 |
aligned_img.save(save_folder + f'/aligned_{ele}.jpg')
|
139 |
|
|
|
52 |
best_aligned_image, best_info = aligned_image, info
|
53 |
if info['mask_iou'] < self.iou_thresh:
|
54 |
break
|
55 |
+
# print(f"Best Baking Info:{best_info['mask_iou']}")
|
56 |
best_baking_flag = best_info['mask_iou'] > self.iou_thresh
|
57 |
return best_aligned_image, best_info, best_baking_flag
|
58 |
except Exception as e:
|
|
|
112 |
print(f"\n Baking view ele_{ele} ...")
|
113 |
|
114 |
if ele == 0:
|
115 |
+
if front == 'input image' or front == 'auto':
|
116 |
aligned_cond, cond_info, _ = self.align_and_check(cond_pil, rendered_views[0], align_times=self.align_times)
|
117 |
if cond_info is None: continue
|
118 |
aligned_cond.convert("RGB").save(save_folder + f'/aligned_cond.jpg')
|
119 |
if front == 'multi-view front view':
|
120 |
aligned_img, info = aligned_cond, cond_info
|
121 |
+
print("Using input image to bake front view")
|
122 |
|
123 |
+
if front == 'multi-view front view' or front == 'auto':
|
124 |
aligned_img, info, _ = self.align_and_check(views[0], rendered_views[0], align_times=self.align_times)
|
125 |
if info is None: continue
|
126 |
aligned_img.save(save_folder + f'/aligned_{ele}.jpg')
|
127 |
+
print("Using multi-view front view image to bake front view")
|
128 |
|
129 |
if front == 'auto' and info['mask_iou'] < cond_info['mask_iou']:
|
130 |
print("Auto using Cond Image to bake front view")
|
|
|
133 |
need_baking = info['mask_iou'] > self.iou_thresh
|
134 |
|
135 |
else:
|
136 |
+
aligned_img, info, need_baking = self.align_and_check(
|
137 |
+
views[ele//60],
|
138 |
+
rendered_views[min(ele//60, len(others)-1)],
|
139 |
+
align_times=self.align_times
|
140 |
+
)
|
141 |
if info is None: continue
|
142 |
aligned_img.save(save_folder + f'/aligned_{ele}.jpg')
|
143 |
|