Image Classification
Transformers
Safetensors
bit
LADI
Aerial Imagery
Disaster Response
Emergency Management
Instructions to use MITLL/LADI-v2-classifier-small-reference with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use MITLL/LADI-v2-classifier-small-reference with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-classification", model="MITLL/LADI-v2-classifier-small-reference") pipe("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/parrots.png")# Load model directly from transformers import AutoImageProcessor, AutoModelForImageClassification processor = AutoImageProcessor.from_pretrained("MITLL/LADI-v2-classifier-small-reference") model = AutoModelForImageClassification.from_pretrained("MITLL/LADI-v2-classifier-small-reference", device_map="auto") - Notebooks
- Google Colab
- Kaggle
| license: mit | |
| library_name: transformers | |
| widget: | |
| - src: >- | |
| https://fema-cap-imagery.s3.amazonaws.com/Images/CAP_-_Flooding_Spring_2023/Source/IAWG_23-B-5061/A0005/D75_0793_DxO_PL6_P.jpg | |
| - example_title: Example classification of flooded scene | |
| pipeline_tag: image-classification | |
| tags: | |
| - LADI | |
| - Aerial Imagery | |
| - Disaster Response | |
| - Emergency Management | |
| datasets: | |
| - MITLL/LADI-v2-dataset | |
| # Model Card for MITLL/LADI-v2-classifier-small-reference | |
| LADI-v2-classifier-small-reference is based on [google/bit-50](https://huggingface.co/google/bit-50) and fine-tuned on the [MITLL/LADI-v2-dataset](https://huggingface.co/datasets/MITLL/LADI-v2-dataset). LADI-v2-classifier is trained to identify labels of interest to disaster response managers from aerial images. | |
| 🔴 __IMPORTANT__ ❗🔴 This model is the 'reference' version of the model, which is trained on 80% of the 10,000 available images. It is provided to facilitate reproduction of our paper and is not intended to be used in deployment. For deployment, see the [MITLL/LADI-v2-classifier-small](https://huggingface.co/MITLL/LADI-v2-classifier-small) and [MITLL/LADI-v2-classifier-large](https://huggingface.co/MITLL/LADI-v2-classifier-large) models, which are trained on the full LADI v2 dataset (all splits). | |
| ## Model Details | |
| ### Model Description | |
| The model architecture is based on Google's bit-50 model and fine-tuned on the LADI v2 dataset, which contains 10,000 aerial images labeled by volunteers from the Civil Air Patrol. The images are labeled using multi-label classification for the following classes: | |
| - bridges_any | |
| - buildings_any | |
| - buildings_affected_or_greater | |
| - buildings_minor_or_greater | |
| - debris_any | |
| - flooding_any | |
| - flooding_structures | |
| - roads_any | |
| - roads_damage | |
| - trees_any | |
| - trees_damage | |
| - water_any | |
| This 'reference' model is trained on the training split, which contains 8,000 images from 2015-2022. It is provided for the purpose of reproducing the results from the paper. The 'deploy' model is trained on the training, validation, and test sets, and contains 10,000 images from 2015-2023. We recommend that anyone who wishes to use this model in production use the main versions of the models [MITLL/LADI-v2-classifier-small](https://huggingface.co/MITLL/LADI-v2-classifier-small) and [MITLL/LADI-v2-classifier-large](https://huggingface.co/MITLL/LADI-v2-classifier-large). | |
| - **Developed by:** Jeff Liu, Sam Scheele | |
| - **Funded by:** Department of the Air Force under Air Force Contract No. FA8702-15-D-0001 | |
| - **License:** MIT | |
| - **Finetuned from model:** [google/bit-50](https://huggingface.co/google/bit-50) | |
| ## How to Get Started with the Model | |
| LADI-v2-classifier-small-reference is trained to identify features of interest to disaster response managers from aerial images. Use the code below to get started with the model. | |
| The simplest way to perform inference is using the pipeline interface | |
| ```python | |
| from transformers import pipeline | |
| image_url = "https://fema-cap-imagery.s3.amazonaws.com/Images/CAP_-_Flooding_Spring_2023/Source/IAWG_23-B-5061/A0005/D75_0793_DxO_PL6_P.jpg" | |
| pipe = pipeline(model="MITLL/LADI-v2-classifier-small-reference") | |
| print(pipe(image_url)) | |
| ``` | |
| ``` | |
| [{'label': 'flooding_any', 'score': 0.9986758828163147}, | |
| {'label': 'buildings_any', 'score': 0.9982584118843079}, | |
| {'label': 'flooding_structures', 'score': 0.998119056224823}, | |
| {'label': 'water_any', 'score': 0.9967329502105713}, | |
| {'label': 'buildings_affected_or_greater', 'score': 0.9903663396835327}] | |
| ``` | |
| For finer-grained control, see below: | |
| ```python | |
| from transformers import AutoImageProcessor, AutoModelForImageClassification | |
| import torch | |
| import requests | |
| from PIL import Image | |
| from io import BytesIO | |
| image_url = "https://fema-cap-imagery.s3.amazonaws.com/Images/CAP_-_Flooding_Spring_2023/Source/IAWG_23-B-5061/A0005/D75_0793_DxO_PL6_P.jpg" | |
| img_data = requests.get(image_url).content | |
| img = Image.open(BytesIO(img_data)) | |
| processor = AutoImageProcessor.from_pretrained("MITLL/LADI-v2-classifier-small-reference") | |
| model = AutoModelForImageClassification.from_pretrained("MITLL/LADI-v2-classifier-small-reference") | |
| inputs = processor(img, return_tensors="pt") | |
| with torch.no_grad(): | |
| logits = model(**inputs).logits | |
| predictions = torch.sigmoid(logits).detach().numpy()[0] | |
| labels = [(model.config.id2label[idx], predictions[idx]) for idx in range(len(predictions))] | |
| print(labels) | |
| ``` | |
| ``` | |
| [('bridges_any', 0.76203513), | |
| ('buildings_any', 0.9982584), | |
| ('buildings_affected_or_greater', 0.99036634), | |
| ('buildings_minor_or_greater', 0.57826394), | |
| ('debris_any', 0.18689156), | |
| ('flooding_any', 0.9986759), | |
| ('flooding_structures', 0.99811906), | |
| ('roads_any', 0.973596), | |
| ('roads_damage', 0.91898227), | |
| ('trees_any', 0.91444755), | |
| ('trees_damage', 0.7382976), | |
| ('water_any', 0.99673295)] | |
| ``` | |
| ## Citation | |
| **BibTeX:** | |
| ``` | |
| @misc{ladi_v2, | |
| title={LADI v2: Multi-label Dataset and Classifiers for Low-Altitude Disaster Imagery}, | |
| author={Samuel Scheele and Katherine Picchione and Jeffrey Liu}, | |
| year={2024}, | |
| eprint={2406.02780}, | |
| archivePrefix={arXiv}, | |
| primaryClass={cs.CV} | |
| } | |
| ``` | |
| --- | |
| DISTRIBUTION STATEMENT A. Approved for public release. Distribution is unlimited. | |
| This material is based upon work supported by the Department of the Air Force under Air Force Contract No. FA8702-15-D-0001. Any opinions, findings, conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the Department of the Air Force. | |
| © 2024 Massachusetts Institute of Technology. | |
| The software/firmware is provided to you on an As-Is basis | |
| Delivered to the U.S. Government with Unlimited Rights, as defined in DFARS Part 252.227-7013 or 7014 (Feb 2014). Notwithstanding any copyright notice, U.S. Government rights in this work are defined by DFARS 252.227-7013 or DFARS 252.227-7014 as detailed above. Use of this work other than as specifically authorized by the U.S. Government may violate any copyrights that exist in this work. |