Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
98 changes: 98 additions & 0 deletions docs/source/datasets/aid_scene.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
AID Scene Classification
========================

.. raw:: html

<p style="display: flex; gap: 10px;">
<img src="https://img.shields.io/badge/Task-Scene%20Classification-blue" alt="Task: Scene Classification">
<img src="https://img.shields.io/badge/Classes-30-green" alt="Classes: 30">
<img src="https://img.shields.io/badge/Domain-Remote%20Sensing-orange" alt="Domain: Remote Sensing">
</p>

Overview
--------

AID (Aerial Image Dataset) is a remote sensing scene classification dataset with 30 scene categories such as airport, port, forest, and residential areas.

This builder downloads the archive from Kaggle and exposes it as a single split:

- **all**: all samples across all 30 classes

Data Structure
--------------

When accessing an example with ``ds[i]``, the sample contains:

.. list-table::
:header-rows: 1
:widths: 20 20 60

* - Key
- Type
- Description
* - ``image``
- ``PIL.Image.Image``
- RGB aerial scene image
* - ``label``
- int
- Scene class index (0-29)

Usage Example
-------------

.. code-block:: python

from stable_datasets.images.aid_scene import AIDScene

ds = AIDScene(split="all")

sample = ds[0]
print(sample.keys()) # {"image", "label"}
print(ds.info.features["label"].names)

Kaggle Requirements
-------------------

This dataset is downloaded with the **Kaggle CLI**. Install it and configure an API key:

.. code-block:: bash

pip install kaggle

**Option A — token file (recommended)**

.. code-block:: bash

mkdir -p ~/.kaggle
mv ~/Downloads/kaggle.json ~/.kaggle/kaggle.json
chmod 600 ~/.kaggle/kaggle.json

Create ``kaggle.json`` from Kaggle: **Account → API → Create New Token**.

**Option B — environment variables (current shell only)**

.. code-block:: bash

export KAGGLE_USERNAME="<your_kaggle_username>"
export KAGGLE_KEY="<your_api_key>"

References
----------

- Kaggle dataset: https://www.kaggle.com/datasets/jiayuanchengala/aid-scene-classification-datasets

Citation
--------

.. code-block:: bibtex

@article{xia2017aid,
title={AID: A benchmark data set for performance evaluation of aerial scene classification},
author={Xia, Gui-Song and Hu, Jingwen and Hu, Fan and Shi, Baoguang and Bai, Xiang and Zhong, Yanfei and Zhang, Liangpei and Lu, Xiaoqiang},
journal={IEEE Transactions on Geoscience and Remote Sensing},
volume={55},
number={7},
pages={3965--3981},
year={2017},
publisher={IEEE}
}
2 changes: 2 additions & 0 deletions docs/source/datasets/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ Available Datasets

arabic_characters
arabic_digits
aid_scene
cifar10
cifar100
cifar10_c
Expand All @@ -68,6 +69,7 @@ Available Datasets
country211
galaxy10
hasy_v2
inria_aerial_image_labeling
face_pointing
rock_paper_scissor
linnaeus5
Expand Down
112 changes: 112 additions & 0 deletions docs/source/datasets/inria_aerial_image_labeling.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
Inria Aerial Image Labeling
===========================

.. raw:: html

<p style="display: flex; gap: 10px;">
<img src="https://img.shields.io/badge/Task-Semantic%20Segmentation-blue" alt="Task: Semantic Segmentation">
<img src="https://img.shields.io/badge/Classes-2%20(building%2Fbackground)-green" alt="Classes: 2">
<img src="https://img.shields.io/badge/Domain-Remote%20Sensing-orange" alt="Domain: Remote Sensing">
</p>

Overview
--------

The `Inria Aerial Image Labeling`_ benchmark provides high-resolution aerial orthophotos (0.3 m) with pixel-wise labels for **building** vs. **not building**. Training tiles include public ground truth; the official test set is images only (no public masks), so in this builder the **test** split returns ``mask=None``.

Raw archives are downloaded from the Kaggle mirror `sagar100rathod/inria-aerial-image-labeling-dataset` (see `Kaggle dataset`_). Always cite the original paper and follow the dataset license from the official site.

