| license: mit | |
| library_name: pytorch | |
| pipeline_tag: image-classification | |
| tags: | |
| - thermal-imaging | |
| - anomaly-detection | |
| - resnet | |
| - lstm | |
| - pytorch | |
| # Thermal Pattern Analysis — CNN + Bi-LSTM | |
| Anomaly detection model for infrared thermal images of power transformers. | |
| ## Architecture | |
| 3-stage pipeline: | |
| 1. **Feature Extraction** — Modified ResNet-18 (grayscale input, 256-dim embeddings) | |
| 2. **Temporal Analysis** — Bidirectional LSTM + Self-Attention (128 hidden, 2 layers) | |
| 3. **Anomaly Detection** — Cosine similarity scorer (threshold: 0.7) | |
| ## Usage | |
| ```python | |
| import torch | |
| from huggingface_hub import hf_hub_download | |
| ckpt_path = hf_hub_download("Zorrojurro/thermal-pattern-analysis", "best_model.pt") | |
| ckpt = torch.load(ckpt_path, map_location="cpu", weights_only=False) | |
| # model.load_state_dict(ckpt["model_state_dict"]) | |
| # classifier.load_state_dict(ckpt["classifier_state_dict"]) | |
| ``` | |
| ## Demo | |
| Live demo: [Zorrojurro/thermal-backend](https://huggingface.co/spaces/Zorrojurro/thermal-backend) | |
| ## Training | |
| - Dataset: SciDB Infrared Thermal Image Dataset (895 IR images) | |
| - Optimizer: AdamW (lr: 3e-4) | |
| - Epochs: 100 with early stopping (patience: 25) | |
| - Image size: 224×224 grayscale | |