Using Machine Learning for Disaster Response: The afetharita Project

Following the earthquakes that struck South Eastern Turkey on February 6, 2023, a group of volunteers developed afetharita (disaster map), an application designed to help search and rescue teams locate survivors by converting unstructured social media posts into actionable data. This effort leveraged the Hugging Face ecosystem to prototype, collaborate, and deploy life-saving machine learning tools under extreme time constraints.

Extracting Survivor Information from Social Media

Volunteers built a pipeline to convert screenshots and tweets into structured data, including names, telephone numbers, and addresses, which were then provided to authorities.

OCR and Information Extraction

To process screenshots of text messages and tweets, the team implemented an application using easyocr for Optical Character Recognition (OCR) and Gradio for the user interface. The extracted text was then parsed using a fine-tuned transformers-based Named Entity Recognition (NER) model to identify key personal details.

Address Extraction and Geocoding

For text-based calls for help, the team developed an address extraction model using bert-base-turkish-cased as the base model for token classification. The workflow functioned as follows:

  • Extraction: The NER model extracted addresses from raw tweets.
  • Geocoding: Extracted addresses were sent to a geocoding API to obtain longitude and latitude.
  • Visualization: Geolocation data was displayed on a front-end map to guide rescue teams.

To minimize DevOps overhead, the team used the Hugging Face Inference API for model serving, which removed the need for manual Docker image creation and cloud instance deployment.

Intent Classification for Survivor Needs

To identify specific needs (such as shelter, food, or logistics), the team experimented with several approaches:

  • Zero-Shot and Few-Shot Learning: Initial tests used open-source NLI models like xlm-roberta-large-xnli and convbert-base-turkish-mc4-cased-allnli_tr. NLI models were preferred over generative models initially because they allowed for candidate label inference and avoided the risk of the model "making up" labels.
  • Fine-Tuning: The team eventually fine-tuned BERT models, finding that bert-base-turkish-uncased and bert-base-turkish-128k-cased outperformed bert-base-turkish-cased.
  • Optimization: Due to class imbalance, the team prioritized eliminating false negatives, focusing on recall and F1-scores. They created a Hugging Face Space to benchmark models using a specific metadata tag (deprem-clf-v1) to rank performance and determine the best threshold per label.

Active Learning and LLMs

To refine the NER model, the team used Argilla and Gradio to create a crowd-sourced labeling interface where users could flag outputs as correct, incorrect, or ambiguous. Additionally, a separate team used generative models via prompt engineering to extract fine-grained needs as free text, noting that few-shot prompting with LLMs is highly effective for adapting to rapid data drift without requiring new labeled data.

Remote Sensing for Damage Assessment

To overcome the lack of electricity and stable mobile networks, volunteers used satellite imagery to assess building and infrastructure damage.

Satellite Data Collection and Processing

Images were collected from Planet Labs, Maxar, and the Copernicus Open Access Hub. To facilitate training, 1080x1080 satellite images were cropped into 640x640 chunks.

Model Deployment

The team fine-tuned several models for building detection and semantic segmentation:

  • Object Detection: YOLOv5, YOLOv8, and EfficientNet were used for building detection.
  • Semantic Segmentation: A SegFormer model was used for semantic segmentation of buildings.

These applications were deployed as Hugging Face Spaces. In collaboration with companies like Co-One, the team worked on detailed annotations including labels for no damage, destroyed, damaged, damaged facility, and undamaged facility with the goal of releasing an extensive open-source dataset for future global disaster response.

MLOps and Collaboration Infrastructure

The speed of deployment was enabled by the Hugging Face Hub and its integrated ecosystem:

  • Collaboration: An organization account allowed volunteers to collaborate via pull requests.
  • CI/CD: A CI bot provided ephemeral environments to preview pull request changes in Hugging Face Spaces.
  • Infrastructure: Hugging Face provided GPU grants and additional Inference API replicas to ensure the application remained robust under high traffic and avoided downtime.

Sources