YAML Metadata
Warning:
empty or missing yaml metadata in repo card
(https://huggingface.co/docs/hub/model-cards#model-card-metadata)
π Disaster Image Classification using Vision Transformer
This project uses a fine-tuned Vision Transformer (ViT) model to classify disaster-related images into various categories such as Water Disaster, Fire Disaster, Human Damage, etc.
π Installation
Install the required Python packages:
pip install transformers torch torchvision pillow requests
π Quick Start
Use the pipeline to classify an image directly from a URL:
from transformers import pipeline
from PIL import Image
import requests
from io import BytesIO
# Load the image classification pipeline
pipe = pipeline("image-classification", model="Luwayy/disaster_images_model")
# Load an image from a URL
url = 'https://www.spml.co.in/Images/blog/wdt&c-152776632.jpg'
response = requests.get(url)
image = Image.open(BytesIO(response.content))
# Classify the image
results = pipe(image)
# Print results
print(results)
Example Output:
[
{"label": "Water_Disaster", "score": 0.9184},
{"label": "Land_Disaster", "score": 0.0200},
{"label": "Non_Damage", "score": 0.0169},
{"label": "Human_Damage", "score": 0.0164},
{"label": "Fire_Disaster", "score": 0.0143}
]
π§ Model Details
- Base Model:
google/vit-base-patch16-224-in21k
- Architecture: Vision Transformer (
ViTForImageClassification
) - Image Size: 224x224
- Classes:
Damaged_Infrastructure
Fire_Disaster
Human_Damage
Land_Disaster
Non_Damage
Water_Disaster
βοΈ Training Configuration
- Image Normalization: Mean
[0.5, 0.5, 0.5]
, Std[0.5, 0.5, 0.5]
- Resize Method: Bilinear to
224x224
- Augmentations: Resize, Normalize, Convert to Tensor
- Batch Size: 16
- Epochs: 3
- Learning Rate:
3e-5
- Weight Decay:
0.01
- Evaluation Strategy: Per epoch
- Downloads last month
- 108
Inference Providers
NEW
This model isn't deployed by any Inference Provider.
π
Ask for provider support