File size: 1,974 Bytes
0416733 f5bc2fb 0416733 f5bc2fb 0416733 f5bc2fb 0416733 f5bc2fb 0416733 f5bc2fb 0416733 f5bc2fb 0416733 f5bc2fb |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
import datasets
import pandas as pd
import pyarrow as pa
PLATFORMS = ["ACURA_RDX_2020", "AUDI_A3_3RD_GEN"]
_URLS = [f'https://huggingface.co/datasets/commaai/commaSteeringControl/resolve/main/data/{platform}.zip' for platform in PLATFORMS]
_DESCRIPTION = "Steering controls dataset from cars running openpilot"
class CommaSteeringControl(datasets.ArrowBasedBuilder):
def _info(self):
return datasets.DatasetInfo(
description=_DESCRIPTION,
features=datasets.Features(
{
"t": datasets.Value("float"),
"latActive": datasets.Value("bool"),
"steeringPressed": datasets.Value("bool"),
"vEgo": datasets.Value("float"),
"aEgo": datasets.Value("float"),
"steeringAngleDeg": datasets.Value("float"),
"steer": datasets.Value("float"),
"steerFiltered": datasets.Value("float"),
"roll": datasets.Value("float"),
"latAccelSteeringAngle": datasets.Value("float"),
"latAccelDesired": datasets.Value("float"),
"latAccelLocalizer": datasets.Value("float"),
"epsFwVersion": datasets.Value("string"),
}
)
)
def _split_generators(self, dl_manager):
downloaded_files = dl_manager.download(_URLS)
return [
datasets.SplitGenerator(
name=PLATFORMS[i],
gen_kwargs={
"files": dl_manager.iter_archive(downloaded_files[i])
}
) for i in range(len(downloaded_files))
]
def _generate_tables(self, files):
for path in files:
df = pd.read_csv(path[1])
pa_table = pa.Table.from_pandas(df)
yield path[0], pa_table
# def _get_examples_iterable_for_split(self, split_generator):
# for path in split_generator.gen_kwargs['files']:
# df = pandas.read_csv(path[1])
# yield path[0], df
# ds = CommaSteeringControl(use_auth_token=True)
# dp = ds.as_streaming_dataset(split="AUDI_A3_3RD_GEN")
# for p in dp:
# print(p)
# break
|