|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"""ZOD dataset loading script.""" |
|
|
|
import csv |
|
import json |
|
import os |
|
|
|
import datasets |
|
|
|
_CITATION = """\ |
|
@article{, |
|
title= {ZOD Frames}, |
|
journal= {Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV)}, |
|
author= {Mina Alibeigi and William Ljungbergh and Adam Tonderski and Georg Hess and Adam Lilja and Carl Lindstrom and Daria Motorniuk and Junsheng Fu and Jenny Widahl and Christoffer Petersson}, |
|
year= {2023}, |
|
url= {https://zod.zenseact.com/}, |
|
abstract= {Existing datasets for autonomous driving (AD) often lack diversity and long-range capabilities, focusing instead on 360◦ perception and temporal reasoning. To address this gap, we introduce ZOD, a large-scale and diverse multimodal dataset collected over two years in various European countries, covering an area 9× that of existing datasets. ZOD boasts the highest range and resolution sensors among comparable datasets, coupled with detailed keyframe annotations for 2D and 3D objects (up to 245m), road instance/semantic segmentation, traffic sign recognition, and road classification. We believe that this unique combination will facilitate breakthroughs in long-range perception and multi-task learning. The dataset is composed of Frames, Sequences, and Drives, designed to encompass both data diversity and support for spatio-temporal learning, sensor fusion, localization, and mapping. Frames consist of 100k curated camera images with two seconds of other supporting sensor data, while the 1473 Sequences and 29 Drives include the entire sensor suite for 20 seconds and a few minutes, respectively. ZOD is the only AD dataset released under the permissive CC BY-SA 4.0 license, allowing for both research and commercial use. More information, and an extensive devkit, can be found at zod.zenseact.com.}, |
|
keywords= {Computer Vision, autonomous driving, object detection, semantic segmentation, traffic sign classification}, |
|
license= {CC BY-SA}, |
|
terms= {}, |
|
superseded= {}""" |
|
|
|
_DESCRIPTION = """\ |
|
The Zenseact Open Dataset (ZOD) is a large multi-modal autonomous driving (AD) dataset, created by researchers at Zenseact. It was collected over a 2-year period in 14 different European counties, using a fleet of vehicles equipped with a full sensor suite. The dataset consists of three subsets: Frames, Sequences, and Drives, designed to encompass both data diversity and support for spatiotemporal learning, sensor fusion, localization, and mapping. Together with the data, we have developed a SDK containing tutorials, downloading functionality, and a dataset API for easy access to the data. The development kit is available on Github. |
|
""" |
|
|
|
_HOMEPAGE = "https://zod.zenseact.com/" |
|
|
|
_LICENSE = """ |
|
The Zenseact Open Dataset (ZOD) is the property of Zenseact AB (© 2022 Zenseact AB) and is licensed under the permissive CC BY-SA. Any public use, distribution, or display of this dataset must contain this entire notice: |
|
|
|
For this dataset, Zenseact AB has taken all reasonable measures to remove all personally identifiable information, including faces and license plates. To the extent that you like to request removal of specific images from the dataset, please contact [email protected]. |
|
""" |
|
|
|
|
|
_URLS = { |
|
"first_domain": None, |
|
"second_domain": None, |
|
} |
|
|
|
|
|
class ZODDataset(datasets.GeneratorBasedBuilder): |
|
"""Zenseact Open Dataset (ZOD) is a large-scale and diverse multimodal autonomous |
|
driving dataset collected over two years in various European countries. It |
|
contains a wide range of traffic scenarios of real-world driving, collected under |
|
different weather and lighting conditions. |
|
|
|
ZOD contains a significant number of high-quality and detailed annotations for |
|
several perception tasks.""" |
|
|
|
VERSION = datasets.Version("2.0.0") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BUILDER_CONFIGS = [ |
|
datasets.BuilderConfig(name="mini", version=VERSION, |
|
description="Mini version"), |
|
|
|
|
|
|
|
] |
|
|
|
def _info(self): |
|
if self.config.name == "mini": |
|
|
|
features = datasets.Features( |
|
{ |
|
"id": datasets.Value("string"), |
|
"camera_frames": |
|
{'front_blur': datasets.Sequence( |
|
feature={ |
|
'image': datasets.Image(decode=True), |
|
'time': datasets.Value("string"), |
|
'height': datasets.Value("int32"), |
|
'width': datasets.Value("int32"), |
|
}, |
|
length=-1), |
|
'front_dnat': datasets.Sequence( |
|
feature={ |
|
'image': datasets.Image(decode=True), |
|
'time': datasets.Value("string"), |
|
'height': datasets.Value("int32"), |
|
'width': datasets.Value("int32"), |
|
}, |
|
length=-1), |
|
}, |
|
"road_condition": { |
|
"wetness": datasets.Value("bool"), |
|
"snow_coverage": datasets.Value("bool"), |
|
}, |
|
} |
|
) |
|
|
|
return datasets.DatasetInfo( |
|
|
|
description=_DESCRIPTION, |
|
|
|
features=features, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
homepage=_HOMEPAGE, |
|
license=_LICENSE, |
|
citation=_CITATION, |
|
) |
|
|
|
def _split_generators(self, dl_manager): |
|
|
|
|
|
|
|
data_dir = dl_manager.manual_dir |
|
return [ |
|
datasets.SplitGenerator( |
|
name=datasets.Split.TRAIN, |
|
|
|
gen_kwargs={ |
|
"data_dir": data_dir, |
|
"metadata_path": |
|
os.path.join(data_dir, "trainval-frames-mini.json"), |
|
"split": "train", |
|
}, |
|
), |
|
datasets.SplitGenerator( |
|
name=datasets.Split.VALIDATION, |
|
|
|
gen_kwargs={ |
|
"data_dir": data_dir, |
|
"metadata_path": |
|
os.path.join(data_dir, "trainval-frames-mini.json"), |
|
"split": "val", |
|
}, |
|
), |
|
] |
|
|
|
|
|
def _generate_examples(self, data_dir, metadata_path, split): |
|
if not os.path.exists(data_dir): |
|
raise FileNotFoundError( |
|
f"{data_dir} does not exist." |
|
f"{self.manual_download_instructions}" |
|
) |
|
with open(metadata_path, "r") as f: |
|
all_metadata = json.load(f) |
|
split_metadata = all_metadata[split] |
|
for sample_metadata in split_metadata: |
|
annotations_keys = list(sample_metadata["annotations"].keys()) |
|
annotations_dict = {} |
|
for annotations_key in annotations_keys: |
|
annot_part_path = sample_metadata["annotations"][annotations_key]["filepath"] |
|
annot_full_path = os.path.join(data_dir, annot_part_path) |
|
with open(annot_full_path) as f: |
|
annotations = json.load(f) |
|
annotations_dict[annotations_key] = annotations |
|
|
|
|
|
camera_frames = sample_metadata["camera_frames"] |
|
list_of_frames = camera_frames["front_blur"] |
|
for camera_frame in list_of_frames: |
|
camera_frame["image"] = os.path.join(data_dir, camera_frame["filepath"]) |
|
camera_frame.pop("filepath") |
|
list_of_frames = camera_frames["front_dnat"] |
|
for camera_frame in list_of_frames: |
|
camera_frame["image"] = os.path.join(data_dir, camera_frame["filepath"]) |
|
camera_frame.pop("filepath") |
|
|
|
yield sample_metadata["id"], { |
|
"id": sample_metadata["id"], |
|
"camera_frames": {**camera_frames}, |
|
"road_condition": {**annotations_dict["road_condition"]}, |
|
} |
|
|
|
@property |
|
def manual_download_instructions(self): |
|
return ("To use ZOD dataset you have to download it manually, then pass the " |
|
"path to the data_dir parameter of load_dataset.\n" |
|
"Please send your request based on the information on this website: " |
|
"https://zod.zenseact.com/download/. " |
|
"You will receive a download link after your application is approved." |
|
"We recommend utilizing the CLI tool from our development kit for a smoother download experience." |
|
"Full instructions can be found in the devkit README available at https://github.com/zenseact/zod." |
|
"Finally load the dataset in the following way\n" |
|
"`datasets.load_dataset('Zenseact/ZOD', config-name, data_dir=data-dir)`") |
|
|
|
|