File size: 5,546 Bytes
2fb56ef 941722b 2fb56ef 941722b ae1c634 2fb56ef 941722b ae1c634 2fb56ef 941722b 2fb56ef 941722b 7b826cb 2fb56ef 941722b 2fb56ef 941722b 2fb56ef 941722b 2fb56ef 4be0e5a 941722b 2fb56ef 941722b 2fb56ef 941722b 2fb56ef 941722b 2fb56ef 941722b 2fb56ef 941722b 2fb56ef 4be0e5a 2fb56ef 941722b 2fb56ef 941722b 2fb56ef 941722b 2fb56ef 941722b 2fb56ef 941722b 2fb56ef 941722b 0db85b2 941722b 2fb56ef 941722b 7b826cb 2fb56ef 941722b |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 |
---
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
LADI-v2-classifier-small 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.
📘 __NOTE__ 📘 This model is the main version of the small model which is trained on all splits of the LADI v2 dataset. It is intended for deployment and fine-tuning purposes. If you are interested in reproducing the results of our paper, see the 'reference' versions of the classifiers [MITLL/LADI-v2-classifier-small-reference](https://huggingface.co/MITLL/LADI-v2-classifier-small-reference) and [MITLL/LADI-v2-classifier-large-reference](https://huggingface.co/MITLL/LADI-v2-classifier-large-reference) models, which are trained only on the training split of the dataset.
## 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
## How to Get Started with the Model
LADI-v2-classifier-small 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")
print(pipe(image_url))
```
```
[{'label': 'flooding_any', 'score': 0.999765932559967},
{'label': 'flooding_structures', 'score': 0.9991484880447388},
{'label': 'buildings_any', 'score': 0.998734176158905},
{'label': 'water_any', 'score': 0.996557354927063},
{'label': 'buildings_affected_or_greater', 'score': 0.9952601790428162}]
```
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")
model = AutoModelForImageClassification.from_pretrained("MITLL/LADI-v2-classifier-small")
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.04825277253985405),
('buildings_any', 0.998734176158905),
('buildings_affected_or_greater', 0.9952601790428162),
('buildings_minor_or_greater', 0.5874940752983093),
('debris_any', 0.1582988053560257),
('flooding_any', 0.999765932559967),
('flooding_structures', 0.9991484880447388),
('roads_any', 0.7687021493911743),
('roads_damage', 0.9690849781036377),
('trees_any', 0.7712554335594177),
('trees_damage', 0.8490118384361267),
('water_any', 0.996557354927063)]
```
## 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}
}
```
---
- **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)
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. |