Skip to main content

Speech2Spikes: Efficient Audio Encoding Pipeline for Real-time Neuromorphic Systems

Project description

README for Speech2Spikes Python Package

Speech2Spikes is an algorithm designed to convert raw audio data into spike trains that can be utilized by neuromorphic processors using efficient operations (https://doi.org/10.1145/3584954.3584995).

This package is built on top of the PyTorch framework, providing a convenient and efficient solution for transforming audio signals into spiking representations.

Installation

You can easily install speech2spikes using pip:

pip install speech2spikes

Usage

To convert a batch of audio tensors into spike trains, follow these simple steps:

  1. Import the S2S class from the speech2spikes package:

    from speech2spikes import S2S
    
  2. Initialize the S2S object:

    s2s = S2S()
    
  3. Convert the batch of audio tensors to spike trains:

    spike_trains = s2s(batch)
    

    where batch is a list of tuples of form [(audio, target)].

The spike_trains output will be a tuple of two tensors, spikes and targets. Raw audio data is expected to be in the format (..., timesteps).

S2S can also be used as a collate function in PyTorch DataLoaders like this:

dl = torch.utils.data.DataLoader(
    train_set,
    batch_size = BATCH_SIZE,
    shuffle = True,
    collate_fn = s2s
)

Notes

The Speech2Spikes paper shows spikes as being separated into positive and negative channels however, this code does not separate the spikes this way, instead returning them as signed ints (+1, -1, and 0). We have not seen a decrease in accuracy by doing this and find that reducing the input dimensionality can significantly reduce the overall model size.

Similarly, the cumulative sum feature described in the paper can be replicated using S2S(cumsum=True) but is disabled by default due to limited improvements in accuracy while drastically increasing the input dimensionality.

License

Speech2Spikes is made available under a proprietary license that permits using, copying, sharing, and making derivative works from Speech2Spikes and its source code for academics/non-commercial purposes only, as long as the above copyright notice and this permission notice are included in all copies of the software.

See the LICENSE file for more information.

Contact

If you have any questions, suggestions, or feedback, please feel free to reach out to us at neuromorphic_inquiries@accenture.com.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

speech2spikes-1.0.1.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

speech2spikes-1.0.1-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file speech2spikes-1.0.1.tar.gz.

File metadata

  • Download URL: speech2spikes-1.0.1.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.11.3 Darwin/23.0.0

File hashes

Hashes for speech2spikes-1.0.1.tar.gz
Algorithm Hash digest
SHA256 7f05810a7bd6ec547f97973d31ddfd22fd16015fd9fa28e929e7e0c125d16948
MD5 ae372cc690310a1a96cb3477727eb3ea
BLAKE2b-256 bc7f7a7b09599efc36e9dd80e4ec33c017680ad91cc29f0b0f07c006d00d5865

See more details on using hashes here.

File details

Details for the file speech2spikes-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: speech2spikes-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 5.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.11.3 Darwin/23.0.0

File hashes

Hashes for speech2spikes-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 927911355336aa2a6e0434c59c6413a36e29c4e7a583b90c06925c42f72a86d8
MD5 e2720b7f29ed3526b154ab88eab2313c
BLAKE2b-256 5b9cc791081f6afdc94b113e558b62f4d2655375e799a44592b93e71a4d7e2b5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page