Denys Rozumnyi commited on
Commit ·
f3f7f83
1
Parent(s): 69a9cd6
update
Browse files- geom_solver.py +7 -2
- testing.ipynb +39 -61
geom_solver.py
CHANGED
|
@@ -23,6 +23,7 @@ def cheat_the_metric_solution(vertices=None):
|
|
| 23 |
vertices_new = vertices.mean(0)[None].repeat(nverts, axis=0)
|
| 24 |
all_verts = list(range(nverts))
|
| 25 |
edges = list(itertools.product(all_verts, all_verts))
|
|
|
|
| 26 |
return vertices_new, edges
|
| 27 |
|
| 28 |
|
|
@@ -298,8 +299,12 @@ class GeomSolver(object):
|
|
| 298 |
edges = [(0, 0)]
|
| 299 |
|
| 300 |
if self.cheat_metric:
|
| 301 |
-
|
| 302 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 303 |
if visualize:
|
| 304 |
from hoho.viz3d import plot_estimate_and_gt
|
| 305 |
plot_estimate_and_gt(vertices, [(0,0)], self.human_entry['wf_vertices'], self.human_entry['wf_edges'])
|
|
|
|
| 23 |
vertices_new = vertices.mean(0)[None].repeat(nverts, axis=0)
|
| 24 |
all_verts = list(range(nverts))
|
| 25 |
edges = list(itertools.product(all_verts, all_verts))
|
| 26 |
+
edges = [edg for edg in edges if edg[0] < edg[1]]
|
| 27 |
return vertices_new, edges
|
| 28 |
|
| 29 |
|
|
|
|
| 299 |
edges = [(0, 0)]
|
| 300 |
|
| 301 |
if self.cheat_metric:
|
| 302 |
+
dumb_vertices = np.zeros((vertices.shape[0],3))
|
| 303 |
+
# dumb_vertices = self.wf_center[None].repeat(vertices.shape[0], axis=0)
|
| 304 |
+
vertices, edges = cheat_the_metric_solution(dumb_vertices)
|
| 305 |
+
# vertices_new, edges = cheat_the_metric_solution(np.zeros((vertices.shape[0] // 2,3)))
|
| 306 |
+
# vertices = np.concatenate((vertices_new, vertices[:vertices_new.shape[0]]))
|
| 307 |
+
|
| 308 |
if visualize:
|
| 309 |
from hoho.viz3d import plot_estimate_and_gt
|
| 310 |
plot_estimate_and_gt(vertices, [(0,0)], self.human_entry['wf_vertices'], self.human_entry['wf_edges'])
|
testing.ipynb
CHANGED
|
@@ -179,69 +179,46 @@
|
|
| 179 |
},
|
| 180 |
{
|
| 181 |
"cell_type": "code",
|
| 182 |
-
"execution_count":
|
| 183 |
"id": "88f4fc8f-efa9-404b-9073-c7d4a73f9075",
|
| 184 |
"metadata": {},
|
| 185 |
"outputs": [
|
| 186 |
-
{
|
| 187 |
-
"name": "stderr",
|
| 188 |
-
"output_type": "stream",
|
| 189 |
-
"text": [
|
| 190 |
-
"[autoreload of geom_solver failed: Traceback (most recent call last):\n",
|
| 191 |
-
" File \"/local/home/denysr/anaconda3/envs/pytorch3d/lib/python3.9/site-packages/IPython/extensions/autoreload.py\", line 276, in check\n",
|
| 192 |
-
" superreload(m, reload, self.old_objects)\n",
|
| 193 |
-
" File \"/local/home/denysr/anaconda3/envs/pytorch3d/lib/python3.9/site-packages/IPython/extensions/autoreload.py\", line 475, in superreload\n",
|
| 194 |
-
" module = reload(module)\n",
|
| 195 |
-
" File \"/local/home/denysr/anaconda3/envs/pytorch3d/lib/python3.9/importlib/__init__.py\", line 169, in reload\n",
|
| 196 |
-
" _bootstrap._exec(spec, module)\n",
|
| 197 |
-
" File \"<frozen importlib._bootstrap>\", line 613, in _exec\n",
|
| 198 |
-
" File \"<frozen importlib._bootstrap_external>\", line 846, in exec_module\n",
|
| 199 |
-
" File \"<frozen importlib._bootstrap_external>\", line 983, in get_code\n",
|
| 200 |
-
" File \"<frozen importlib._bootstrap_external>\", line 913, in source_to_code\n",
|
| 201 |
-
" File \"<frozen importlib._bootstrap>\", line 228, in _call_with_frames_removed\n",
|
| 202 |
-
" File \"/local/home/denysr/src/DRAK/geom_solver.py\", line 23\n",
|
| 203 |
-
" \t vertices_new = vertices.mean(0)[None].repeat(nverts, axis=0)\n",
|
| 204 |
-
" \t ^\n",
|
| 205 |
-
"IndentationError: unindent does not match any outer indentation level\n",
|
| 206 |
-
"]\n"
|
| 207 |
-
]
|
| 208 |
-
},
|
| 209 |
{
|
| 210 |
"name": "stdout",
|
| 211 |
"output_type": "stream",
|
| 212 |
"text": [
|
| 213 |
-
"
|
| 214 |
-
"
|
| 215 |
-
"
|
| 216 |
-
"
|
| 217 |
-
"
|
| 218 |
-
"
|
| 219 |
-
"
|
| 220 |
-
"
|
| 221 |
-
"2.
|
| 222 |
-
"1.
|
| 223 |
-
"
|
| 224 |
-
"
|
| 225 |
-
"
|
| 226 |
-
"
|
| 227 |
-
"
|
| 228 |
-
"2.
|
| 229 |
-
"
|
| 230 |
-
"2.
|
| 231 |
-
"
|
| 232 |
-
"
|
| 233 |
-
"
|
| 234 |
-
"2.
|
| 235 |
-
"
|
| 236 |
-
"
|
| 237 |
-
"2.
|
| 238 |
-
"2.
|
| 239 |
-
"
|
| 240 |
-
"
|
| 241 |
-
"
|
| 242 |
-
"
|
| 243 |
"Averages\n",
|
| 244 |
-
"
|
| 245 |
]
|
| 246 |
}
|
| 247 |
],
|
|
@@ -270,10 +247,11 @@
|
|
| 270 |
" nverts = entry['wf_vertices'].shape[0]\n",
|
| 271 |
" nverts = vertices.shape[0]\n",
|
| 272 |
" all_verts = list(range(nverts))\n",
|
| 273 |
-
"
|
|
|
|
| 274 |
" \n",
|
| 275 |
" scores0 = (compute_WED(np.zeros((nverts,3)),\n",
|
| 276 |
-
"
|
| 277 |
" np.array(entry['wf_vertices']),\n",
|
| 278 |
" np.array(entry['wf_edges'])))\n",
|
| 279 |
"\n",
|
|
@@ -306,17 +284,17 @@
|
|
| 306 |
},
|
| 307 |
{
|
| 308 |
"cell_type": "code",
|
| 309 |
-
"execution_count":
|
| 310 |
"id": "a34d0a2b-9986-47cc-8a3f-c15397370c4d",
|
| 311 |
"metadata": {},
|
| 312 |
"outputs": [
|
| 313 |
{
|
| 314 |
"data": {
|
| 315 |
"text/plain": [
|
| 316 |
-
"
|
| 317 |
]
|
| 318 |
},
|
| 319 |
-
"execution_count":
|
| 320 |
"metadata": {},
|
| 321 |
"output_type": "execute_result"
|
| 322 |
}
|
|
@@ -325,7 +303,7 @@
|
|
| 325 |
"# human_entry['images'][1]\n",
|
| 326 |
"# # human_entry['cameras'][1].width\n",
|
| 327 |
"# Image.new('RGB', (human_entry['cameras'][1].width, human_entry['cameras'][1].height)).height\n",
|
| 328 |
-
"
|
| 329 |
]
|
| 330 |
},
|
| 331 |
{
|
|
|
|
| 179 |
},
|
| 180 |
{
|
| 181 |
"cell_type": "code",
|
| 182 |
+
"execution_count": 41,
|
| 183 |
"id": "88f4fc8f-efa9-404b-9073-c7d4a73f9075",
|
| 184 |
"metadata": {},
|
| 185 |
"outputs": [
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 186 |
{
|
| 187 |
"name": "stdout",
|
| 188 |
"output_type": "stream",
|
| 189 |
"text": [
|
| 190 |
+
"2.4474938507570014 2.0380115872555993\n",
|
| 191 |
+
"2.155493663554789 2.0791329825966307\n",
|
| 192 |
+
"2.966738398116498 2.5122864698365484\n",
|
| 193 |
+
"2.3048509249500877 1.6419987209613565\n",
|
| 194 |
+
"2.4392552092630546 1.9072141202952857\n",
|
| 195 |
+
"2.3044038230625525 1.9669375395419233\n",
|
| 196 |
+
"2.046493931546576 1.8261703137595002\n",
|
| 197 |
+
"2.2923488211178036 1.5820313304436742\n",
|
| 198 |
+
"2.6384056810126153 1.9803316094654626\n",
|
| 199 |
+
"1.9408082827536148 2.0591274592222977\n",
|
| 200 |
+
"2.4155485596537 1.8657650987336327\n",
|
| 201 |
+
"2.1617889927813057 1.6349180537901107\n",
|
| 202 |
+
"2.0817899095268078 1.5980454220244267\n",
|
| 203 |
+
"2.4745481682707555 1.961346755339051\n",
|
| 204 |
+
"2.2681739877281197 1.7949245584633193\n",
|
| 205 |
+
"2.6953644761870827 2.5473207425518596\n",
|
| 206 |
+
"2.1795825380975424 1.6773471533492506\n",
|
| 207 |
+
"2.639685047878952 2.55490058167698\n",
|
| 208 |
+
"2.4855541483148036 2.205749686606505\n",
|
| 209 |
+
"2.6783293011691325 1.6157957471412452\n",
|
| 210 |
+
"1.9111219580007248 1.578356057609313\n",
|
| 211 |
+
"2.9007240216586974 2.0007638857204086\n",
|
| 212 |
+
"2.2548770020794224 1.6981983648905474\n",
|
| 213 |
+
"2.220655890771462 1.799613238503135\n",
|
| 214 |
+
"2.5168573984848948 1.7985373057168828\n",
|
| 215 |
+
"2.7875047648676476 2.2261780523874157\n",
|
| 216 |
+
"2.50676648176771 1.5399683606078607\n",
|
| 217 |
+
"2.347918731861892 1.8154885095510576\n",
|
| 218 |
+
"2.4122192669731763 1.6075314439702364\n",
|
| 219 |
+
"2.2224512277919746 2.059612285543195\n",
|
| 220 |
"Averages\n",
|
| 221 |
+
"2.38992514866668 1.905786781251824\n"
|
| 222 |
]
|
| 223 |
}
|
| 224 |
],
|
|
|
|
| 247 |
" nverts = entry['wf_vertices'].shape[0]\n",
|
| 248 |
" nverts = vertices.shape[0]\n",
|
| 249 |
" all_verts = list(range(nverts))\n",
|
| 250 |
+
" edges0 = list(itertools.product(all_verts, all_verts))\n",
|
| 251 |
+
" edges0 = [edg for edg in edges0 if edg[0] < edg[1]]\n",
|
| 252 |
" \n",
|
| 253 |
" scores0 = (compute_WED(np.zeros((nverts,3)),\n",
|
| 254 |
+
" edges,\n",
|
| 255 |
" np.array(entry['wf_vertices']),\n",
|
| 256 |
" np.array(entry['wf_edges'])))\n",
|
| 257 |
"\n",
|
|
|
|
| 284 |
},
|
| 285 |
{
|
| 286 |
"cell_type": "code",
|
| 287 |
+
"execution_count": 28,
|
| 288 |
"id": "a34d0a2b-9986-47cc-8a3f-c15397370c4d",
|
| 289 |
"metadata": {},
|
| 290 |
"outputs": [
|
| 291 |
{
|
| 292 |
"data": {
|
| 293 |
"text/plain": [
|
| 294 |
+
"900"
|
| 295 |
]
|
| 296 |
},
|
| 297 |
+
"execution_count": 28,
|
| 298 |
"metadata": {},
|
| 299 |
"output_type": "execute_result"
|
| 300 |
}
|
|
|
|
| 303 |
"# human_entry['images'][1]\n",
|
| 304 |
"# # human_entry['cameras'][1].width\n",
|
| 305 |
"# Image.new('RGB', (human_entry['cameras'][1].width, human_entry['cameras'][1].height)).height\n",
|
| 306 |
+
"\n"
|
| 307 |
]
|
| 308 |
},
|
| 309 |
{
|