Skip to content

Commit

Permalink
minor
Browse files Browse the repository at this point in the history
  • Loading branch information
shreyashampali committed Apr 26, 2021
1 parent b6ff3b2 commit 81cb7ce
Show file tree
Hide file tree
Showing 200 changed files with 75 additions and 27 deletions.
37 changes: 23 additions & 14 deletions demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,35 +23,35 @@ def visualize(sceneID, add_objects=True, add_layout=True):
visible=True)
vis.get_render_option().mesh_show_back_face = True

sceneMesh = o3d.io.read_triangle_mesh(join(SCANS_DIR, sceneID, '%s_vh_clean_2.ply' % (sceneID)))
sceneMesh = alignPclMesh(sceneID, sceneMesh)
sceneMeshVert = np.array(sceneMesh.vertices)
trans = np.zeros((3,)) * 1.0
trans[0] = np.max(sceneMeshVert[:, 0]) - np.min(sceneMeshVert[:, 0])

finalMesh = deepcopy(sceneMesh)
layoutObjMeshList = []
if add_objects:
mctsObjs = MCTSObjs(sceneID, FLAGS.shapenet_dir)
if len(mctsObjs.mctsObjList) == 0:
print("WARNING: Objects missing for scene %s" % sceneID)

# Create mesh with Bounding Boxes
lineGeometryList = []
geometryList = []
for obj in mctsObjs.mctsObjList[0:]:
for obj in mctsObjs.mctsObjList:
geometryList.append(obj.transMesh)
col = [0, 0, 1]
lineSets = drawOpen3dCylLines([obj.orientedBB], col)
lineGeometryList.append(lineSets)
finalMesh = deepcopy(mctsObjs.sceneMesh)

for i in range(0, len(geometryList)):
finalMesh += lineGeometryList[i]
finalMesh += mctsObjs.mctsObjList[i].transMesh

objMesh = deepcopy(geometryList[0])
for i in range(1, len(geometryList)):
objMesh += geometryList[i]

layoutObjMeshList = geometryList


sceneMeshVert = np.array(mctsObjs.sceneMesh.vertices)
trans = np.zeros((3,)) * 1.0
trans[0] = np.max(sceneMeshVert[:, 0]) - np.min(sceneMeshVert[:, 0])
vis.add_geometry(mctsObjs.sceneMesh)
vis.add_geometry(objMesh.translate(trans * 1.1))
vis.add_geometry(finalMesh.translate(trans * 1.1 * 2))

if add_layout:
sceneLayoutPath = os.path.join("outputs/scans/", sceneID, 'monte_carlo/FinalLayout.pickle')
if not os.path.isfile(sceneLayoutPath):
Expand All @@ -61,8 +61,17 @@ def visualize(sceneID, add_objects=True, add_layout=True):
layout_struct = pickle.load(f) # type: LayoutStruct

wireframe = LayoutStructVis().get_layout_wireframe(layout_struct.comp_list)
layoutObjMeshList.append(wireframe)
finalMesh += wireframe


vis.add_geometry(wireframe)
vis.add_geometry(sceneMesh)
if len(layoutObjMeshList) > 0:
layoutObjMesh = deepcopy(layoutObjMeshList[0])
for i in range(1, len(layoutObjMeshList)):
layoutObjMesh += layoutObjMeshList[i]
vis.add_geometry(layoutObjMesh.translate(trans * 1.1))
vis.add_geometry(finalMesh.translate(trans * 1.1 * 2))

vis.run()