.. _`Inria Aerial Image Labeling`: https://project.inria.fr/aerialimagelabeling/
.. _`Kaggle dataset`: https://www.kaggle.com/datasets/sagar100rathod/inria-aerial-image-labeling-dataset

Data Structure
--------------

.. list-table::
:header-rows: 1
:widths: 20 20 60

* - Key
- Type
- Description
* - ``image``
- ``PIL.Image.Image``
- RGB orthophoto (often large GeoTIFF decoded by Pillow)
* - ``mask``
- ``PIL.Image.Image`` or ``None``
- Training: label mask aligned with the image; test: ``None`` (no public GT)

Splits
------

- **train**: paired ``image`` and ``mask``
- **test**: ``image`` only if a test image folder is present in the archive; ``mask`` is ``None``

Usage Example
-------------

.. code-block:: python

from stable_datasets.images.inria_aerial_image_labeling import InriaAerialImageLabeling

train_ds = InriaAerialImageLabeling(split="train")
sample = train_ds[0]
print(sample.keys()) # {"image", "mask"}

# Optional: load all splits as a dict
ds_all = InriaAerialImageLabeling(split=None)

Kaggle setup
------------

Install the **Kaggle CLI** and configure an **API key** (same pattern as other Kaggle-backed builders):

.. code-block:: bash

pip install kaggle

**Option A — token file (recommended)**

.. code-block:: bash

mkdir -p ~/.kaggle
mv ~/Downloads/kaggle.json ~/.kaggle/kaggle.json
chmod 600 ~/.kaggle/kaggle.json

Create ``kaggle.json`` from Kaggle: **Account → API → Create New Token**.

**Option B — environment variables (current shell only)**

.. code-block:: bash

export KAGGLE_USERNAME="<your_kaggle_username>"
export KAGGLE_KEY="<your_api_key>"

Run the dataset test (downloads a large archive; requires Kaggle auth above):

.. code-block:: bash

pytest -q -rs stable_datasets/tests/images/test_inria_aerial_image_labeling.py

The test is marked ``large`` because of download size and processing time.

If ``kaggle datasets download`` dies with **SIGKILL** (exit code -9), the process was usually killed by the OS for **low memory** while handling the large zip—not because your API key is wrong. Free RAM, download the archive in a normal terminal first, delete any partial zip, then run the test again.

References
----------

- Official dataset: https://project.inria.fr/aerialimagelabeling/
- Kaggle mirror: https://www.kaggle.com/datasets/sagar100rathod/inria-aerial-image-labeling-dataset

Citation
--------

.. code-block:: bibtex

@inproceedings{maggiori2017dataset,
title={Can Semantic Labeling Methods Generalize to Any City? The Inria Aerial Image Labeling Benchmark},
author={Maggiori, Emmanuel and Tarabalka, Yuliya and Charpiat, Guillaume and Alliez, Pierre},
booktitle={IEEE International Geoscience and Remote Sensing Symposium (IGARSS)},
year={2017},
organization={IEEE}
}
4 changes: 4 additions & 0 deletions stable_datasets/images/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from .arabic_characters import ArabicCharacters
from .arabic_digits import ArabicDigits
from .aid_scene import AIDScene
from .awa2 import AWA2
from .beans import Beans
from .cars3d import Cars3D
Expand Down Expand Up @@ -31,6 +32,7 @@
from .imagenet_1k import ImageNet1K
from .imagenet_10 import Imagenette
from .imagenet_100 import ImageNet100
from .inria_aerial_image_labeling import InriaAerialImageLabeling
from .k_mnist import KMNIST
from .linnaeus5 import Linnaeus5
from .med_mnist import MedMNIST
Expand All @@ -50,6 +52,7 @@
__all__ = [
"ArabicCharacters",
"ArabicDigits",
"AIDScene",
"AWA2",
"Beans",
"Cars196",
Expand Down Expand Up @@ -77,6 +80,7 @@
"ImageNet1K",
"ImageNet100",
"Imagenette",
"InriaAerialImageLabeling",
"KMNIST",
"Linnaeus5",
"MedMNIST",
Expand Down
Loading