Snowy-ResNet
Overview
Snowy-ResNet is a convolutional neural network (CNN) designed for snow detection on pavements, aiming to enhance pedestrian safety during winter. This model is part of the research published in the paper "Image Classification for Snow Detection to Improve Pedestrian Safety," presented at the Midwest Association for Information Systems (MWAIS) Conference in May 2024 (Read the paper on the Conference Site or arXiv).
Snowy-ResNet builds on the ResNet-50 architecture, leveraging transfer learning to achieve accurate snow classification. It was developed to help reduce winter-related injuries, particularly among vulnerable groups like the elderly and visually impaired individuals.
Features
- Pretrained Architecture: Built on ResNet-50, pretrained on ImageNet.
- Transfer Learning: Fine-tuned for snow classification using a custom dataset of pavement images.
- Ensemble Approach: Combined with VGG-19 in the original research to achieve optimal accuracy and F1 scores.
- Custom Dataset: Trained and validated on a dataset of 98 smartphone-captured images with a balanced distribution of snowy and snow-free pavements.
- Lightweight and Efficient: Designed for computational efficiency to support real-time applications.
Dataset
The dataset used for training consists of:
- 98 Images: Captured in Minnesota, USA, using a Google Pixel 6a smartphone.
- Resolution: 3024 x 3024 pixels, resized to 128 x 128 for training.
- Labels: Balanced categories of snow and no-snow images.
- Test Set: Includes 22 unseen images from distinct locations to evaluate generalization.
The dataset is also available at Neatherblok/Snowy_Sidewalk_Detection.
Implementation
- Framework: PyTorch
- Training:
- Optimizer: Adam
- Learning Rate: 0.0001
- Batch Size: 4
- Epochs: 15-25 (best results at epoch 15)
- Normalization: Based on ImageNet mean ([0.485, 0.456, 0.406]) and standard deviation ([0.229, 0.224, 0.225]).
- Evaluation Metrics:
- Accuracy: 72.7%
- F1 Score: 71.8%
Usage
To use Snowy-ResNet for snow detection, follow these steps:
Installation:
- Install PyTorch and dependencies:
pip install torch torchvision
- Install PyTorch and dependencies:
Load the Model:
import torch from torchvision import models model = models.resnet50(pretrained=True) # Modify the classification layer for binary output (snow vs no-snow) model.fc = torch.nn.Linear(model.fc.in_features, 2) model.load_state_dict(torch.load('Best_Model_ResNet50.pt')) model.eval()
Inference:
- Preprocess the input image to 128x128 pixels.
- Normalize using ImageNet statistics.
- Pass the image through the model for predictions:
with torch.no_grad(): output = model(image_tensor) prediction = torch.argmax(output, dim=1) print("Snow detected" if prediction.item() == 1 else "No snow detected")
Results
- Performance:
- Ensemble of Snowy-ResNet and VGG-19 achieves an F1 Score of 71.8% and an accuracy of 72.7% on unseen test data.
- Identifies snow with a focus on reducing false negatives, critical for pedestrian safety.
Limitations
- Limited Dataset: Only 98 images for training, which may affect generalization.
- Light Reflection Sensitivity: Difficulty in detecting subtle changes in light wave reflections on snow.
- False Negatives: High-risk misclassification when snow is not detected.
Future Directions
- Dataset Expansion: Include more diverse images from different locations, lighting conditions, and camera types.
- Model Enhancements: Incorporate custom layers to handle light reflection variations better.
- Real-Time Applications: Adapt Snowy-ResNet for mobile deployment to provide real-time alerts for pedestrians.
Citation
If you use Snowy-ResNet in your work, please cite the following paper:
Ricardo de Deijn and Rajeev Bukralia, "Image Classification for Snow Detection to Improve Pedestrian Safety," Midwest Association for Information Systems (MWAIS) 2024. Link to Paper
Acknowledgments
Snowy-ResNet was developed as part of a collaborative effort at Minnesota State University, Mankato, with guidance from Dr. Rajeev Bukralia.
For questions or inquiries, please contact:
- Ricardo de Deijn: ricardodedeijn@gmail.com
Model tree for Neatherblok/Snowy-ResNet
Base model
microsoft/resnet-50