Solar Panel Detection with RT-DETR

Fine-tuned RT-DETR (Real-Time Detection Transformer) for detecting solar panels and their conditions in aerial/satellite imagery.

Model Details

  • Base Model: PekingU/rtdetr_r50vd_coco_o365 (pretrained on COCO + Objects365)
  • Architecture: RT-DETR with ResNet-50-vd backbone
  • Task: Object Detection (bounding box prediction)
  • Image Size: 640×640
  • Classes (6): solar-panels, Cell, Cell-Multi, No-Anomaly, Shadowing, Unclassified

Training Details

  • Dataset: Francesco/solar-panels-taxvb (112 train / 19 val / 30 test images)
  • Epochs: 100
  • Batch Size: 8
  • Learning Rate: 5e-5 (cosine schedule with 5% warmup)
  • Optimizer: AdamW (weight_decay=1e-4)
  • Gradient Clipping: max_grad_norm=0.01
  • Precision: FP16
  • Augmentations: Perspective, HorizontalFlip, VerticalFlip, RandomBrightnessContrast, HueSaturationValue, RandomRotate90

Usage

from transformers import AutoImageProcessor, AutoModelForObjectDetection
from PIL import Image
import torch

# Load model and processor
model = AutoModelForObjectDetection.from_pretrained("Raidenop/solar-panels-rtdetr")
processor = AutoImageProcessor.from_pretrained("Raidenop/solar-panels-rtdetr")

# Load image
image = Image.open("your_image.jpg")

# Inference
with torch.no_grad():
    inputs = processor(images=[image], return_tensors="pt")
    outputs = model(**inputs)
    target_sizes = torch.tensor([[image.size[1], image.size[0]]])
    results = processor.post_process_object_detection(
        outputs, threshold=0.3, target_sizes=target_sizes
    )[0]

# Print results
for score, label, box in zip(results["scores"], results["labels"], results["boxes"]):
    box = [round(i, 2) for i in box.tolist()]
    print(f"Detected {model.config.id2label[label.item()]} with confidence {round(score.item(), 3)} at {box}")

Training Script

The full training script is available in this repository: train.py

To run training:

pip install transformers datasets accelerate torch torchvision trackio albumentations>=1.4.5 torchmetrics pycocotools timm
python train.py

Requirements: NVIDIA GPU with 16GB+ VRAM (T4, A10G, or better)

References

Generated by ML Intern

This model repository was generated by ML Intern, an agent for machine learning research and development on the Hugging Face Hub.

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for Raidenop/solar-panels-rtdetr

Finetuned
(25)
this model

Dataset used to train Raidenop/solar-panels-rtdetr

Paper for Raidenop/solar-panels-rtdetr