https://github.com/antonmu/eqanalytics
Using AI to detecting vulnerable buildings
Science Score: 10.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
○codemeta.json file
-
○.zenodo.json file
-
○DOI references
-
✓Academic publication links
Links to: arxiv.org -
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (10.5%) to scientific vocabulary
Keywords
Repository
Using AI to detecting vulnerable buildings
Basic Info
Statistics
- Stars: 7
- Watchers: 5
- Forks: 1
- Open Issues: 17
- Releases: 0
Topics
Metadata Files
README.md
EQanalytics: Detection of Vulnerable Buildings
Machine learning project developed at Insight Data Science, 2019 AI session. A slide deck is available here.
Project description
In August 2018, AB-2681 Seismic safety: potentially vulnerable buildings was passed. This bill requires the state of California to identify all potentially vulnerable buildings before Jan 1, 2021.
Soft Story Buildings
One important type of vulnerable buildings are those with soft stories. A soft story is classified as a level that is less than 70% as stiff as the floor immediately above it.
In this project, I built an application that uses Google Street View images and computer vision techniques as well as classical machine learning to determine whether a given building address has a soft story.
Model Overview
On a high level, the model training consists of three separate steps:
- Obtain Training Images
- Download Street View images from all buildings in the San Francisco soft story property list.
- Object Segmentation
- Detect Houses
- Isolate Houses
- Detect Openings
- Classification
- Identify number of stories via K-means clustering
- Compute softness-score as the quotient of the total width of openings on the second story over the total width of openings on the first story.
Based on the softness-score, buildings are either classified as soft or non_soft.
Model Training
The model uses two supervised image detection deep learning approaches (both based on YOLOv3) located in Detector_Training.
- Train House Identifier
- Manually label houses using VoTT.
- Use transfer learning to train a YOLOv3 detector.
- Train Opening Identifier
- Use the CMP facade dataset.
- Use transfer learning to train a YOLOv3 detector.
The model also uses un-supervised K-means clustering in the final classification step. <!--
Inference
Model inference consists of four similar steps. After entering an address (or list of addresses), the corresponding street view images will be downloaded. For all images, the housing model first segments and crops one house per address. Then the opening detector labels all openings and creates a csv file with all dimensions and positions of the openings. Finally, the softness score is determined and used to classify the building as "soft", "non_soft" or "undetermined". -->
Repo structure
1_Pre_Processing: All Preprocessing Tasks2_Computer_Vision: Both Image Segmentation Tasks3_Classification: Final Classification TaskData: Input Data, Output Data and Results
Getting Started
Requisites
The code uses python 3.6, Keras with Tensorflow backend. Training was performed on an AWS p2.xlarge instance (Tesla K80 GPU with 12GB memory). Inference is faster on a GPU (~5 images per second on the same setup), but also works fine on a modest CPU setup (~0.3 images per second on an AWS t2.medium with a 2 VCPUs and 4GB of memory). To run this code on AWS, it is recommended to use the Deep Learning AMI (this makes sure that all GPU drivers are working).
Installation [Linux or Mac]
Clone Repo and Install Requirements
Clone this repo with:
git clone https://github.com/AntonMu/EQanalytics
cd EQanalytics/
Create Virtual Environment (Venv needs to be installed on your system).
python3 -m venv env
source env/bin/activate
<!--
If you are a conda user, create your virtual environment with:
conda create -n EQanalytics
source activate EQanalytics
-->
Next, install all required packages. If you are running EQanalytics on a machine with GPU run:
pip3 install -r requirements.txt
Otherwise, run:
pip3 install -r requirements_cpu.txt
Quick Start
To get started on a minimal example on two images located in Data/Minimal_Example run the Minimal_Example.py script.
python Minimal_Example.py
The outputs of all detections are saved in the Data/Minimal_Example folder. This includes:
- Results of the housing detector
- Cropped housing images
- Results of the opening detector
- Results of the level detector
- Softness scores located in Softness_Scores.csv
Full Start
To run a full model, follow the individual instructions located in 1PreProcessing, 2ComputerVision and 3_Classification, respectively. To retrain detectors navigate to 2ComputerVision/Detector_Training.
Note that the Data folder is populated with a small set of sample in- and outputs for each step and thus all scripts can be run independently. For example, it is possible to run scripts in 2ComputerVision without having previously run the pre-processing step in 1PreProcessing.
License
Unless explicitly stated at the top of a file, all code is licensed under the MIT license.
This repo makes use of ilmonteux/logohunter which itself is inspired by qqwweee/keras-yolo3.
Common Issues
If you are having trouble with getting cv2 to run, try:
apt-get update
apt-get install -y libsm6 libxext6 libxrender-dev
pip install opencv-python
Owner
- Name: AntonMu
- Login: AntonMu
- Kind: user
- Location: Berkeley, USA
- Company: UC Berkeley
- Website: antonmuehlemann.de
- Twitter: antonmuehlemann
- Repositories: 3
- Profile: https://github.com/AntonMu
University of Oxford, UC Berkeley
GitHub Events
Total
Last Year
Dependencies
- Jinja2 ==2.10.1
- Keras ==2.2.4
- Keras-Applications ==1.0.8
- Keras-Preprocessing ==1.1.0
- Markdown ==3.1.1
- MarkupSafe ==1.1.1
- Pillow ==6.2.0
- PyYAML ==5.1.1
- Pygments ==2.4.2
- Send2Trash ==1.5.0
- Werkzeug ==0.15.4
- absl-py ==0.7.1
- astor ==0.8.0
- attrs ==19.1.0
- backcall ==0.1.0
- bleach ==3.1.1
- certifi ==2019.6.16
- chardet ==3.0.4
- cycler ==0.10.0
- decorator ==4.4.0
- defusedxml ==0.6.0
- entrypoints ==0.3
- gast ==0.2.2
- google-pasta ==0.1.7
- grpcio ==1.22.0
- h5py ==2.9.0
- idna ==2.8
- ipykernel ==5.1.1
- ipython ==7.6.1
- ipython-genutils ==0.2.0
- ipywidgets ==7.5.0
- jedi ==0.14.0
- joblib ==0.13.2
- jsonschema ==3.0.1
- jupyter ==1.0.0
- jupyter-client ==5.3.0
- jupyter-console ==6.0.0
- jupyter-core ==4.5.0
- kiwisolver ==1.1.0
- matplotlib ==3.0.3
- mistune ==0.8.4
- mpmath ==1.1.0
- nbconvert ==5.5.0
- nbformat ==4.4.0
- notebook ==5.7.8
- numpy ==1.16.4
- opencv-python ==4.1.0.25
- pandas ==0.24.2
- pandocfilters ==1.4.2
- parso ==0.5.0
- pexpect ==4.7.0
- pickleshare ==0.7.5
- prometheus-client ==0.7.1
- prompt-toolkit ==2.0.9
- protobuf ==3.8.0
- ptyprocess ==0.6.0
- pyparsing ==2.4.0
- pyrsistent ==0.15.3
- python-dateutil ==2.8.0
- pytz ==2019.1
- pyzmq ==18.0.2
- qtconsole ==4.5.1
- requests ==2.22.0
- scikit-learn ==0.21.2
- scipy ==1.3.0
- six ==1.12.0
- sklearn ==0.0
- sympy ==1.4
- tensorboard ==1.14.0
- tensorflow-estimator ==1.14.0
- tensorflow-gpu ==1.15.4
- termcolor ==1.1.0
- terminado ==0.8.2
- testpath ==0.4.2
- tornado ==6.0.3
- traitlets ==4.3.2
- urllib3 ==1.25.3
- wcwidth ==0.1.7
- webencodings ==0.5.1
- widgetsnbextension ==3.5.0
- wrapt ==1.11.2
- Jinja2 ==2.10.1
- Keras ==2.2.4
- Keras-Applications ==1.0.8
- Keras-Preprocessing ==1.1.0
- Markdown ==3.1.1
- MarkupSafe ==1.1.1
- Pillow ==6.2.0
- PyYAML ==5.1.1
- Pygments ==2.4.2
- Send2Trash ==1.5.0
- Werkzeug ==0.15.4
- absl-py ==0.7.1
- astor ==0.8.0
- attrs ==19.1.0
- backcall ==0.1.0
- bleach ==3.1.1
- certifi ==2019.6.16
- chardet ==3.0.4
- cycler ==0.10.0
- decorator ==4.4.0
- defusedxml ==0.6.0
- entrypoints ==0.3
- gast ==0.2.2
- google-pasta ==0.1.7
- grpcio ==1.22.0
- h5py ==2.9.0
- idna ==2.8
- ipykernel ==5.1.1
- ipython ==7.6.1
- ipython-genutils ==0.2.0
- ipywidgets ==7.5.0
- jedi ==0.14.0
- joblib ==0.13.2
- jsonschema ==3.0.1
- jupyter ==1.0.0
- jupyter-client ==5.3.0
- jupyter-console ==6.0.0
- jupyter-core ==4.5.0
- kiwisolver ==1.1.0
- matplotlib ==3.0.3
- mistune ==0.8.4
- mpmath ==1.1.0
- nbconvert ==5.5.0
- nbformat ==4.4.0
- notebook ==5.7.8
- numpy ==1.16.4
- opencv-python ==4.1.0.25
- pandas ==0.24.2
- pandocfilters ==1.4.2
- parso ==0.5.0
- pexpect ==4.7.0
- pickleshare ==0.7.5
- prometheus-client ==0.7.1
- prompt-toolkit ==2.0.9
- protobuf ==3.8.0
- ptyprocess ==0.6.0
- pyparsing ==2.4.0
- pyrsistent ==0.15.3
- python-dateutil ==2.8.0
- pytz ==2019.1
- pyzmq ==18.0.2
- qtconsole ==4.5.1
- requests ==2.22.0
- scikit-learn ==0.21.2
- scipy ==1.3.0
- six ==1.12.0
- sklearn ==0.0
- sympy ==1.4
- tensorboard ==1.14.0
- tensorflow ==1.15.4
- tensorflow-estimator ==1.14.0
- termcolor ==1.1.0
- terminado ==0.8.2
- testpath ==0.4.2
- tornado ==6.0.3
- traitlets ==4.3.2
- urllib3 ==1.25.3
- wcwidth ==0.1.7
- webencodings ==0.5.1
- widgetsnbextension ==3.5.0
- wrapt ==1.11.2