Expand Down
Binary file added mcss_outputs.zip
Binary file not shown.
Binary file not shown.
18 changes: 18 additions & 0 deletions mcss_outputs/scans/scene0011_00/scene0011_00.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
axisAlignment = -0.996195 0.087156 0.000000 3.881280 -0.087156 -0.996195 0.000000 4.119080 0.000000 0.000000 1.000000 -0.071016 0.000000 0.000000 0.000000 1.000000
colorHeight = 968
colorToDepthExtrinsics = 0.999973 0.006791 0.002776 -0.037886 -0.006767 0.999942 -0.008366 -0.003410 -0.002833 0.008347 0.999961 -0.021924 -0.000000 0.000000 -0.000000 1.000000
colorWidth = 1296
depthHeight = 480
depthWidth = 640
fx_color = 1170.187988
fx_depth = 571.623718
fy_color = 1170.187988
fy_depth = 571.623718
mx_color = 647.750000
mx_depth = 319.500000
my_color = 483.750000
my_depth = 239.500000
numColorFrames = 2374
numDepthFrames = 2374
numIMUmeasurements = 5023
sceneType = Kitchen
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
18 changes: 18 additions & 0 deletions mcss_outputs/scans/scene0645_00/scene0645_00.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
axisAlignment = 0.662620 0.748956 0.000000 -6.217770 -0.748956 0.662620 0.000000 -0.025965 0.000000 0.000000 1.000000 -0.054875 0.000000 0.000000 0.000000 1.000000
colorHeight = 968
colorToDepthExtrinsics = 0.999973 0.006791 0.002776 -0.037886 -0.006767 0.999942 -0.008366 -0.003410 -0.002833 0.008347 0.999961 -0.021924 -0.000000 0.000000 -0.000000 1.000000
colorWidth = 1296
depthHeight = 480
depthWidth = 640
fx_color = 1170.187988
fx_depth = 571.623718
fy_color = 1170.187988
fy_depth = 571.623718
mx_color = 647.750000
mx_depth = 319.500000
my_color = 483.750000
my_depth = 239.500000
numColorFrames = 4503
numDepthFrames = 4503
numIMUmeasurements = 9542
sceneType = Bedroom / Hotel
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
29 changes: 16 additions & 13 deletions monte_carlo_model_search/mc_utilsObjects.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,23 +114,26 @@ def __init__(self, sceneID, SHAPENETCOREV2_DIR):
self.SHAPENETCOREV2_DIR = SHAPENETCOREV2_DIR
mctsPickleFile = join(SCANS_DIR, sceneID, 'monte_carlo', 'FinalCandidates.pickle')

with open(mctsPickleFile, 'rb') as f:
self.candList = pickle.load(f)
if os.path.exists(mctsPickleFile):
with open(mctsPickleFile, 'rb') as f:
self.candList = pickle.load(f)

self.sceneID = sceneID
self.sceneMesh = o3d.io.read_triangle_mesh(join(SCANS_DIR, sceneID, '%s_vh_clean_2.ply' % (sceneID)))
self.sceneMesh = alignPclMesh(sceneID, self.sceneMesh)
self.sceneID = sceneID
self.sceneMesh = o3d.io.read_triangle_mesh(join(SCANS_DIR, sceneID, '%s_vh_clean_2.ply' % (sceneID)))
self.sceneMesh = alignPclMesh(sceneID, self.sceneMesh)

# self.segMeshMinkNyu = o3d.io.read_point_cloud(join(SEGMENTATIONS_DIR, sceneID, '%s_segmented.ply' % (sceneID)))
# self.segMeshMinkNyu = alignPclMesh(sceneID, self.segMeshMinkNyu)
# self.segMeshMinkNyu = o3d.io.read_point_cloud(join(SEGMENTATIONS_DIR, sceneID, '%s_segmented.ply' % (sceneID)))
# self.segMeshMinkNyu = alignPclMesh(sceneID, self.segMeshMinkNyu)

if self.sceneID == 'scene0169_00' and False:
segmentPclCols = np.array(self.segMeshMinkNyu.colors)
segmentPclCols[
np.round(segmentPclCols[:, 0] * 255) == nyuName2ID['cabinet']] = nyuName2ID['table'] / 255.
self.segMeshMinkNyu.colors = o3d.utility.Vector3dVector(segmentPclCols)
if self.sceneID == 'scene0169_00' and False:
segmentPclCols = np.array(self.segMeshMinkNyu.colors)
segmentPclCols[
np.round(segmentPclCols[:, 0] * 255) == nyuName2ID['cabinet']] = nyuName2ID['table'] / 255.
self.segMeshMinkNyu.colors = o3d.utility.Vector3dVector(segmentPclCols)

self.mctsObjList = self.getMCTSObjs()
self.mctsObjList = self.getMCTSObjs()
else:
self.mctsObjList = []

def getMCTSObjs(self):
# all objects are in axis aligned coordinate system
Expand Down

0 comments on commit 81cb7ce

Please sign in to comment.