Update geom_solver.py
Browse files- geom_solver.py +14 -4
geom_solver.py
CHANGED
@@ -8,6 +8,18 @@ import torch
|
|
8 |
from pytorch3d.renderer import PerspectiveCameras
|
9 |
|
10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
class GeomSolver(object):
|
12 |
|
13 |
def __init__(self, entry):
|
@@ -110,11 +122,9 @@ class GeomSolver(object):
|
|
110 |
def get_vertices(self, visualize=False):
|
111 |
if visualize:
|
112 |
from hoho.viz3d import plot_estimate_and_gt
|
113 |
-
plot_estimate_and_gt(self.vertices, [(0,
|
114 |
if self.vertices.shape[0] == 0:
|
115 |
return my_empty_solution()
|
116 |
-
return self.vertices, [(0,
|
117 |
-
|
118 |
-
|
119 |
|
120 |
|
|
|
8 |
from pytorch3d.renderer import PerspectiveCameras
|
9 |
|
10 |
|
11 |
+
def my_empty_solution():
|
12 |
+
'''Return a minimal valid solution, i.e. 2 vertices and 1 edge.'''
|
13 |
+
# return np.zeros((1,3)), [(0, 0)]
|
14 |
+
return np.zeros((17,3)), [(0, 1)]
|
15 |
+
|
16 |
+
|
17 |
+
def mean_solution(pcloud):
|
18 |
+
mean_point = pcloud.mean(axis=0)
|
19 |
+
verts = mean_point.repeat(0, 2)
|
20 |
+
return verts, [(0, 0)]
|
21 |
+
|
22 |
+
|
23 |
class GeomSolver(object):
|
24 |
|
25 |
def __init__(self, entry):
|
|
|
122 |
def get_vertices(self, visualize=False):
|
123 |
if visualize:
|
124 |
from hoho.viz3d import plot_estimate_and_gt
|
125 |
+
plot_estimate_and_gt(self.vertices, [(0,0)], self.human_entry['wf_vertices'], self.human_entry['wf_edges'])
|
126 |
if self.vertices.shape[0] == 0:
|
127 |
return my_empty_solution()
|
128 |
+
return self.vertices, [(0, 0)]
|
|
|
|
|
129 |
|
130 |
|