{
  "id": 180761,
  "title": "Anyone tried SNR as a heuristic?",
  "url": "/competitions/birdsong-recognition/discussion/180761",
  "author_name": "",
  "post_date": "2020-09-06T11:54:21.065624100Z",
  "votes": 1,
  "comment_count": 4,
  "views": 0,
  "content": "<p>I found a function in scipy that can calculate signal to noise ratio, which is the mean to standard deviation ratio of a numpy array: <a href=\"https://docs.scipy.org/doc/scipy-0.14.0/reference/generated/scipy.stats.signaltonoise.html\" target=\"_blank\">https://docs.scipy.org/doc/scipy-0.14.0/reference/generated/scipy.stats.signaltonoise.html</a>. I am wondering has anyone tried using this as a heuristic? For example, in testing stage, predict use 2 different models, 1) A model that is more sensitive (can pick up birdcalls accurately but tend to overpredict), 2) A model that is less sensitive (tend to predict nocalls more). Based on snr of clip, predict using one of these models.</p>",
  "messages": [
    {
      "id": "1000223",
      "postDate": "09/06/2020 11:54:21",
      "content": "<p>I found a function in scipy that can calculate signal to noise ratio, which is the mean to standard deviation ratio of a numpy array: <a href=\"https://docs.scipy.org/doc/scipy-0.14.0/reference/generated/scipy.stats.signaltonoise.html\" target=\"_blank\">https://docs.scipy.org/doc/scipy-0.14.0/reference/generated/scipy.stats.signaltonoise.html</a>. I am wondering has anyone tried using this as a heuristic? For example, in testing stage, predict use 2 different models, 1) A model that is more sensitive (can pick up birdcalls accurately but tend to overpredict), 2) A model that is less sensitive (tend to predict nocalls more). Based on snr of clip, predict using one of these models.</p>",
      "rawMarkdown": "I found a function in scipy that can calculate signal to noise ratio, which is the mean to standard deviation ratio of a numpy array: https://docs.scipy.org/doc/scipy-0.14.0/reference/generated/scipy.stats.signaltonoise.html. I am wondering has anyone tried using this as a heuristic? For example, in testing stage, predict use 2 different models, 1) A model that is more sensitive (can pick up birdcalls accurately but tend to overpredict), 2) A model that is less sensitive (tend to predict nocalls more). Based on snr of clip, predict using one of these models.",
      "votes": null
    },
    {
      "id": "1000295",
      "postDate": "09/06/2020 12:55:48",
      "content": "<blockquote>\n  <p>Based on snr of clip, predict using one of these models.</p>\n</blockquote>\n<p>How do you propose to do this ?</p>\n<p>I did't find SNR very intuitive for this purpose ….scipy definition states SNR = Mean /Std. Dev.<br>\nBut the Std Dev in the case of a audio clip is mostly caused by the bird sounds…</p>\n<p>Maybe i got it wrong somewhere.</p>",
      "rawMarkdown": ">Based on snr of clip, predict using one of these models.\n\nHow do you propose to do this ?\n\nI did't find SNR very intuitive for this purpose ....scipy definition states SNR = Mean /Std. Dev.\nBut the Std Dev in the case of a audio clip is mostly caused by the bird sounds...\n\nMaybe i got it wrong somewhere.",
      "votes": null
    },
    {
      "id": "1001217",
      "postDate": "09/07/2020 06:23:27",
      "content": "<p>I got (what I think is) a rough SNR estimator by running tensorflow - tf.image.psnr() (using a manually selected 'clean' example as the comparison image for the function) - on portions of existing train spectrograms to generate numerical labels for a reasonable number of the train audio files, then training a neural net to predict using those labels. As tf.image.psnr() seemed quite slow and won't run in a reasonable time on a large spectrogram - or at least that was my finding.</p>\n<p>Of course this is not very exact but the output did roughly tally with visual inspections of the spectrograms. And also it roughly correlated with the ratings (think the 5 rated audio files are generally less noisy).</p>\n<p>My idea at the time was to adjust how the test data is treated based on the SNR estimator. I've just not made enough progress with my model etc overall to be able to judge whether this would make a difference, unfortunately.</p>\n<p>I have no idea if my attempt was particularly logical or well thought through by the way as am fairly new to this…</p>",
      "rawMarkdown": "I got (what I think is) a rough SNR estimator by running tensorflow - tf.image.psnr() (using a manually selected 'clean' example as the comparison image for the function) - on portions of existing train spectrograms to generate numerical labels for a reasonable number of the train audio files, then training a neural net to predict using those labels. As tf.image.psnr() seemed quite slow and won't run in a reasonable time on a large spectrogram - or at least that was my finding.\n\nOf course this is not very exact but the output did roughly tally with visual inspections of the spectrograms. And also it roughly correlated with the ratings (think the 5 rated audio files are generally less noisy).\n\nMy idea at the time was to adjust how the test data is treated based on the SNR estimator. I've just not made enough progress with my model etc overall to be able to judge whether this would make a difference, unfortunately.\n\nI have no idea if my attempt was particularly logical or well thought through by the way as am fairly new to this...",
      "votes": null
    },
    {
      "id": "1001479",
      "postDate": "09/07/2020 11:06:44",
      "content": "<p>I have not found a good way to use SNR. Actually the SNR computed using scipy differs from SNR in audio. I thought maybe it's interesting to see if we can use scipy's version for audio arrays. While digging, I found a formula used by Kunihiko Sato. He also provides examples of different audio clips in different SNR ratios. Maybe you will find this useful ;):</p>\n<p><a href=\"https://engineering.linecorp.com/ja/blog/voice-waveform-arbitrary-signal-to-noise-ratio-python/\" target=\"_blank\">https://engineering.linecorp.com/ja/blog/voice-waveform-arbitrary-signal-to-noise-ratio-python/</a><br>\n<a href=\"https://github.com/Sato-Kunihiko/audio-SNR\" target=\"_blank\">https://github.com/Sato-Kunihiko/audio-SNR</a></p>",
      "rawMarkdown": "I have not found a good way to use SNR. Actually the SNR computed using scipy differs from SNR in audio. I thought maybe it's interesting to see if we can use scipy's version for audio arrays. While digging, I found a formula used by Kunihiko Sato. He also provides examples of different audio clips in different SNR ratios. Maybe you will find this useful ;):\n\nhttps://engineering.linecorp.com/ja/blog/voice-waveform-arbitrary-signal-to-noise-ratio-python/\nhttps://github.com/Sato-Kunihiko/audio-SNR",
      "votes": null
    },
    {
      "id": "1001483",
      "postDate": "09/07/2020 11:11:15",
      "content": "<p>Check out the link I posted in reply to Vijay's comment. It contains a formulation of SNR for voices. Might be useful!</p>",
      "rawMarkdown": "Check out the link I posted in reply to Vijay's comment. It contains a formulation of SNR for voices. Might be useful!",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 1000295,
      "author_name": "watzisname",
      "author_url": "",
      "post_date": "09/06/2020 12:55:48",
      "content": "<blockquote>\n  <p>Based on snr of clip, predict using one of these models.</p>\n</blockquote>\n<p>How do you propose to do this ?</p>\n<p>I did't find SNR very intuitive for this purpose ….scipy definition states SNR = Mean /Std. Dev.<br>\nBut the Std Dev in the case of a audio clip is mostly caused by the bird sounds…</p>\n<p>Maybe i got it wrong somewhere.</p>",
      "votes": null,
      "replies": [
        {
          "id": 1001479,
          "author_name": "alanchn31",
          "author_url": "",
          "post_date": "09/07/2020 11:06:44",
          "content": "<p>I have not found a good way to use SNR. Actually the SNR computed using scipy differs from SNR in audio. I thought maybe it's interesting to see if we can use scipy's version for audio arrays. While digging, I found a formula used by Kunihiko Sato. He also provides examples of different audio clips in different SNR ratios. Maybe you will find this useful ;):</p>\n<p><a href=\"https://engineering.linecorp.com/ja/blog/voice-waveform-arbitrary-signal-to-noise-ratio-python/\" target=\"_blank\">https://engineering.linecorp.com/ja/blog/voice-waveform-arbitrary-signal-to-noise-ratio-python/</a><br>\n<a href=\"https://github.com/Sato-Kunihiko/audio-SNR\" target=\"_blank\">https://github.com/Sato-Kunihiko/audio-SNR</a></p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 1001217,
      "author_name": "davidedwards1",
      "author_url": "",
      "post_date": "09/07/2020 06:23:27",
      "content": "<p>I got (what I think is) a rough SNR estimator by running tensorflow - tf.image.psnr() (using a manually selected 'clean' example as the comparison image for the function) - on portions of existing train spectrograms to generate numerical labels for a reasonable number of the train audio files, then training a neural net to predict using those labels. As tf.image.psnr() seemed quite slow and won't run in a reasonable time on a large spectrogram - or at least that was my finding.</p>\n<p>Of course this is not very exact but the output did roughly tally with visual inspections of the spectrograms. And also it roughly correlated with the ratings (think the 5 rated audio files are generally less noisy).</p>\n<p>My idea at the time was to adjust how the test data is treated based on the SNR estimator. I've just not made enough progress with my model etc overall to be able to judge whether this would make a difference, unfortunately.</p>\n<p>I have no idea if my attempt was particularly logical or well thought through by the way as am fairly new to this…</p>",
      "votes": null,
      "replies": [
        {
          "id": 1001483,
          "author_name": "alanchn31",
          "author_url": "",
          "post_date": "09/07/2020 11:11:15",
          "content": "<p>Check out the link I posted in reply to Vijay's comment. It contains a formulation of SNR for voices. Might be useful!</p>",
          "votes": null,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "1000223": "I found a function in scipy that can calculate signal to noise ratio, which is the mean to standard deviation ratio of a numpy array: https://docs.scipy.org/doc/scipy-0.14.0/reference/generated/scipy.stats.signaltonoise.html. I am wondering has anyone tried using this as a heuristic? For example, in testing stage, predict use 2 different models, 1) A model that is more sensitive (can pick up birdcalls accurately but tend to overpredict), 2) A model that is less sensitive (tend to predict nocalls more). Based on snr of clip, predict using one of these models.",
    "1000295": ">Based on snr of clip, predict using one of these models.\n\nHow do you propose to do this ?\n\nI did't find SNR very intuitive for this purpose ....scipy definition states SNR = Mean /Std. Dev.\nBut the Std Dev in the case of a audio clip is mostly caused by the bird sounds...\n\nMaybe i got it wrong somewhere.",
    "1001217": "I got (what I think is) a rough SNR estimator by running tensorflow - tf.image.psnr() (using a manually selected 'clean' example as the comparison image for the function) - on portions of existing train spectrograms to generate numerical labels for a reasonable number of the train audio files, then training a neural net to predict using those labels. As tf.image.psnr() seemed quite slow and won't run in a reasonable time on a large spectrogram - or at least that was my finding.\n\nOf course this is not very exact but the output did roughly tally with visual inspections of the spectrograms. And also it roughly correlated with the ratings (think the 5 rated audio files are generally less noisy).\n\nMy idea at the time was to adjust how the test data is treated based on the SNR estimator. I've just not made enough progress with my model etc overall to be able to judge whether this would make a difference, unfortunately.\n\nI have no idea if my attempt was particularly logical or well thought through by the way as am fairly new to this...",
    "1001479": "I have not found a good way to use SNR. Actually the SNR computed using scipy differs from SNR in audio. I thought maybe it's interesting to see if we can use scipy's version for audio arrays. While digging, I found a formula used by Kunihiko Sato. He also provides examples of different audio clips in different SNR ratios. Maybe you will find this useful ;):\n\nhttps://engineering.linecorp.com/ja/blog/voice-waveform-arbitrary-signal-to-noise-ratio-python/\nhttps://github.com/Sato-Kunihiko/audio-SNR",
    "1001483": "Check out the link I posted in reply to Vijay's comment. It contains a formulation of SNR for voices. Might be useful!"
  },
  "source": "meta"
}