This repository contains the code for the thesis project "Characterization of the Construction Period of Buildings in Beirut from Street-View Photos Using Deep Learning".
This work was part of my Master's thesis project at the American University of Beirut (AUB). The project aimed to predict the construction period of buildings in Beirut using street-view images. This work was supervised by Prof. Mayssa Dabaghi, Prof. Sirine Taleb, and Prof. Aram Yeretzian.
The repository contains the code for the following tasks:
- Data Preprocessing
- Model Training with Transfer Learning.
- Model Optimization. (Hyperparameter Tuning)
- Model Prediction and Evaluation.
- Model Interpretation. (LIME, SHAP)
- Model Deployment. (Huggingface Model Space)
- Gradio Interface.
- Dockerization.
- Automated Data Collection.
Refer to the Todo section for the tasks that are in progress or planned to be implemented in the future.
The repository also contains the trained models and part of the dataset used in the project. The full dataset is not included in the repository due to copyright issues.
The model is trained to predict the construction periods that are divided into the following categories:
| Construction Period | Architectural Theme |
|---|---|
| Pre-1935 | Late Ottoman & Colonial Eclectic |
| 1935-1955 | Early Modernist |
| 1956-1971 | High Modernist |
| 1972-1990 | Late Modernist |
| Post-1990 | Contemporary |
The model architecture used in the project is a pre-trained SwinT model with a custom head fine-tuned on the dataset.
First, clone the repository using the following command:
git clone https://github.com/davidwardan/BeirutCP_Classifier.gitThen, create and activate your conda environment using the following commands (refer to the miniconda documentation https://docs.anaconda.com/free/miniconda/miniconda-install/):
conda create -n Beirut_env python=3.10
conda activate Beirut_envFinally, install the required packages using the following command:
cd BeirutCP_Classifier
pip install -r requirements.txtRemember to replace the path to the repository with the correct path on your machine.
To run the classifier UI feature, use the following command:
python -m src.mainThe trained model is deployed on the Huggingface Model Space. You can access the model using the following link: BeirutCP_Classifier
To run the project using Docker, first build the Docker image using the following command:
docker build -t beirutcp_classifier .Then, run the Docker container using the following command:
docker run -p 7860:7860 beirutcp_classifierPlanned future tasks:
- Data Preprocessing.
- Model Training with Transfer Learning.
- Model Optimization. (Bayesian Optimization)
- Model Prediction and Evaluation.
- Model Interpretation. (LIME)
- Model Interpretation. (SHAP)
- Gradio Interface.
- Huggingface Model Space Deployment.
- Tensorflow to Pytorch Conversion.
- Ability to download model weights.
- Ability to access collected data.
- Dockerization.
- Documentation.
- Automated Data Collection from Google Street View API.
- Ability to recognize if the image does not contain a building.
- Ability to provide additional information about the building.
- Ability to recognize if the building is highly damaged.
- Ability to recognize if the building has been renovated.
- Ability to recognize if the architecture is not typical for Beirut.
This project is licensed under the MIT License—see the LICENSE file for details.


