This project uses YOLOv8 for building footprint detection and damage assessment from satellite images.
building_damage_assessment/
├── config/
│ └── config.yaml
├── src/
│ └── yolo_damage_assessment/
│ ├── train_yolo.py
│ └── utils/
│ └── logging_config.py
├── tests/
│ └── test_train_yolo.py
├── requirements.txt
├── setup.py
└── README.md
-
Clone the repository:
git clone https://github.com/Zarasim/building-damage-assessment.git cd building-damage-assessment
-
Create a virtual environment and activate it:
python -m venv venv source venv/bin/activate # On Windows, use `venv\Scripts\activate`
-
Install the required packages:
pip install -r requirements.txt
-
Update the
config/config.yaml
file with your specific settings. -
Run the training script:
python src/yolo_damage_assessment/train_yolo.py
You can also specify custom paths for the configuration file and output directory:
python src/yolo_damage_assessment/train_yolo.py --config path/to/your/config.yaml --output path/to/output/directory
To train the model on Google Colab using a dataset stored on Google Drive:
-
Upload your dataset to Google Drive.
-
Create a new Colab notebook.
-
Mount your Google Drive:
from google.colab import drive drive.mount('/content/drive')
-
Clone the repository:
!git clone https://github.com/Zarasim/building-damage-assessment.git %cd building-damage-assessment
-
Install the required packages:
!pip install -r requirements.txt
-
Update the
config/config.yaml
file to point to your dataset in Google Drive:import yaml with open('config/config.yaml', 'r') as file: config = yaml.safe_load(file) config['data']['yaml_path'] = '/content/drive/MyDrive/path/to/your/data.yaml' config['data']['test_image'] = '/content/drive/MyDrive/path/to/your/test_image.jpg' with open('config/config.yaml', 'w') as file: yaml.dump(config, file)
-
Run the training script:
!python src/yolo_damage_assessment/train_yolo.py
Or with custom paths:
!python src/yolo_damage_assessment/train_yolo.py --config /content/drive/MyDrive/path/to/your/config.yaml --output /content/drive/MyDrive/path/to/output/directory
-
The trained model and results will be saved to the specified output directory in your Google Drive.
To run the tests, use pytest:
pytest tests/
This project is licensed under the MIT License.