{
  "id": 487572,
  "title": "Need help creating spectrograms of the correct size with MNE",
  "url": "/competitions/hms-harmful-brain-activity-classification/discussion/487572",
  "author_name": "TheEventHorizons",
  "post_date": "2024-03-29T15:05:06.089000",
  "votes": 1,
  "comment_count": 0,
  "views": 0,
  "content": "<p>Hello everyone,</p>\n<p>I'm working on a project involving EEG data analysis with MNE-Python in a Jupyter notebook. Currently, I'm facing difficulties in creating spectrograms of the correct size. My spectrograms have a size of (1990, 2001), which makes their processing inefficient and requires a lot of resources.</p>\n<p>I've tried resizing the spectrograms after creation using the <code>cv2.resize()</code> function, but it seems to pose shape compatibility issues and take a lot of time to convert more or less 30,000 eegs into spectrograms with MNE.</p>\n<p>I'm looking for guidance or solutions to efficiently create spectrograms of the correct size using the <code>tfr_morlet</code> function, or to effectively resize the spectrograms after creation, similar to what can be done with Librosa (as demonstrated in <a href=\"https://www.kaggle.com/code/cdeotte/how-to-make-spectrogram-from-eeg/notebook\" target=\"_blank\">\"How to Make Spectrogram from EEG\"</a>). Any suggestions or assistance would be highly valued and appreciated!</p>\n<p>If you'd like to review my notebook <a href=\"https://www.kaggle.com/code/theeventhorizons/egg-to-spec-mne\" target=\"_blank\">here</a> or discuss the issue further, please let me know, and I'd be happy to share more information.</p>\n<p>Thank you in advance for your assistance!</p>",
  "messages": [
    {
      "id": 2722383,
      "postDate": "2024-03-29T15:05:06.090Z",
      "content": "<p>Hello everyone,</p>\n<p>I'm working on a project involving EEG data analysis with MNE-Python in a Jupyter notebook. Currently, I'm facing difficulties in creating spectrograms of the correct size. My spectrograms have a size of (1990, 2001), which makes their processing inefficient and requires a lot of resources.</p>\n<p>I've tried resizing the spectrograms after creation using the <code>cv2.resize()</code> function, but it seems to pose shape compatibility issues and take a lot of time to convert more or less 30,000 eegs into spectrograms with MNE.</p>\n<p>I'm looking for guidance or solutions to efficiently create spectrograms of the correct size using the <code>tfr_morlet</code> function, or to effectively resize the spectrograms after creation, similar to what can be done with Librosa (as demonstrated in <a href=\"https://www.kaggle.com/code/cdeotte/how-to-make-spectrogram-from-eeg/notebook\" target=\"_blank\">\"How to Make Spectrogram from EEG\"</a>). Any suggestions or assistance would be highly valued and appreciated!</p>\n<p>If you'd like to review my notebook <a href=\"https://www.kaggle.com/code/theeventhorizons/egg-to-spec-mne\" target=\"_blank\">here</a> or discuss the issue further, please let me know, and I'd be happy to share more information.</p>\n<p>Thank you in advance for your assistance!</p>",
      "rawMarkdown": "Hello everyone,\n\nI'm working on a project involving EEG data analysis with MNE-Python in a Jupyter notebook. Currently, I'm facing difficulties in creating spectrograms of the correct size. My spectrograms have a size of (1990, 2001), which makes their processing inefficient and requires a lot of resources.\n\nI've tried resizing the spectrograms after creation using the `cv2.resize()` function, but it seems to pose shape compatibility issues and take a lot of time to convert more or less 30,000 eegs into spectrograms with MNE.\n\nI'm looking for guidance or solutions to efficiently create spectrograms of the correct size using the `tfr_morlet` function, or to effectively resize the spectrograms after creation, similar to what can be done with Librosa (as demonstrated in [\"How to Make Spectrogram from EEG\"](https://www.kaggle.com/code/cdeotte/how-to-make-spectrogram-from-eeg/notebook)). Any suggestions or assistance would be highly valued and appreciated!\n\nIf you'd like to review my notebook [here](https://www.kaggle.com/code/theeventhorizons/egg-to-spec-mne) or discuss the issue further, please let me know, and I'd be happy to share more information.\n\nThank you in advance for your assistance!",
      "votes": 1
    }
  ],
  "comments": [],
  "raw_markdown_by_id": {
    "2722383": "Hello everyone,\n\nI'm working on a project involving EEG data analysis with MNE-Python in a Jupyter notebook. Currently, I'm facing difficulties in creating spectrograms of the correct size. My spectrograms have a size of (1990, 2001), which makes their processing inefficient and requires a lot of resources.\n\nI've tried resizing the spectrograms after creation using the `cv2.resize()` function, but it seems to pose shape compatibility issues and take a lot of time to convert more or less 30,000 eegs into spectrograms with MNE.\n\nI'm looking for guidance or solutions to efficiently create spectrograms of the correct size using the `tfr_morlet` function, or to effectively resize the spectrograms after creation, similar to what can be done with Librosa (as demonstrated in [\"How to Make Spectrogram from EEG\"](https://www.kaggle.com/code/cdeotte/how-to-make-spectrogram-from-eeg/notebook)). Any suggestions or assistance would be highly valued and appreciated!\n\nIf you'd like to review my notebook [here](https://www.kaggle.com/code/theeventhorizons/egg-to-spec-mne) or discuss the issue further, please let me know, and I'd be happy to share more information.\n\nThank you in advance for your assistance!"
  }
}