Skip to page content
SAVRN
Search Plan a project

Dataset · Image segmentation

massachusetts-roads

by Lam Tran lammtfkday/massachusetts-roads

High-resolution aerial imagery benchmark for remote sensing road extraction, based on the canonical Massachusetts Roads dataset introduced by Volodymyr Mnih (2013).

Rows—
Configurations—
Size1.1 GB
Licensemit
AccessPublicly accessible
Monthly Downloads—

Dataset Card

By Lam Tran, published under mit, revision 7300d99726d4.

Massachusetts Roads Benchmark Dataset

High-resolution aerial imagery benchmark for remote sensing road extraction, based on the canonical Massachusetts Roads dataset introduced by Volodymyr Mnih (2013).

Dataset Overview

The Massachusetts Roads Dataset covers diverse urban, suburban, coastal, and forested rural environments throughout the Commonwealth of Massachusetts. - Image Resolution: $1500 \times 1500$ pixels per tile. - Ground Sampling Distance (GSD): $1.0\text{ m/pixel}$. - Channels: 3-channel RGB optical imagery (*_sat.jpg). - Ground Truth: Binary road segmentation masks (*_mask.png), where pixel value 255 (or 1) denotes road corridors rasterized from OpenStreetMap with an approximate line width of 7 pixels, and 0 denotes background.

Benchmark Partition

Standard benchmark partition for road extraction research: | Split | Tiles | Images | Binary Masks | Description | |---|---|---|---|---| | Training (train) | 540 | 540 | 540 | Training set partitioned from the standard 600-image training pool (seed 42) | | Validation (val) | 60 | 60 | 60 | Held-out validation split for model selection & threshold calibration | | Testing (test) | 178 | 178 | 178 | Standard official evaluation benchmark | | Total | 778 | 778 | 778 | Full benchmark corpus |

Directory Structure

massachusetts/
├── metadata.csv                # Complete index (split, tile_id, image_path, mask_path, resolution)
├── train/
│   ├── images/                 # 540 aerial tiles (*_sat.jpg)
│   └── masks/                  # 540 road masks (*_mask.png)
├── val/
│   ├── images/                 # 60 aerial tiles (*_sat.jpg)
│   └── masks/                  # 60 road masks (*_mask.png)
└── test/
    ├── images/                 # 178 aerial tiles (*_sat.jpg)
    └── masks/                  # 178 road masks (*_mask.png)

Quick Start & Usage

1. Fast Download via Python (huggingface_hub)

import zipfile
from huggingface_hub import hf_hub_download

# Download the complete benchmark archive (~530 MB)
zip_file = hf_hub_download(
    repo_id="lammtfkday/massachusetts-roads",
    filename="datasetmassa.zip",
    repo_type="dataset"
)

# Extract into local data folder
with zipfile.ZipFile(zip_file, "r") as zf:
    zf.extractall("./data")

2. Downloading Individual Splits

from huggingface_hub import hf_hub_download

train_zip = hf_hub_download(repo_id="lammtfkday/massachusetts-roads", filename="train.zip", repo_type="dataset")
val_zip   = hf_hub_download(repo_id="lammtfkday/massachusetts-roads", filename="val.zip", repo_type="dataset")
test_zip  = hf_hub_download(repo_id="lammtfkday/massachusetts-roads", filename="test.zip", repo_type="dataset")

3. PyTorch Dataset Loader

import cv2
import torch
from pathlib import Path
from torch.utils.data import Dataset

class MassachusettsRoadDataset(Dataset):
    def __init__(self, root_dir, split="train", transform=None):
        self.img_dir = Path(root_dir) / split / "images"
        self.mask_dir = Path(root_dir) / split / "masks"
        self.images = sorted(list(self.img_dir.glob("*_sat.jpg")))
        self.transform = transform

    def __len__(self):
        return len(self.images)

    def __getitem__(self, idx):
        img_path = self.images[idx]
        mask_path = self.mask_dir / img_path.name.replace("_sat.jpg", "_mask.png")
        image = cv2.cvtColor(cv2.imread(str(img_path)), cv2.COLOR_BGR2RGB)
        mask = cv2.imread(str(mask_path), cv2.IMREAD_GRAYSCALE)
        mask = (mask > 127).astype("float32")
        if self.transform:
            augmented = self.transform(image=image, mask=mask)
            image, mask = augmented["image"], augmented["mask"]
        return torch.tensor(image).permute(2, 0, 1) / 255.0, torch.tensor(mask).unsqueeze(0)

Citations

If you use this dataset in your research, please cite:

@phdthesis{mnih2013aerial,
  title={Machine Learning for Aerial Image Labeling},
  author={Mnih, Volodymyr},
  year={2013},
  school={University of Toronto}
}

Details

Repository
lammtfkday/massachusetts-roads
Publisher
Lam Tran
Task category
Image segmentation
Tags
remote-sensing, road-extraction, aerial-imagery
Size category
n<1K
Languages
en
Revision
7300d99726d4ad618af85ff2d13d5338cd291bdd
Last updated
2026-09-25

Files

19 files, 1.1 GB in total.

Data5 files · 1.1 GB
Documentation1 file · 4.7 KB
Other12 files · 4.0 MB
Repository1 file · 2.5 KB
Every file
FileTypeSizeSHA-256
datasetmassa.zipData539.5 MB895f6f5fcc53
metadata.csvData69.2 KB—
test.zipData123.7 MB2df4bcc73f13
train.zipData373.1 MBf61dd06beb77
val.zipData42.6 MBd38f1dd69260
README.mdDocumentation4.7 KB—
samples/10078675_mask.pngOther11.9 KB105e46237716
samples/10078675_sat.jpgOther614.3 KB989d21cf3fda
samples/10228675_mask.pngOther10.9 KB9b2986717b59
samples/10228675_sat.jpgOther563.1 KB75b44dccde43
samples/10228735_mask.pngOther20.5 KB1d19f260c186
samples/10228735_sat.jpgOther619.3 KB08c8acf16b80
samples/23429140_mask.pngOther31.9 KBc5dbc9acdde5
samples/23429140_sat.jpgOther724.4 KBd96d081adcb2
samples/24629215_mask.pngOther36.5 KB24848f338340
samples/24629215_sat.jpgOther684.3 KBaaca6c5ba286
samples/27028720_mask.pngOther35.3 KB146a8b2ad118
samples/27028720_sat.jpgOther630.8 KBf63decfc411d
.gitattributesRepository2.5 KB—

License and Download

License
mit
Access
No access gate
Download from Lam Tran

Released by Lam Tran through its official repository on Hugging Face. Read the license.