byin-cwi / SRNN-ICONs2020

In this repo, Spiking recurrent neural network is applied on various task for ICONs2020
27 stars 8 forks source link

Codes for training SRNN on SHD dataset #1

Open realwsq opened 2 years ago

realwsq commented 2 years ago

Hello,

Thanks for providing codes for training SRNN on SMNIST dataset. I wonder do you also have codes for training SRNN on SHD dataset? It would be very helpful - thank you!

Po0ria commented 2 years ago

What you need to do is to download the dataset from this link. Uncomment the lines from 101 to 107 in ./SHD/intro.py:

test_X,testy = generate_dataset(files[0],dt=4e-3)
np.save('/Path/to/directory/to/save/testX_4ms.npy',test_X)
np.save('/Path/to/directory/to/save/testY_4ms.npy',testy)

train_X,trainy = generate_dataset(files[1],dt=4e-3)
np.save('/Path/to/directory/to/save/trainX_4ms.npy',train_X)
np.save('/Path/to/directory/to/save/trainY_4ms.npy',trainy)

Run the script to get the numpy version of the train and test dataset. Then modify the path to train and test datasets in srnn_2layer-finalized (1).py :

train_X = np.load('data/trainX_10ms.npy')
train_y = np.load('data/trainY_10ms.npy').astype(np.float)

test_X = np.load('data/testX_10ms.npy')
test_y = np.load('data/testY_10ms.npy').astype(np.float)

Pay attention that the name of the file is based on the dt which is an argument to generate_dataset() function. Now just run srnn_2layer-finalized (1).py for training.