CoolFace
Datasetpublic

Lexxurius/LMDB_Overhead_Geopose

πŸ“¦ Geocentric Height Regression Dataset Large-scale, preprocessed dataset for dense height regression of anthropogenic objects from single satellite RGB imagery. Optimized for streaming PyTorch training with PyArrow and IterableDataset. πŸ“– Overview This dataset contains 256Γ—256 patches extracted from satellite RGB imagery and corresponding Above-Ground Level (AGL) height maps (DSM). Each patch includes a binary validity mask and capture metadata, enabling… See the full description on the dataset page: https://huggingface.co/datasets/Lexxurius/LMDB_Overhead_Geopose.

sourceHugging Facemitupdated 5mo agoView on Hugging Face
0likes38downloads
Dataset Card

πŸ“¦ Geocentric Height Regression Dataset

Large-scale, preprocessed dataset for dense height regression of anthropogenic objects from single satellite RGB imagery. Optimized for streaming PyTorch training with PyArrow and IterableDataset.

πŸ“– Overview

This dataset contains 256Γ—256 patches extracted from satellite RGB imagery and corresponding Above-Ground Level (AGL) height maps (DSM). Each patch includes a binary validity mask and capture metadata, enabling robust training for dense regression tasks in geospatial computer vision.

Key Features:

  • β€”βœ… Streaming-Optimized Format: Stored in Apache Parquet for batch-wise reading without loading the entire dataset into RAM.
  • β€”πŸ” No-Data Filtering: Patches with >30% invalid/no-data pixels are automatically filtered during preprocessing.
  • β€”πŸŒ Capture Metadata: Ground Sampling Distance (GSD), off-nadir angle, and scale coefficients are preserved per patch.
  • β€”πŸ“ˆ Precomputed Statistics: Regional and globally pooled mean/std values for precise RGB and height normalization.

πŸ“ Directory Structure

dataset/
                # Preprocessed Parquet files (one per region)
β”œβ”€β”€ dataset_region1.parquet
β”œβ”€β”€ dataset_region2.parquet
└── ...              
└── README.md                   

πŸ“Š Data Schema (Parquet)

ColumnTypeDescription
patch_idstringUnique identifier: `region\image_id\row\col`
regionstringGeographic region / location code
image_idstringOriginal satellite image identifier
row, colint32Grid coordinates of the patch within the source image
imagebinaryRGB pixel data: uint8, flattened array of shape (256, 256, 3)
heightbinaryHeight map data: uint16, flattened array of shape (256, 256)
maskbinaryValidity mask: uint8, 1 = valid pixel, 0 = no-data / missing
gsdfloat32Ground Sampling Distance in meters per pixel
anglefloat32Sensor off-nadir / viewing angle in radians
scalefloat32Preprocessing scale factor (if applied)
πŸ’‘ Decoding Binary Columns: ``python rgb = np.frombuffer(row["image"], dtype=np.uint8).reshape(256, 256, 3) h = np.frombuffer(row["height"], dtype=np.uint16).reshape(256, 256) mask = np.frombuffer(row["mask"], dtype=np.uint8).reshape(256, 256) ``

πŸ›  Preprocessing Pipeline

  1. 1.Source Ingestion: Reads JPEG2000/JP2 (RGB), GeoTIFF (AGL heights), and JSON (metadata).
  2. 2.Patch Extraction: Splits images into 256Γ—256 non-overlapping tiles (stride = size).
  3. 3.No-Data Filtering: Discards patches where the fraction of NO_DATA_VALUE pixels exceeds NO_DATA_THRESHOLD (default: 0.3).
  4. 4.Serialization: Converts NumPy arrays to raw bytes via .tobytes() for compact storage.
  5. 5.Streaming Parquet Writes: Incrementally writes batches using pyarrow.parquet.ParquetWriter with Snappy compression.
  6. 6.Statistics Aggregation: Computes per-region mean/std, then pools them globally using variance aggregation.

πŸ“ Normalization & Statistics

Global normalization is computed via variance pooling to avoid bias from regional imbalances:

Var_global = Ξ£( (Var_i + Mean_iΒ²) * N_i ) / N_total  -  Mean_globalΒ²
ModalityNormalization Formula
RGB(img / 255.0 - rgb_mean) / rgb_std
Height(height - h_mean) / h_std

Regional statistics are stored in stats/{region}.json. The training pipeline automatically computes the weighted global mean/std at runtime.


πŸš€ Quick Start

1. Basic Loading & Decoding (PyArrow + Pandas)

python
import pyarrow.parquet as pq
import numpy as np

table = pq.read_table("dataset/processed/dataset_region1.parquet")
df = table.to_pandas()

# Decode the first patch
row = df.iloc[0]
rgb  = np.frombuffer(row["image"],  dtype=np.uint8).reshape(256, 256, 3)
h    = np.frombuffer(row["height"], dtype=np.uint16).reshape(256, 256)
mask = np.frombuffer(row["mask"],   dtype=np.uint8).reshape(256, 256)

2. Streaming PyTorch Dataset

Use the provided StreamHeightDataset (see training notebook):

python
from torch.utils.data import DataLoader

dataset = StreamHeightDataset(
    parquet_files=train_files,
    rgb_mean=RGB_MEAN, rgb_std=RGB_STD,
    h_mean=H_MEAN, h_std=H_STD,
    height_dtype=np.uint16,  # ⚠️ Must match preprocessing output
    mode="train"
)
loader = DataLoader(dataset, batch_size=16, num_workers=2, pin_memory=True, drop_last=True)

3. Training Pipeline

The companion notebook train_height_regression.ipynb includes:

  • β€”DeepLabV3Plus + EfficientNetB3 backbone (segmentation_models_pytorch)
  • β€”MaskedSmoothL1Loss with validity mask support
  • β€”Mixed Precision (torch.cuda.amp) + Gradient Accumulation
  • β€”Weights & Biases logging, automatic best-model checkpointing, and prediction visualization

πŸ“¦ Requirements

bash
pip install pyarrow pandas numpy torch torchvision \
            segmentation-models-pytorch wandb matplotlib \
            scikit-learn tqdm

πŸ’‘ Best Practices & Troubleshooting

ScenarioRecommendation
RAM < 16 GBUse IterableDataset with batched Parquet reading (iter_batches(size=1024)). Never call to_pandas() on full files.
VRAM < 8 GBSet BATCH_SIZE=8 and accumulation_steps=2 in the training loop.
Height decoding artifactsVerify height_dtype matches the exact type (np.uint16).
Overfitting / Poor generalizationAdd on-the-fly augmentations: RandomHorizontalFlip, ColorJitter, RandomAffine inside __iter__.
Missing GSD valuesThe pipeline uses a configurable fallback strategy (skip, median_region, or global_median).

πŸ“œ License & Citation

This dataset is released under the [MIT]. Please cite this repository if used in academic research, competitions, or commercial projects.


πŸ“¬ Support & Contact

  • β€”πŸ› Bug Reports & Feature Requests: Open an issue in the repository
  • β€”πŸ’¬ Discussion & Experiments: Use the Discussions tab or community forums
  • β€”πŸŒ Demo Notebook: [Link to Kaggle / Colab]

Designed for production-ready geospatial ML pipelines. Dataset version: `v1.0` πŸš€