The objective of this challenge is to develop a machine learning model capable of accurately detecting and counting solar panels and solar boilers in satellite and drone imagery of Madagascar.
# **Lacuna Solar Survey Challenge – EfficientNetB5 Baseline**
This project provides a full PyTorch-based training pipeline for the **Lacuna Solar Survey Challenge** on Kaggle.
It predicts **boil number** and **pan number** from solar panel images using a **deep learning regression model** with **metadata fusion**.
---
## **Overview**
The pipeline combines **image features** extracted by an EfficientNetV2 backbone with **metadata embeddings** (panel placement and image origin).
It implements a **5-Fold Stratified Cross-Validation** setup for robust training and evaluation, and uses **Test-Time Augmentation (TTA)** for improved predictions.
---
## **Main Features**
✅ Full end-to-end deep learning pipeline (train → validate → predict)
✅ EfficientNetV2 backbone from `timm` with pretrained weights
✅ Metadata embeddings for `img_origin` and `placement`
✅ Albumentations-based augmentation for better generalization
✅ Automatic fold assignment using Stratified K-Fold
✅ Mixed-precision training with gradient scaling (`torch.cuda.amp`)
✅ Test-Time Augmentation (horizontal flip averaging)
---
## **Project Structure**
```
📁 /kaggle/input/lacuna-solar-survey-challenge/
├── Train.csv
├── images/
│ ├── 0001.jpg
│ ├── 0002.jpg
│ └── ...
```
- **Train.csv** — Contains metadata and target variables (`boil_nbr`, `pan_nbr`).
- **images/** — Contains corresponding `.jpg` files named by `ID`.
---
## **Model Architecture**
- **Backbone:** `tf_efficientnet_b5` (from `timm`)
- **Metadata Embeddings:**
- `img_origin` → Embedding(2, 8)
- `placement` → Embedding(2, 8)
- **Fusion Layer:** Concatenation of image + metadata features
- **Head:** Two fully connected layers for regression output (2 targets)
---
## **Installation**
Run in **Kaggle** or **Google Colab** environment with GPU support.
```bash
!pip install timm albumentations
```
---
## **Usage**
1. **Check GPU**
```python
!nvidia-smi …