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)[源代码]#

基类:NeuromorphicDatasetFolder

API Language: 中文 | English


  • 中文

Spiking Heidelberg Digits (SHD) 数据集,由 The Heidelberg Spiking Data Sets for the Systematic Evaluation of Spiking Neural Networks 提出。

有关参数信息的更多详细信息,请参考 NeuromorphicDatasetFolder

备注

与 SpikingJelly 中的其他数据集不同,SHD 是一个神经形态音频数据集。

  1. 此数据集中的事件格式为 (x, t) 而不是 (x, y, t, p)

  2. 原始数据集通过符号链接复制了解析后的数据集。原始数据集由两个 .h5 文件组成,而不是一系列 .npz 文件。

  3. 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 NeuromorphicDatasetFolder for 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.

  1. Events in this dataset are in the format of (x, t) rather than (x, y, t, p).

  2. The raw dataset replicates the extracted dataset (by symbolic links). The raw dataset consists of two .h5 files instead of a series of .npz files.

  3. When data_type == "event", the data loading procedure of DatasetFolder will be bypassed. Instead, data will be loaded in Dataset style.

返回:

None

返回类型:

None

property raw_root: Path#

root / "events_h5"

get_dataset_builder()[源代码]#
classmethod get_H_W() Tuple[源代码]#
返回:

(None, 700) (i.e., 700 channels)

返回类型:

Tuple[None, int]

classmethod resource_url_md5() list[源代码]#
classmethod downloadable() bool[源代码]#
返回:

True

返回类型:

bool

classmethod extract_downloaded_files(download_root: Path, extract_root: Path)[源代码]#
classmethod create_raw_from_extracted(extract_root: Path, raw_root: Path)[源代码]#
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)[源代码]#

基类:NeuromorphicDatasetFolder

API Language: 中文 | English


  • 中文

Spiking Speech Commands (SSC) 数据集,由 The Heidelberg Spiking Data Sets for the Systematic Evaluation of Spiking Neural Networks 提出。

有关参数信息的更多详细信息,请参考 NeuromorphicDatasetFolder

备注

与 SpikingJelly 中的其他数据集不同,SSC 是一个神经形态音频数据集。

  1. 此数据集中的事件格式为 (x, t) 而不是 (x, y, t, p)

  2. 原始数据集通过符号链接复制了解析后的数据集。原始数据集由三个 .h5 文件组成,而不是一系列 .npz 文件。

  3. 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 NeuromorphicDatasetFolder for 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.

  1. Events in this dataset are in the format of (x, t) rather than (x, y, t, p).

  2. The raw dataset replicates the extracted dataset (by symbolic links). The raw dataset consists of three .h5 files instead of a series of .npz files.

  3. When data_type == "event", the data loading procedure of DatasetFolder will be bypassed. Instead, data will be loaded in Dataset style.

返回:

None

返回类型:

None

get_root_when_train_is_none(_root: Path)[源代码]#
property raw_root: Path#

root / "events_h5"

get_dataset_builder()[源代码]#
classmethod get_H_W() Tuple[源代码]#
返回:

(None, 700) (i.e., 700 channels)

返回类型:

Tuple[None, int]

classmethod resource_url_md5() list[源代码]#
classmethod downloadable() bool[源代码]#
返回:

True

返回类型:

bool

classmethod extract_downloaded_files(download_root: Path, extract_root: Path)[源代码]#
classmethod create_raw_from_extracted(extract_root: Path, raw_root: Path)[源代码]#