Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
shreyashampali committed Apr 19, 2021
1 parent 189392f commit b88e269
Show file tree
Hide file tree
Showing 14 changed files with 2,278 additions and 0 deletions.
135 changes: 135 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
.python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

.idea
outputs/*
teaser_gen.py
*.npy

Binary file added assets/mcss_teaser1.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/mcss_teaser2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/vis.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
70 changes: 70 additions & 0 deletions demo.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
from monte_carlo_model_search.mc_utilsObjects import *
from utils import downloadScanNetScene
from copy import deepcopy
import random

from absl import flags
from absl import app
FLAGS = flags.FLAGS

flags.DEFINE_string('scene', 'scene0000_00', 'scene ID')
flags.DEFINE_string('shapenet_dir', '/media/shreyas/4aa82be1-14a8-47f7-93a7-171e3ebac2b0/Datasets/ShapeNetCore.v2', 'shapenet dir')

def visualize(sceneID):

mctsObjs = MCTSObjs(sceneID, FLAGS.shapenet_dir)

# Create mesh with Bounding Boxes
lineGeometryList = []
geometryList = []
for obj in mctsObjs.mctsObjList[0:]:
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]

# Visualize
vis = o3d.visualization.Visualizer()
vis.create_window(window_name='Open3D', width=640, height=480, left=0, top=0,
visible=True)
vis.get_render_option().mesh_show_back_face = True

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))

vis.run()


def main(argv):
if FLAGS.scene == 'scene0000_00':

with open('scannetv2_val.txt', 'r') as f:
sceneIDs = f.readlines()
sceneIDs = [s.strip() for s in sceneIDs if ('_00' in s)]
sceneIDs = [s for s in sceneIDs if os.path.exists(os.path.join(SCANS_DIR, s, 'monte_carlo', 'FinalCandidates.pickle'))]
else:
sceneIDs = [FLAGS.scene]

while (True):
sceneID = random.choice(sceneIDs)
downloadScanNetScene(sceneID)
visualize(sceneID)




if __name__ == '__main__':
app.run(main)
Loading

0 comments on commit b88e269

Please sign in to comment.