# Round 2 Training Data Summary

## 2D Feature Data Available for Training

### Primary Dataset: Parking Lots
- **GeoJSON Files**: 1,771 (per-image GeoJSON files)
- **Images with Data**: 1,771 (100% coverage in parking directory)
- **Total Features**: 47,753 parking lot polygons
- **Features per Image**: 27.0 (average)
- **Total Coverage**: ~2,900 hectares
- **Quality**: High density, well-distributed across images

**Training Suitability**: ⭐⭐⭐⭐⭐ Excellent
- Dense annotations (27 per image)
- Complete spatial coverage
- Consistent geometry types

---

### Alternative 2D Features

#### Sports Fields (Pitches)
- **Images with Data**: 4,506
- **Total Features**: 45,558 polygons
- **Features per Image**: 10.1
- **Total Coverage**: 15,370 hectares

#### Parks
- **Images with Data**: 4,570
- **Total Features**: 17,368 polygons
- **Features per Image**: 3.8
- **Total Coverage**: 111,564 hectares

#### Woodland
- **Images with Data**: 3,171
- **Total Features**: 24,341 polygons
- **Features per Image**: 7.7
- **Total Coverage**: 162,663 hectares

#### Wetlands
- **Images with Data**: 1,386
- **Total Features**: 6,120 polygons
- **Features per Image**: 4.4
- **Total Coverage**: 36,651 hectares

#### Industrial Areas
- **Images with Data**: 535
- **Total Features**: 1,627 polygons
- **Features per Image**: 3.0
- **Total Coverage**: 17,188 hectares

#### Golf Courses
- **Images with Data**: 499
- **Total Features**: 598 polygons
- **Features per Image**: 1.2
- **Total Coverage**: 20,733 hectares

#### Agricultural Fields
- **Images with Data**: 460
- **Total Features**: 1,484 polygons
- **Features per Image**: 3.2
- **Total Coverage**: 16,834 hectares

---

## Overall Statistics

| Metric | Value |
|--------|-------|
| **Total 2D GeoJSON Files** | 42,525 |
| **Total Features** | 97,096 |
| **Total Area Covered** | 381,003 hectares |
| **Unique Feature Types** | 8 |

---

## Recommended Training Approaches

### Option 1: Parking Lot Detector
**Best for: Focused 2D polygon detection**
- 1,771 labeled images
- 47,753 parking lot polygons
- High density (27/image)
- Complete coverage
- Polygon geometries well-defined
- **Suitable for**: Object detection, segmentation, instance segmentation

### Option 2: Multi-Class 2D Feature Detector
**Best for: Generalized feature detection**
- 4,570+ images (parks dataset provides most coverage)
- 97,096 total polygons across 8 classes
- Varied density (1-27 features/image)
- Geographic diversity
- **Suitable for**: Multi-class instance segmentation, transfer learning

### Option 3: Specific Feature Detectors
- **Sports Fields**: 4,506 images (45,558 features) - good for pitch detection
- **Parks**: 4,570 images (17,368 features) - moderate density
- **Woodland**: 3,171 images (24,341 features) - scattered distribution

---

## Data Format

### GeoJSON Structure
```json
{
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "properties": {
        "osm_way_id": "12345678",
        "leisure": "park",  // or other OSM tags
        "name": "Central Park",  // may be null
      },
      "geometry": {
        "type": "Polygon",
        "coordinates": [[lat,lon], ...]
      }
    }
  ]
}
```

### Coordinate System
- **CRS**: WGS84 (EPSG:4326) - latitude/longitude
- **Format**: GeoJSON standard [[lon, lat], ...]

### Image Format
- **Type**: USGS Round 2 satellite imagery (GeoTIFF)
- **Resolution**: 6 inches per pixel
- **Bands**: 4 (Red, Green, Blue, NIR)
- **CRS**: State Plane (EPSG:3443 for Illinois)

---

## File Locations

### GeoJSON Data
```
/home/hamiltka/2d_features/
├── round2_parking_full/          # 1,771 parking lot files
├── round2_sports_fields/         # 4,506 sports field files
├── round2_parks/                 # 4,570 park files
├── round2_woodland/              # 3,171 woodland files
├── round2_wetlands/              # 1,386 wetland files
├── round2_industrial_areas/      # 535 industrial files
├── round2_golf_courses/          # 499 golf course files
└── round2_agricultural_fields/   # 460 agricultural files
```

### Sample Overlays (visualization)
```
/home/hamiltka/2d_features/
├── agri_01-36_*.png              # Agricultural field overlays
├── golf_01-37_*.png              # Golf course overlays
├── sports_01-07_*.png            # Sports field overlays
├── parks_01-05_*.png             # Park overlays
├── wetlands_01-09_*.png          # Wetland overlays
├── woodland_01-08_*.png          # Woodland overlays
└── industrial_01-05_*.png        # Industrial area overlays
```

---

## Python Example: Loading Training Data

```python
import geopandas as gpd
from pathlib import Path
import pandas as pd

# Load parking lot data
parking_dir = Path("/home/hamiltka/2d_features/round2_parking_full")
parking_files = list(parking_dir.rglob("*.geojson"))

# Load and combine
parking_data = []
for file in parking_files:
    gdf = gpd.read_file(file)
    gdf['image_id'] = file.stem.split('_')[0]
    parking_data.append(gdf)

combined = pd.concat(parking_data, ignore_index=True)
parking_gdf = gpd.GeoDataFrame(combined, crs="EPSG:4326")

print(f"Loaded {len(parking_gdf)} parking lot polygons")
print(f"From {parking_gdf['image_id'].nunique()} unique images")

# Split train/val/test (e.g., 70/15/15)
image_ids = parking_gdf['image_id'].unique()
np.random.shuffle(image_ids)
split1 = int(0.7 * len(image_ids))
split2 = int(0.85 * len(image_ids))

train_ids = image_ids[:split1]
val_ids = image_ids[split1:split2]
test_ids = image_ids[split2:]

train_data = parking_gdf[parking_gdf['image_id'].isin(train_ids)]
val_data = parking_gdf[parking_gdf['image_id'].isin(val_ids)]
test_data = parking_gdf[parking_gdf['image_id'].isin(test_ids)]

print(f"Train: {len(train_data)} / Val: {len(val_data)} / Test: {len(test_data)}")
```

---

## Next Steps

1. **Data Validation**: Verify geometry quality and coverage
2. **Train/Val/Test Split**: Partition by image ID (not by polygon)
3. **Satellite Image Integration**: Load paired TIF files for each image_id
4. **Model Training**: Use appropriate architecture for polygon detection
5. **Augmentation**: Apply geometric/photometric augmentations

---

Generated: 2026-11-05
