Heuristic Style Transfer for Real-Time, Efficient Weather Attribute Detection
Organizations: Intelligent Transportation Systems Research Team(I.T.S), Cerema, 8, rue Bernard Palissy, Clermont-Ferrand, 63017, France. · Intelligent Transportation Systems Research Team(I.T.S), Cerema, 1 avenue du Colonel Roche, Toulouse, 31400, France. · Clermont Auvergne INP, Université Clermont Auvergne, Pascal Institute, CNRS, 4 Av. Blaise Pascal, Clermont-Ferrand, 63178, France.
Abstract
We present lightweight and efficient architectures to detect weather conditions from RGB images, predicting the weather type (sunny, rain, snow, fog) and 11 complementary attributes such as intensity, visibility, and ground condition, for a total of 53 classes across the tasks. This work examines to what extent weather conditions manifest as variations in visual style. We investigate style-inspired techniques, including Gram matrices, a truncated ResNet-50 targeting lower and intermediate layers, and PatchGAN-style architectures, within a multi-task framework with attention mechanisms. Two families are introduced: RTM (ResNet50-Truncated-MultiTasks) and PMG (PatchGAN-MultiTasks-Gram), together with their variants. Our contributions include automation of Gram-matrix computation, integration of PatchGAN into supervised multi-task learning, and local style capture through local Gram for improved spatial coherence. We also release a dataset of 503,875 images annotated with 12 weather attributes under a Creative Commons Attribution (CC-BY) license. The models achieve F1 scores above 96 percent on our internal test set and above 78 percent in zero-shot evaluation on several external datasets, confirming their generalization ability. The PMG architecture, with fewer than 5 million parameters, runs in real time with a small memory footprint, making it suitable for embedded systems. The modular design of the models also allows style-related or weather-related tasks to be added or removed as needed.
Figures & tables
| Model | Summary (idea and training) | Optimized hyperparameters (DEAP) |
|---|---|---|
| RTM | Truncated ResNet-50 (no avgpool/fc ) with lightweight per-task attention (GAP+MLP ablation). Optimized under SGD; -fold F1 as the objective. | truncate_layer , batch_size , lr , head depth/width ( hidden_dims , num_layers ); use_attention (if mode=evolve ); encoder freezing (training option). |
| RTMG | RTM augmented with global Gram over intermediate channels (style correlations); same training protocol (SGD, -fold). | All RTM HPOs plus gram_matrix_size ; use_attention (if attention_mode=evolve ). |
| PM | Multi-task PatchGAN (implicit non-overlapping patches) with TaskHeadImproved (optional SE, spatial softmax with temperature ); -fold F1 objective. | batch_size , lr , patch_size . Attention parameters not evolved but configurable via CLI : attn_tau , attn_use_se , attn_softmax_spatial , attn_tv_lambda . |
| PMG | PatchGAN + local Grams per implicit patch token projection (optional) lightweight attention mechanisms + task-conditioned pooling. Optimized under AdamW + Cosine; AMP/accumulation available. | batch_size , lr , weight_decay , patch_size , patch_div , ndf , gram_channels , d_model , attention mechanisms_layers , attention mechanisms_heads , use_token_attention , use_channel_attention , use_focal , focal_gamma . |
| Task | ResNet50 | RTM (no att.) | RTM (with att.) | RTMG | PM (no att.) | PM (with att.) | PMG |
|---|---|---|---|---|---|---|---|
| Weather condition classification | |||||||
| Weather Type | 0.8629 | 0.9949 | 0.9944 | 0.9605 | 0.9598 | 0.9792 | 0.9877 |
| Weather Intensity | 0.8486 | 0.9883 | 0.9908 | 0.9605 | 0.9434 | 0.9761 | 0.9845 |
| Visibility and sky condition | |||||||
| Visibility | 0.8542 | 0.9871 | 0.9865 | 0.9564 | 0.9382 | 0.9689 | 0.9778 |
| Sky Condition | 0.8686 | 0.9870 | 0.9873 | 0.9494 | 0.9491 | 0.9652 | 0.9821 |
| Model | Image2Weather (F1) | MWI (F1) | Kaggle (F1) |
|---|---|---|---|
| RTM (truncated, no att.) | 0.8014 | 0.8922 | 0.9660 |
| RTM (truncated, with att.) | 0.8109 | 0.9033 | 0.9800 |
| RTMG | 0.8153 | 0.8936 | 0.9730 |
| PM (no att.) | 0.7721 | 0.8387 | 0.9208 |
| PM (with att.) | 0.7567 | 0.8690 | 0.9389 |
| PMG | 0.7917 | 0.8774 | 0.9527 |
| MWI (20k images) [ 57 ] — metric: Accuracy | ||
| RTM | Acc = 0.9731 | classifier only |
| PMG | Acc = 0.9544 | classifier only |
| SLM3 (2024) [ 58 ] | Acc = 0.9001 | published value |
| WEAPD (6,877 images) [ 59 ] — metric: F1 | ||
| RTM | F1 = 0.9002 | classifier only |
| PMG | F1 = 0.7874 | classifier only |
Image Classification
Image classification assigns semantic labels to images, enabling recognition of objects, scenes, conditions, and fine-grained categories.
See all 390 papers