# How Can I create spectrogram images for number of epochs

**URL:** https://mne.discourse.group/t/how-can-i-create-spectrogram-images-for-number-of-epochs/6704
**Category:** Support & Discussions
**Tags:** eeg, visualization, epochs
**Created:** [April 12, 2023, 12:27am UTC](https://mne.discourse.group/t/how-can-i-create-spectrogram-images-for-number-of-epochs/6704 "2023-04-12T00:27:31Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![vaishnavimore23](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/vaishnavimore23/32/2262_2.png) [@vaishnavimore23](https://mne.discourse.group/u/vaishnavimore23)
#### Post date: [April 12, 2023, 12:27am UTC](https://mne.discourse.group/t/how-can-i-create-spectrogram-images-for-number-of-epochs/6704/1 "2023-04-12T00:27:31Z")

</div>

**❓ 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.

---

<div class="post-metadata">

### Author: ![wmvanvliet](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/wmvanvliet/32/100_2.png) [@wmvanvliet](https://mne.discourse.group/u/wmvanvliet)
#### Post date: [April 12, 2023, 5:43am UTC](https://mne.discourse.group/t/how-can-i-create-spectrogram-images-for-number-of-epochs/6704/2 "2023-04-12T05:43:13Z")

</div>

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`](https://mne.tools/stable/generated/mne.time_frequency.tfr_morlet.html)  
[`mne.time_frequency.tfr_multitaper`](https://mne.tools/stable/generated/mne.time_frequency.tfr_multitaper.html)  
[`mne.time_frequency.tfr_stockwell`](https://mne.tools/stable/generated/mne.time_frequency.tfr_stockwell.html)

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`](https://mne.tools/stable/generated/mne.time_frequency.EpochsTFR.html) 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.
