pawlo2013's picture
Update README.md
4131906 verified
---
license: mit
task_categories:
- image-feature-extraction
language:
- en
tags:
- sentinel
- satelite
- photo
- earthloc
pretty_name: 'EarthLoc 2021 Database '
size_categories:
- 100K<n<1M
---
# 🌍 Sentinel 2021 Image WebDataset
This dataset contains 150k 1024x1024 satellite images accross (9,10,11) zooms and bounded within (-60,60) latitude.
Stored using the [WebDataset](https://github.com/webdataset/webdataset) format.
The data is **sharded across 11 `.tar` archives**, and each sample contains:
- A JPEG image `.jpg`
- A unique key `__key__` corresponding to the original image path
- Companion **`.index`** file for fast random access stored next to the shard
This key encodes all relevant **metadata** about the image, including its bounding box, nadir, zoom, area parameters.
## Note this is not the whole data used to train the model. 3 more datasets are needed for years 2018,2019,2020 you can download them from https://github.com/gmberton/EarthLoc if you want to train from scratch.
---
## 🗂️ Dataset Structure
Each shard (e.g., `shard-000000.tar`) contains up to 15,000 samples. Every sample includes:
- `jpg`: The image bytes (decoded automatically)
- `__key__`: A string derived from the image's original path
The key format encodes metadata in the filename using the following structure:
@ lat1 @ lon1 @ lat2 @ lon2 @ lat3 @ lon3 @ lat4 @ lon4
@ image_id @ timestamp @ nadir_lat @ nadir_lon @ sq_km_area @ orientation @.jpg
> Commas (`,`) in the keys have been used to replace dots (`.`) due to WebDataset's format. You’ll need to reverse this replacement (`replace(',', '.')`) when decoding.
For more details on how the key structure encodes geospatial metadata, refer to the [EarthLoc repository](https://github.com/gmberton/EarthLoc).
---
![image/png](https://cdn-uploads.huggingface.co/production/uploads/635d011579599a4f7dab0613/Vyfyx4iEPFzQTXersMLzU.png)
## 🧪 Example: Displaying the First Image in a Shard
You can inspect a sample using the following code in a Jupyter notebook:
```python
import webdataset as wds
from PIL import Image
import matplotlib.pyplot as plt
# Path to a WebDataset .tar file
tar_path = "./shard-000000.tar"
# Create a WebDataset iterator
dataset = wds.WebDataset(tar_path).decode("pil")
# Load the first sample
sample = next(iter(dataset))
# Access image and key
image = sample["jpg"] # PIL Image
key = sample["__key__"].replace(',', '.')
# Display the image
plt.imshow(image)
plt.axis("off")
plt.title(f"Key: {key}")
plt.show()
# Print the key (for metadata parsing)
print(f"Key: {key}")