Downloads · 30 days
15
4% of all-time downloads
tiratano/bdd100k-multitask-resnet18
bdd100k-multitask-resnet18 is a machine learning model from tiratano. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
This is a multi-task ResNet-18 model trained on the BDD100K dataset to classify three road scene attributes simultaneously: - Weather: 6 classes (clear, overcast, partly cloudy, rainy, snowy, foggy) - Time of day: 3 c…
Downloads · 30 days
15
4% of all-time downloads
All-time downloads
413
Public
Parameters
11.2M
44.8 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors44.8 MB · 100%
From the Hugging Face model README
This is a multi-task ResNet-18 model trained on the BDD100K dataset to classify three road scene attributes simultaneously:
The model uses a shared ResNet-18 backbone with separate classification heads for each task, enabling efficient multi-task learning.
Based on validation results (30 epochs of training):
| Task | Validation Accuracy |
|---|---|
| Weather | 68.44% |
| Time of day | 82.57% |
| Scene type | 63.49% |
| Average | 71.50% |
pip install torch torchvision transformers pillow
from transformers import AutoModel, AutoConfig
from PIL import Image
import torch
# Load the model
model = AutoModel.from_pretrained("your-username/bdd100k-multitask-resnet18", trust_remote_code=True)
# Load and predict on an image
image = Image.open("path/to/your/image.jpg")
predictions = model.predict(image)
print(f"Weather: {predictions['weather']['label']} (confidence: {predictions['weather']['confidence']:.3f})")
print(f"Time of day: {predictions['timeofday']['label']} (confidence: {predictions['timeofday']['confidence']:.3f})")
print(f"Scene: {predictions['scene']['label']} (confidence: {predictions['scene']['confidence']:.3f})")
from PIL import Image
# Load multiple images
images = [Image.open(f"image_{i}.jpg") for i in range(3)]
# Predict on batch
predictions = model.predict(images)
for i, pred in enumerate(predictions):
print(f"Image {i+1}:")
print(f" Weather: {pred['weather']['label']}")
print(f" Time of day: {pred['timeofday']['label']}")
print(f" Scene: {pred['scene']['label']}")
import torch
from torchvision import transforms
# Prepare image
transform = transforms.Compose([
transforms.Resize((224, 224)),
transforms.ToTensor(),
transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225])
])
image_tensor = transform(image).unsqueeze(0)
# Forward pass
model.eval()
with torch.no_grad():
outputs = model(image_tensor)
weather_probs = torch.softmax(outputs['weather_logits'], dim=1)
timeofday_probs = torch.softmax(outputs['timeofday_logits'], dim=1)
scene_probs = torch.softmax(outputs['scene_logits'], dim=1)
If you use this model, please cite the BDD100K dataset:
@inproceedings{yu2020bdd100k,
title={BDD100K: A diverse driving dataset for heterogeneous multitask learning},
author={Yu, Fisher and Chen, Haofeng and Wang, Xin and Xian, Wenqi and Chen, Yingying and Liu, Fangchen and Madhavan, Vashisht and Darrell, Trevor},
booktitle={Proceedings of the IEEE/CVF conference on computer vision and pattern recognition},
pages={2636--2645},
year={2020}
}
This model is released under the same license as the BDD100K dataset. Please refer to the BDD100K official website for license details.
For questions about this model, please open an issue in the repository or contact the model author.