Francesco/solar-panels-taxvb
Viewer • Updated • 161 • 176 • 3
Fine-tuned RT-DETR (Real-Time Detection Transformer) for detecting solar panels and their conditions in aerial/satellite imagery.
solar-panels, Cell, Cell-Multi, No-Anomaly, Shadowing, Unclassifiedfrom 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}")
The full training script is available in this repository: train.py
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)
This model repository was generated by ML Intern, an agent for machine learning research and development on the Hugging Face Hub.
Base model
PekingU/rtdetr_r50vd_coco_o365