{
  "id": 191860,
  "title": "Memory Errors with Convolutional NNs, Help please!",
  "url": "/competitions/predict-volcanic-eruptions-ingv-oe/discussion/191860",
  "author_name": "",
  "post_date": "2020-10-19T04:01:56.099198600Z",
  "votes": 2,
  "comment_count": 3,
  "views": 0,
  "content": "<p>Hi all,</p>\n<p>Wrote a notebook: <a href=\"https://www.kaggle.com/ajcostarino/regression-using-spectrograms-and-convolutional-nn\" target=\"_blank\">https://www.kaggle.com/ajcostarino/regression-using-spectrograms-and-convolutional-nn</a> . Which was exploratory trying to use spectrograms and NNs for the regression. I am getting memory errors even though I am pretty sure I only read 1 segment into memory at a time. Also the data loader can iterate without memories and without training the network so it must be the network. Is it possible that the NN is too large? Not sure what the error might be if somebody could help would be incredibly grateful!</p>\n<p>Below is the summary:</p>\n<h3>Regression using spectrograms and Convolutional NNs</h3>\n<h4>Methodology</h4>\n<p>In my other notebook: <a href=\"https://www.kaggle.com/ajcostarino/ingv-volcanic-eruption-prediction-lgbm-baseline\" target=\"_blank\">https://www.kaggle.com/ajcostarino/ingv-volcanic-eruption-prediction-lgbm-baseline</a>. I presented a way of building a baseline prediction by aggregating sensor values from each segment and then using a classic Gradient Boosted Tree to predict time to failure. Here I tried a different approach: First we denoise the signals using a wavelet transformation. We then convert the transformed signal to a spectrogram. Each sensor has an individual spectrogram, the 10 sensors all together form a set of spectrograms for each earthquake. This can be described by a 3D tensor of size (N x C x D x W x H). Where W, H are the width and height of the spectrograms, D is the depth or the number of spectrograms in our case 10. C is the number of channels 3 for RGB. N is the size of the batch. We can then use 3D convolutions to extract features from the set of spectrograms and build our regression model using those features.</p>",
  "messages": [
    {
      "id": "1053494",
      "postDate": "10/19/2020 04:01:56",
      "content": "<p>Hi all,</p>\n<p>Wrote a notebook: <a href=\"https://www.kaggle.com/ajcostarino/regression-using-spectrograms-and-convolutional-nn\" target=\"_blank\">https://www.kaggle.com/ajcostarino/regression-using-spectrograms-and-convolutional-nn</a> . Which was exploratory trying to use spectrograms and NNs for the regression. I am getting memory errors even though I am pretty sure I only read 1 segment into memory at a time. Also the data loader can iterate without memories and without training the network so it must be the network. Is it possible that the NN is too large? Not sure what the error might be if somebody could help would be incredibly grateful!</p>\n<p>Below is the summary:</p>\n<h3>Regression using spectrograms and Convolutional NNs</h3>\n<h4>Methodology</h4>\n<p>In my other notebook: <a href=\"https://www.kaggle.com/ajcostarino/ingv-volcanic-eruption-prediction-lgbm-baseline\" target=\"_blank\">https://www.kaggle.com/ajcostarino/ingv-volcanic-eruption-prediction-lgbm-baseline</a>. I presented a way of building a baseline prediction by aggregating sensor values from each segment and then using a classic Gradient Boosted Tree to predict time to failure. Here I tried a different approach: First we denoise the signals using a wavelet transformation. We then convert the transformed signal to a spectrogram. Each sensor has an individual spectrogram, the 10 sensors all together form a set of spectrograms for each earthquake. This can be described by a 3D tensor of size (N x C x D x W x H). Where W, H are the width and height of the spectrograms, D is the depth or the number of spectrograms in our case 10. C is the number of channels 3 for RGB. N is the size of the batch. We can then use 3D convolutions to extract features from the set of spectrograms and build our regression model using those features.</p>",
      "rawMarkdown": "Hi all,\n\nWrote a notebook: https://www.kaggle.com/ajcostarino/regression-using-spectrograms-and-convolutional-nn . Which was exploratory trying to use spectrograms and NNs for the regression. I am getting memory errors even though I am pretty sure I only read 1 segment into memory at a time. Also the data loader can iterate without memories and without training the network so it must be the network. Is it possible that the NN is too large? Not sure what the error might be if somebody could help would be incredibly grateful!\n\nBelow is the summary:\n\n### Regression using spectrograms and Convolutional NNs\n#### Methodology\nIn my other notebook: https://www.kaggle.com/ajcostarino/ingv-volcanic-eruption-prediction-lgbm-baseline. I presented a way of building a baseline prediction by aggregating sensor values from each segment and then using a classic Gradient Boosted Tree to predict time to failure. Here I tried a different approach: First we denoise the signals using a wavelet transformation. We then convert the transformed signal to a spectrogram. Each sensor has an individual spectrogram, the 10 sensors all together form a set of spectrograms for each earthquake. This can be described by a 3D tensor of size (N x C x D x W x H). Where W, H are the width and height of the spectrograms, D is the depth or the number of spectrograms in our case 10. C is the number of channels 3 for RGB. N is the size of the batch. We can then use 3D convolutions to extract features from the set of spectrograms and build our regression model using those features.",
      "votes": null
    },
    {
      "id": "1053728",
      "postDate": "10/19/2020 09:32:32",
      "content": "<p>Why you prefer to input the data as spectograms and not as signals, i agreeyour signal preprocessing method but instead of trying to convert to spectograms i would keep the signals because you can process them with conv1d and spectgrams you need conv3d.</p>\n<p>The difference of params and gpu memory needed is massive…</p>",
      "rawMarkdown": "Why you prefer to input the data as spectograms and not as signals, i agreeyour signal preprocessing method but instead of trying to convert to spectograms i would keep the signals because you can process them with conv1d and spectgrams you need conv3d.\n\nThe difference of params and gpu memory needed is massive...",
      "votes": null
    },
    {
      "id": "1053979",
      "postDate": "10/19/2020 14:45:15",
      "content": "<p>Thanks, I guess my hypothesis is correct. I got carried away with spectrograms, In fact these are 1D signals with 10 channels. I'll change tonight.</p>",
      "rawMarkdown": "Thanks, I guess my hypothesis is correct. I got carried away with spectrograms, In fact these are 1D signals with 10 channels. I'll change tonight.",
      "votes": null
    },
    {
      "id": "1056738",
      "postDate": "10/22/2020 03:17:34",
      "content": "<p>Just a random thought - does pandas.rolling.max() still have a memory usage bug?</p>\n<p>Think I saw it got fixed, but then I remember I was still having problems with it a few months back. Maybe because I didn't have latest environment or upgrade or something?</p>",
      "rawMarkdown": "Just a random thought - does pandas.rolling.max() still have a memory usage bug?\n\nThink I saw it got fixed, but then I remember I was still having problems with it a few months back. Maybe because I didn't have latest environment or upgrade or something?",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 1053728,
      "author_name": "enric1296",
      "author_url": "",
      "post_date": "10/19/2020 09:32:32",
      "content": "<p>Why you prefer to input the data as spectograms and not as signals, i agreeyour signal preprocessing method but instead of trying to convert to spectograms i would keep the signals because you can process them with conv1d and spectgrams you need conv3d.</p>\n<p>The difference of params and gpu memory needed is massive…</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 1053979,
      "author_name": "ajcostarino",
      "author_url": "",
      "post_date": "10/19/2020 14:45:15",
      "content": "<p>Thanks, I guess my hypothesis is correct. I got carried away with spectrograms, In fact these are 1D signals with 10 channels. I'll change tonight.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 1056738,
      "author_name": "davidedwards1",
      "author_url": "",
      "post_date": "10/22/2020 03:17:34",
      "content": "<p>Just a random thought - does pandas.rolling.max() still have a memory usage bug?</p>\n<p>Think I saw it got fixed, but then I remember I was still having problems with it a few months back. Maybe because I didn't have latest environment or upgrade or something?</p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "1053494": "Hi all,\n\nWrote a notebook: https://www.kaggle.com/ajcostarino/regression-using-spectrograms-and-convolutional-nn . Which was exploratory trying to use spectrograms and NNs for the regression. I am getting memory errors even though I am pretty sure I only read 1 segment into memory at a time. Also the data loader can iterate without memories and without training the network so it must be the network. Is it possible that the NN is too large? Not sure what the error might be if somebody could help would be incredibly grateful!\n\nBelow is the summary:\n\n### Regression using spectrograms and Convolutional NNs\n#### Methodology\nIn my other notebook: https://www.kaggle.com/ajcostarino/ingv-volcanic-eruption-prediction-lgbm-baseline. I presented a way of building a baseline prediction by aggregating sensor values from each segment and then using a classic Gradient Boosted Tree to predict time to failure. Here I tried a different approach: First we denoise the signals using a wavelet transformation. We then convert the transformed signal to a spectrogram. Each sensor has an individual spectrogram, the 10 sensors all together form a set of spectrograms for each earthquake. This can be described by a 3D tensor of size (N x C x D x W x H). Where W, H are the width and height of the spectrograms, D is the depth or the number of spectrograms in our case 10. C is the number of channels 3 for RGB. N is the size of the batch. We can then use 3D convolutions to extract features from the set of spectrograms and build our regression model using those features.",
    "1053728": "Why you prefer to input the data as spectograms and not as signals, i agreeyour signal preprocessing method but instead of trying to convert to spectograms i would keep the signals because you can process them with conv1d and spectgrams you need conv3d.\n\nThe difference of params and gpu memory needed is massive...",
    "1053979": "Thanks, I guess my hypothesis is correct. I got carried away with spectrograms, In fact these are 1D signals with 10 channels. I'll change tonight.",
    "1056738": "Just a random thought - does pandas.rolling.max() still have a memory usage bug?\n\nThink I saw it got fixed, but then I remember I was still having problems with it a few months back. Maybe because I didn't have latest environment or upgrade or something?"
  },
  "source": "meta"
}