spikingjelly.datasets.shd module#
For SpikingHeidelbergDigits and SpikingSpeechCommands, custom_integrate_function should have the following form:
import os
import h5py
import numpy as np
from spikingjelly.datasets import utils
from spikingjelly.datasets.shd import _integrate_events_segment_to_frame
def custom_integrate_function_example(h5_file: h5py.File, i: int, output_dir: str, W: int):
events = {'t': h5_file['spikes']['times'][i], 'x': h5_file['spikes']['units'][i]}
label = h5_file['labels'][i]
frames = np.zeros([2, W])
index_split = np.random.randint(low=0, high=len(events['t']))
frames[0] = _integrate_events_segment_to_frame(events['x'], W, 0, index_split)
frames[1] = _integrate_events_segment_to_frame(events['x'], W, index_split, len(events['t']))
fname = os.path.join(output_dir, str(label), str(i))
utils.np_savez(fname, frames=frames)
- class spikingjelly.datasets.shd.SpikingHeidelbergDigits(root: str, train: bool = True, data_type: str = 'event', frames_number: int | None = None, split_by: str | None = None, duration: int | None = None, custom_integrate_function: Callable | None = None, custom_integrated_frames_dir_name: str | None = None, transform: Callable | None = None, target_transform: Callable | None = None)[源代码]#
-
中文
Spiking Heidelberg Digits (SHD) 数据集,由 The Heidelberg Spiking Data Sets for the Systematic Evaluation of Spiking Neural Networks 提出。
有关参数信息的更多详细信息,请参考
NeuromorphicDatasetFolder备注
与 SpikingJelly 中的其他数据集不同,SHD 是一个神经形态音频数据集。
此数据集中的事件格式为
(x, t)而不是(x, y, t, p)。原始数据集通过符号链接复制了解析后的数据集。原始数据集由两个
.h5文件组成,而不是一系列.npz文件。当
data_type == "event"时,将绕过DatasetFolder的数据加载过程。否则,将以Dataset样式加载数据。
English
The Spiking Heidelberg Digits (SHD) dataset, which is proposed by The Heidelberg Spiking Data Sets for the Systematic Evaluation of Spiking Neural Networks.
Refer to
NeuromorphicDatasetFolderfor more details about params information.- 参数:
root (Union[str, Path]) -- 数据集的根路径
train (Optional[bool]) -- 是否使用训练集
data_type (str) --
"event"或"frame"frames_number (Optional[int]) -- 积分帧的数量
split_by (Optional[str]) --
"time"或"number"duration (Optional[int]) -- 每帧的时间时长
custom_integrate_function (Optional[Callable]) -- 用户自定义积分函数
custom_integrated_frames_dir_name (Optional[str]) -- 自定义积分帧目录名
transform (Optional[Callable]) -- 数据变换
target_transform (Optional[Callable]) -- 标签变换
root -- Root directory of the dataset
train -- Whether to use training set or test set
data_type --
"event"or"frame"frames_number -- Number of frames to integrate
split_by --
"time"or"number"duration -- Time duration per frame
custom_integrate_function -- User-defined integrate function
custom_integrated_frames_dir_name -- Custom frames directory name
transform -- Transform function
target_transform -- Target transform function
备注
Unlike other datasets in SpikingJelly, SHD is a neuromorphic audio dataset.
Events in this dataset are in the format of
(x, t)rather than(x, y, t, p).The raw dataset replicates the extracted dataset (by symbolic links). The raw dataset consists of two
.h5files instead of a series of.npzfiles.When
data_type == "event", the data loading procedure ofDatasetFolderwill be bypassed. Instead, data will be loaded inDatasetstyle.
- 返回:
None
- 返回类型:
None
- class spikingjelly.datasets.shd.SpikingSpeechCommands(root: str, split: str = 'train', data_type: str = 'event', frames_number: int | None = None, split_by: str | None = None, duration: int | None = None, custom_integrate_function: Callable | None = None, custom_integrated_frames_dir_name: str | None = None, transform: Callable | None = None, target_transform: Callable | None = None)[源代码]#
-
中文
Spiking Speech Commands (SSC) 数据集,由 The Heidelberg Spiking Data Sets for the Systematic Evaluation of Spiking Neural Networks 提出。
有关参数信息的更多详细信息,请参考
NeuromorphicDatasetFolder备注
与 SpikingJelly 中的其他数据集不同,SSC 是一个神经形态音频数据集。
此数据集中的事件格式为
(x, t)而不是(x, y, t, p)。原始数据集通过符号链接复制了解析后的数据集。原始数据集由三个
.h5文件组成,而不是一系列.npz文件。当
data_type == "event"时,将绕过DatasetFolder的数据加载过程。否则,将以Dataset样式加载数据。
English
The Spiking Speech Commands (SSC) dataset, which is proposed by The Heidelberg Spiking Data Sets for the Systematic Evaluation of Spiking Neural Networks.
Refer to
NeuromorphicDatasetFolderfor more details about params information.- 参数:
root (Union[str, Path]) -- 数据集的根路径
split (str) -- "train"、"valid" 或 "test"
data_type (str) --
"event"或"frame"frames_number (Optional[int]) -- 积分帧的数量
split_by (Optional[str]) --
"time"或"number"duration (Optional[int]) -- 每帧的时间时长
custom_integrate_function (Optional[Callable]) -- 用户自定义积分函数
custom_integrated_frames_dir_name (Optional[str]) -- 自定义积分帧目录名
transform (Optional[Callable]) -- 数据变换
target_transform (Optional[Callable]) -- 标签变换
root -- Root directory of the dataset
split -- "train", "valid", or "test"
data_type --
"event"or"frame"frames_number -- Number of frames to integrate
split_by --
"time"or"number"duration -- Time duration per frame
custom_integrate_function -- User-defined integrate function
custom_integrated_frames_dir_name -- Custom frames directory name
transform -- Transform function
target_transform -- Target transform function
备注
Unlike other datasets in SpikingJelly, SSC is a neuromorphic audio dataset.
Events in this dataset are in the format of
(x, t)rather than(x, y, t, p).The raw dataset replicates the extracted dataset (by symbolic links). The raw dataset consists of three
.h5files instead of a series of.npzfiles.When
data_type == "event", the data loading procedure ofDatasetFolderwill be bypassed. Instead, data will be loaded inDatasetstyle.
- 返回:
None
- 返回类型:
None