Walking distance to the nearest exit, from a scan
A classified S3DIS office floor becomes a walking-distance map to the nearest of eight exits, an escape route per room, the dead-end corridors, and a block-an-exit what-if that re-solves the floor in tens of milliseconds. Multi-source Dijkstra over 16 moves, on a CPU.
The code
Public, no email needed. Read it, fork it, run it, break it.
evacuation_distance.pyThe ten steps, from roles and the walkable grid to the what-if sweep and the export.prepare_s3dis.pyRebuilds the article’s 5 cm Area 1 floor from your own S3DIS download.visualize.pyThe stepped 3D replay, one Open3D window per step.tests/conftest.pyShared test helpers, synthetic floors with answers known in advance.tests/test_geometry.pyThe walkable grid, known widths in and known widths out.tests/test_field.pyThe distance field, the routes and the what-if on grids whose answers are known.tests/test_dead_ends.pyDead-end corridors and common paths on a floor drawn by hand.tests/test_determinism.pyOn the real floor, shuffled, rerun and nudged by 0.5 mm; skipped until data/ holds it.run.batWindows double-click runner, pipeline then replay.
The reference output
The files my run wrote, so you can check yours against them. Tell me where to send them.
metrics.jsonEvery number the article quotes, from the grid to the what-if cascade.evacuation_routes.jsonThe exits, the route of every space and the dead-end corridors, in Area 1’s metres.
Data: Reference outputs computed by Florent Poux from S3DIS, Area 1: I. Armeni, O. Sener, A. R. Zamir, H. Jiang, I. Brilakis, M. Fischer, S. Savarese, 3D Semantic Parsing of Large-Scale Indoor Spaces, CVPR 2016.
Get the data: S3DIS, the Stanford Large-Scale 3D Indoor Spaces dataset
From the official page, download Stanford3dDataset_v1.2_Aligned_Version.zip, unzip it
anywhere, then run python prepare_s3dis.py --s3dis "path/to/Stanford3dDataset_v1.2_Aligned_Version" in the kit folder.
prepare_s3dis.py reads the whole of Area 1, leaves out the ceiling and the beams, thins it to one point per 5 cm voxel and writes the copy the article ran on, 1,378,028 points, into a data/ folder next to the scripts, where evacuation_distance.py looks for it. Nothing else from S3DIS is needed.
Stanford3dDataset_v1.2_Aligned_Version/Area_1/*/Annotations/*.txtRead. Every room of Area 1, one text file per object, named after its class. Only Area_1 is needed.data/s3dis_area1_open_5cm.plyWritten next to the scripts. The whole Area 1 floor at 5 cm, 1,378,028 points.data/classes.jsonWritten beside it. The class names of that file.
The numbers in the article come from S3DIS. Run the kit on your own scan and you get your own numbers.
Terms: Stanford’s registration form: “I will not redistribute the dataset in any way and in any format. Any new access will be established through this form and/or authors’ official method of releasing the dataset. I agree that the data and derivatives will be used only for non-commercial research and academic purposes.”
Get it from the official dataset pageThe page’s download link opens the dataset’s registration form.
Where should I send them?
One email, and the download links appear right here. You also get them in your inbox so you can come back to this any time.
Here they are
Yours to keep. Run the pipeline on this scene first to reproduce every number in the article, then point it at something of your own.
The same links are in your inbox. If nothing arrives, check spam, then mail me and I will send them by hand.
3D Data Science with Python
Building Accurate Digital Environments with 3D Point Cloud Workflows
This kit is one pipeline. The book is the discipline underneath them: 690 pages from the Python foundations through point cloud processing, meshing and the engineering that keeps a 3D workflow standing up in production. If the script above makes sense and you want the structure they came from, that is where it lives.
See the book or buy it on O’ReillyThese are the materials for Walking distance to the nearest exit, from a scan, one of the tutorials I publish on Medium and on learngeodata.eu. Every kit lives at learngeodata.eu/materials/.