How Can I create spectrogram images for number of epochs

:question: If you have a question or issue with MNE-Python, please include the following info:

  • MNE version: mne-1.3.1
  • operating system: e.g. macOS 13.3.1

I have 8 channel EEG data, and want to convert EEG into spectrogram images so that i can use these images to train my deep learning CNN model.

MNE-Python offers the choice of three algorithms to compute spectrograms: Morlet wavelets, multitaper, and Stockwell transform. These are the three functions corresponding to the three algorithms:

mne.time_frequency.tfr_morlet
mne.time_frequency.tfr_multitaper
mne.time_frequency.tfr_stockwell

These three functions take very similar parameters. Because you want to compute spectrograms for individual epochs, specify average=False when calling one of the above functions. This will cause them to return an EpochsTFR object. Take a look at the .data field of that object, I think that is the data you want to give to your CNN model.