Spaces:
Sleeping
A newer version of the Gradio SDK is available: 6.26.0
title: test
app_file: src/main.py
sdk: gradio
sdk_version: 4.44.1
Beirut Construction Period Classifier
Introduction
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.
Construction Periods
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 |
Model Architecture
The model architecture used in the project is a pre-trained SwinT model with a custom head fine-tuned on the dataset.
Installation
First, clone the repository using the following command:
git clone https://github.com/davidwardan/BeirutCP_Classifier.git
Then, 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_env
Finally, install the required packages using the following command:
cd BeirutCP_Classifier
pip install -r requirements.txt
Remember to replace the path to the repository with the correct path on your machine.
Classifier Gradio Interface
To run the classifier UI feature, use the following command:
python -m src.main
Huggingface Model Space Deployment
The trained model is deployed on the Huggingface Model Space. You can access the model using the following link: BeirutCP_Classifier
Dockerization
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_classifier
Todo:
Planned 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.
License
This project is licensed under the MIT License—see the LICENSE file for details.

