|
|
|
|
|
import pandas as pd |
|
import datasets |
|
|
|
_DATA_URL = 'https://frodobots-1k.s3.ap-southeast-1.amazonaws.com/frodobots-1k_20230907_getting-started.zip' |
|
|
|
_DESCRIPTION = '''\ |
|
''' |
|
|
|
_HOMEPAGE = 'https://www.frodobots.com' |
|
|
|
_LICENSE = '' |
|
|
|
_CITATION = '' |
|
|
|
class Test(datasets.GeneratorBasedBuilder): |
|
|
|
BUILDER_CONFIGS = [ |
|
datasets.BuilderConfig( |
|
name='test', |
|
version=datasets.Version('1.0.0', ''), |
|
description='', |
|
) |
|
] |
|
|
|
def _info(self): |
|
features = datasets.Features( |
|
{ |
|
'speed': datasets.Value('float32'), |
|
'angular': datasets.Value('float32'), |
|
'rpm_1': datasets.Value('int32'), |
|
'rpm_2': datasets.Value('int32'), |
|
'rpm_3': datasets.Value('int32'), |
|
'rpm_4': datasets.Value('int32'), |
|
'timestamp': datasets.Value('float64'), |
|
} |
|
) |
|
return datasets.DatasetInfo( |
|
description=_DESCRIPTION, |
|
features=features, |
|
supervised_keys=None, |
|
homepage=_HOMEPAGE, |
|
license=_LICENSE, |
|
citation=_CITATION, |
|
) |
|
|
|
|
|
def _split_generators(self, dl_manager): |
|
|
|
archive = dl_manager.download_and_extract(_DATA_URL) |
|
return [ |
|
datasets.SplitGenerator( |
|
name=datasets.Split.TRAIN, gen_kwargs={'files': archive + '/frodobots-1k_20230907_getting-started/frodobot2e6388/20230522142406/control_20230522142406.csv', 'split': 'train'} |
|
), |
|
] |
|
|
|
def _generate_examples(self, files, split): |
|
df = pd.read_csv(files) |
|
for index, row in df.iterrows(): |
|
|
|
yield index, { |
|
'speed': row['speed'], |
|
'angular': row['angular'], |
|
'rpm_1': row['rpm_1'], |
|
'rpm_2': row['rpm_2'], |
|
'rpm_3': row['rpm_3'], |
|
'rpm_4': row['rpm_4'], |
|
'timestamp': row['timestamp'], |
|
} |
|
|
|
if __name__ == '__main__': |
|
Test().download_and_prepare() |
|
|