{
  "id": 275440,
  "title": "19th place solution",
  "url": "/competitions/g2net-gravitational-wave-detection/writeups/we-did-it-19th-place-solution",
  "author_name": "",
  "post_date": "2021-09-30T14:21:41.440Z",
  "votes": 15,
  "comment_count": 1,
  "views": 0,
  "content": "<p>Thank you to the host and Kaggle for organizing the competition. Thank you to all my teammates( <a href=\"https://www.kaggle.com/sunakuzira\" target=\"_blank\">@sunakuzira</a> <a href=\"https://www.kaggle.com/kzkt0713\" target=\"_blank\">@kzkt0713</a> <a href=\"https://www.kaggle.com/keiichimase\" target=\"_blank\">@keiichimase</a> <a href=\"https://www.kaggle.com/kanbehmw\" target=\"_blank\">@kanbehmw</a> )and participants. I would like to share a summary of our solution.</p>\n<h1>CQT</h1>\n<table>\n<thead>\n<tr>\n<th>Model</th>\n<th>oof</th>\n<th>Private LB</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>resnet34d</td>\n<td>0.8794</td>\n<td>0.8797</td>\n</tr>\n<tr>\n<td>tf_efficientnet_b2_ap</td>\n<td>0.8802</td>\n<td>0.8803</td>\n</tr>\n<tr>\n<td>tf_efficientnetvv2_b1</td>\n<td>0.8800</td>\n<td>0.8800</td>\n</tr>\n<tr>\n<td>tf_efficientnet_b2_ap</td>\n<td>0.8801</td>\n<td>0.8800</td>\n</tr>\n<tr>\n<td>resnet34</td>\n<td>0.8787</td>\n<td>0.8786</td>\n</tr>\n</tbody>\n</table>\n<h4>preprocessing</h4>\n<ul>\n<li>standardization: We computed statistics on standardization using entire data set.</li>\n<li>image resize: 276x513 or  207x513</li>\n<li>channel add: We added a channel with added and subtracted LIGO waves.</li>\n</ul>\n<pre><code>  waves = np.stack([\n      waves[0], waves[1], waves[2], \n      waves[0]+waves[1], \n      waves[0]-waves[1]])\n</code></pre>\n<h4>nnAudio.Spectrogram.CQT1992v2</h4>\n<pre><code>CQT1992v2(sr=2048, fmin=20, fmax=1024, hop_length=8or4, window=\"flattop\")\n</code></pre>\n<h4>Augmentation</h4>\n<ul>\n<li>augmentation by mixed waveforms</li>\n</ul>\n<pre><code>class CustomDataset(Dataset):\n    def __init__(self, train, ...):\n        self.train = train.reset_index(drop=True).copy()\n        self.labels = train[\"target\"].values\n        self.train_target0 = train[train[\"target\"] == 0]\n    ...\n    def __getitem__(self, index):\n        y_true = self.labels[index]\n        y_true = torch.tensor(y_true).float()\n        ...\n        if np.random.rand() &gt; 0.5:\n            if y_true == 0:\n                sample = self.train.sample()\n            else:\n                sample = self.train_target0.sample()\n            wave2_path = sample.iloc[0]['file_path']\n            waves2 = self.load_img(wave2_path)\n\n            waves = waves + waves2\n            if sample.iloc[0]['target'] == 1:\n                y_true = torch.tensor(1).float()\n</code></pre>\n<ul>\n<li>albumentations</li>\n</ul>\n<pre><code>albumentations.ShiftScaleRotate(p=0.5, shift_limit=0.0, scale_limit=0.2or0.3, rotate_limit=0)\n</code></pre>\n<h1>1dCNN</h1>\n<table>\n<thead>\n<tr>\n<th>Model</th>\n<th>oof</th>\n<th>Private LB</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>1dCNN</td>\n<td>0.8753</td>\n<td>0.8769</td>\n</tr>\n</tbody>\n</table>\n<p>The architecture of 1dcnn used Public Kernel.( <a href=\"https://www.kaggle.com/kit716/grav-wave-detection/data?select=g2net_models.py\" target=\"_blank\">https://www.kaggle.com/kit716/grav-wave-detection/data?select=g2net_models.py</a> )</p>\n<h4>preprocessing</h4>\n<ul>\n<li>standardization: We computed statistics on standardization using entire data set.</li>\n<li>band pass: scipy.signal.butter(6, (35, 800), btype='bandpass', fs=2048)</li>\n<li>channel add: Same as CQT.</li>\n</ul>\n<h4>Augmentation</h4>\n<ul>\n<li>random invert waves</li>\n</ul>\n<pre><code>if np.random.rand() &gt; 0.5:\n    waves = waves*-1\n</code></pre>\n<ul>\n<li>albumentations</li>\n</ul>\n<pre><code>albumentations.ShiftScaleRotate(p=0.5, shift_limit=0.0, scale_limit=0.1, rotate_limit=0)\n</code></pre>\n<h4>TTA</h4>\n<ul>\n<li>We used TTA with the same Augmentation as train.</li>\n</ul>\n<h1>pseudo label</h1>\n<ul>\n<li>We used a high LB submission.csv as a <strong>soft label</strong>.</li>\n</ul>\n<h1>weight optimize blending</h1>\n<ul>\n<li>We used oof to optimize the weights. We used Public Kernel.( <a href=\"https://www.kaggle.com/itsuki9180/g2net-oof-weight-optimizer\" target=\"_blank\">https://www.kaggle.com/itsuki9180/g2net-oof-weight-optimizer</a> )</li>\n<li><strong>6model oof : CV:  0.8812, Private LB: 0.8805</strong></li>\n</ul>",
  "messages": [
    {
      "id": "1529502",
      "postDate": "09/30/2021 13:01:04",
      "content": "<p>Thank you to the host and Kaggle for organizing the competition. Thank you to all my teammates( <a href=\"https://www.kaggle.com/sunakuzira\" target=\"_blank\">@sunakuzira</a> <a href=\"https://www.kaggle.com/kzkt0713\" target=\"_blank\">@kzkt0713</a> <a href=\"https://www.kaggle.com/keiichimase\" target=\"_blank\">@keiichimase</a> <a href=\"https://www.kaggle.com/kanbehmw\" target=\"_blank\">@kanbehmw</a> )and participants. I would like to share a summary of our solution.</p>\n<h1>CQT</h1>\n<table>\n<thead>\n<tr>\n<th>Model</th>\n<th>oof</th>\n<th>Private LB</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>resnet34d</td>\n<td>0.8794</td>\n<td>0.8797</td>\n</tr>\n<tr>\n<td>tf_efficientnet_b2_ap</td>\n<td>0.8802</td>\n<td>0.8803</td>\n</tr>\n<tr>\n<td>tf_efficientnetvv2_b1</td>\n<td>0.8800</td>\n<td>0.8800</td>\n</tr>\n<tr>\n<td>tf_efficientnet_b2_ap</td>\n<td>0.8801</td>\n<td>0.8800</td>\n</tr>\n<tr>\n<td>resnet34</td>\n<td>0.8787</td>\n<td>0.8786</td>\n</tr>\n</tbody>\n</table>\n<h4>preprocessing</h4>\n<ul>\n<li>standardization: We computed statistics on standardization using entire data set.</li>\n<li>image resize: 276x513 or  207x513</li>\n<li>channel add: We added a channel with added and subtracted LIGO waves.</li>\n</ul>\n<pre><code>  waves = np.stack([\n      waves[0], waves[1], waves[2], \n      waves[0]+waves[1], \n      waves[0]-waves[1]])\n</code></pre>\n<h4>nnAudio.Spectrogram.CQT1992v2</h4>\n<pre><code>CQT1992v2(sr=2048, fmin=20, fmax=1024, hop_length=8or4, window=\"flattop\")\n</code></pre>\n<h4>Augmentation</h4>\n<ul>\n<li>augmentation by mixed waveforms</li>\n</ul>\n<pre><code>class CustomDataset(Dataset):\n    def __init__(self, train, ...):\n        self.train = train.reset_index(drop=True).copy()\n        self.labels = train[\"target\"].values\n        self.train_target0 = train[train[\"target\"] == 0]\n    ...\n    def __getitem__(self, index):\n        y_true = self.labels[index]\n        y_true = torch.tensor(y_true).float()\n        ...\n        if np.random.rand() &gt; 0.5:\n            if y_true == 0:\n                sample = self.train.sample()\n            else:\n                sample = self.train_target0.sample()\n            wave2_path = sample.iloc[0]['file_path']\n            waves2 = self.load_img(wave2_path)\n\n            waves = waves + waves2\n            if sample.iloc[0]['target'] == 1:\n                y_true = torch.tensor(1).float()\n</code></pre>\n<ul>\n<li>albumentations</li>\n</ul>\n<pre><code>albumentations.ShiftScaleRotate(p=0.5, shift_limit=0.0, scale_limit=0.2or0.3, rotate_limit=0)\n</code></pre>\n<h1>1dCNN</h1>\n<table>\n<thead>\n<tr>\n<th>Model</th>\n<th>oof</th>\n<th>Private LB</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>1dCNN</td>\n<td>0.8753</td>\n<td>0.8769</td>\n</tr>\n</tbody>\n</table>\n<p>The architecture of 1dcnn used Public Kernel.( <a href=\"https://www.kaggle.com/kit716/grav-wave-detection/data?select=g2net_models.py\" target=\"_blank\">https://www.kaggle.com/kit716/grav-wave-detection/data?select=g2net_models.py</a> )</p>\n<h4>preprocessing</h4>\n<ul>\n<li>standardization: We computed statistics on standardization using entire data set.</li>\n<li>band pass: scipy.signal.butter(6, (35, 800), btype='bandpass', fs=2048)</li>\n<li>channel add: Same as CQT.</li>\n</ul>\n<h4>Augmentation</h4>\n<ul>\n<li>random invert waves</li>\n</ul>\n<pre><code>if np.random.rand() &gt; 0.5:\n    waves = waves*-1\n</code></pre>\n<ul>\n<li>albumentations</li>\n</ul>\n<pre><code>albumentations.ShiftScaleRotate(p=0.5, shift_limit=0.0, scale_limit=0.1, rotate_limit=0)\n</code></pre>\n<h4>TTA</h4>\n<ul>\n<li>We used TTA with the same Augmentation as train.</li>\n</ul>\n<h1>pseudo label</h1>\n<ul>\n<li>We used a high LB submission.csv as a <strong>soft label</strong>.</li>\n</ul>\n<h1>weight optimize blending</h1>\n<ul>\n<li>We used oof to optimize the weights. We used Public Kernel.( <a href=\"https://www.kaggle.com/itsuki9180/g2net-oof-weight-optimizer\" target=\"_blank\">https://www.kaggle.com/itsuki9180/g2net-oof-weight-optimizer</a> )</li>\n<li><strong>6model oof : CV:  0.8812, Private LB: 0.8805</strong></li>\n</ul>",
      "rawMarkdown": "Thank you to the host and Kaggle for organizing the competition. Thank you to all my teammates( @sunakuzira @kzkt0713 @keiichimase @kanbehmw )and participants. I would like to share a summary of our solution.\n\n# CQT\n| Model | oof | Private LB |\n| :---: | :---: | :---: |\n| resnet34d | 0.8794 | 0.8797 |\n| tf_efficientnet_b2_ap | 0.8802 | 0.8803 |\n| tf_efficientnetvv2_b1 | 0.8800 | 0.8800 |\n| tf_efficientnet_b2_ap | 0.8801 | 0.8800 |\n| resnet34 | 0.8787 | 0.8786 |\n\n#### preprocessing\n- standardization: We computed statistics on standardization using entire data set.\n- image resize: 276x513 or  207x513\n- channel add: We added a channel with added and subtracted LIGO waves.\n  ```\n  waves = np.stack([\n      waves[0], waves[1], waves[2], \n      waves[0]+waves[1], \n      waves[0]-waves[1]])\n  ```\n\n#### nnAudio.Spectrogram.CQT1992v2\n```\nCQT1992v2(sr=2048, fmin=20, fmax=1024, hop_length=8or4, window=\"flattop\")\n```\n\n#### Augmentation\n- augmentation by mixed waveforms\n```\nclass CustomDataset(Dataset):\n    def __init__(self, train, ...):\n        self.train = train.reset_index(drop=True).copy()\n        self.labels = train[\"target\"].values\n        self.train_target0 = train[train[\"target\"] == 0]\n    ...\n    def __getitem__(self, index):\n        y_true = self.labels[index]\n        y_true = torch.tensor(y_true).float()\n        ...\n        if np.random.rand() > 0.5:\n            if y_true == 0:\n                sample = self.train.sample()\n            else:\n                sample = self.train_target0.sample()\n            wave2_path = sample.iloc[0]['file_path']\n            waves2 = self.load_img(wave2_path)\n\n            waves = waves + waves2\n            if sample.iloc[0]['target'] == 1:\n                y_true = torch.tensor(1).float()\n```\n  \n- albumentations\n```\nalbumentations.ShiftScaleRotate(p=0.5, shift_limit=0.0, scale_limit=0.2or0.3, rotate_limit=0)\n```\n\n\n# 1dCNN\n| Model | oof | Private LB |\n| :---: | :---: | :---: |\n| 1dCNN | 0.8753 | 0.8769 |\n\nThe architecture of 1dcnn used Public Kernel.( https://www.kaggle.com/kit716/grav-wave-detection/data?select=g2net_models.py )\n\n#### preprocessing\n- standardization: We computed statistics on standardization using entire data set.\n- band pass: scipy.signal.butter(6, (35, 800), btype='bandpass', fs=2048)\n- channel add: Same as CQT.\n\n#### Augmentation\n- random invert waves\n```\nif np.random.rand() > 0.5:\n    waves = waves*-1\n```\n- albumentations\n```\nalbumentations.ShiftScaleRotate(p=0.5, shift_limit=0.0, scale_limit=0.1, rotate_limit=0)\n```\n\n#### TTA\n- We used TTA with the same Augmentation as train.\n\n# pseudo label\n- We used a high LB submission.csv as a **soft label**.\n\n# weight optimize blending\n- We used oof to optimize the weights. We used Public Kernel.( https://www.kaggle.com/itsuki9180/g2net-oof-weight-optimizer )\n- **6model oof : CV:  0.8812, Private LB: 0.8805**",
      "votes": null
    },
    {
      "id": "1559885",
      "postDate": "10/27/2021 08:05:56",
      "content": "<p>Hey All,</p>\n<p>Thank you all for taking part in our competition. The participation has been overwhelmingly positive. We are currently conducting a survey to gauge the demographic and outreach achieved. Kindly spare 2min and fill in this survey <a href=\"https://forms.gle/QP9L16niPexozyhu5\" target=\"_blank\">https://forms.gle/QP9L16niPexozyhu5</a>.</p>\n<p>Thank you all,</p>\n<p>Regards,<br>\nChris</p>",
      "rawMarkdown": "Hey All,\n\nThank you all for taking part in our competition. The participation has been overwhelmingly positive. We are currently conducting a survey to gauge the demographic and outreach achieved. Kindly spare 2min and fill in this survey https://forms.gle/QP9L16niPexozyhu5.\n\nThank you all,\n\nRegards,\nChris",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 1559885,
      "author_name": "zerafachris",
      "author_url": "",
      "post_date": "10/27/2021 08:05:56",
      "content": "<p>Hey All,</p>\n<p>Thank you all for taking part in our competition. The participation has been overwhelmingly positive. We are currently conducting a survey to gauge the demographic and outreach achieved. Kindly spare 2min and fill in this survey <a href=\"https://forms.gle/QP9L16niPexozyhu5\" target=\"_blank\">https://forms.gle/QP9L16niPexozyhu5</a>.</p>\n<p>Thank you all,</p>\n<p>Regards,<br>\nChris</p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "1529502": "Thank you to the host and Kaggle for organizing the competition. Thank you to all my teammates( @sunakuzira @kzkt0713 @keiichimase @kanbehmw )and participants. I would like to share a summary of our solution.\n\n# CQT\n| Model | oof | Private LB |\n| :---: | :---: | :---: |\n| resnet34d | 0.8794 | 0.8797 |\n| tf_efficientnet_b2_ap | 0.8802 | 0.8803 |\n| tf_efficientnetvv2_b1 | 0.8800 | 0.8800 |\n| tf_efficientnet_b2_ap | 0.8801 | 0.8800 |\n| resnet34 | 0.8787 | 0.8786 |\n\n#### preprocessing\n- standardization: We computed statistics on standardization using entire data set.\n- image resize: 276x513 or  207x513\n- channel add: We added a channel with added and subtracted LIGO waves.\n  ```\n  waves = np.stack([\n      waves[0], waves[1], waves[2], \n      waves[0]+waves[1], \n      waves[0]-waves[1]])\n  ```\n\n#### nnAudio.Spectrogram.CQT1992v2\n```\nCQT1992v2(sr=2048, fmin=20, fmax=1024, hop_length=8or4, window=\"flattop\")\n```\n\n#### Augmentation\n- augmentation by mixed waveforms\n```\nclass CustomDataset(Dataset):\n    def __init__(self, train, ...):\n        self.train = train.reset_index(drop=True).copy()\n        self.labels = train[\"target\"].values\n        self.train_target0 = train[train[\"target\"] == 0]\n    ...\n    def __getitem__(self, index):\n        y_true = self.labels[index]\n        y_true = torch.tensor(y_true).float()\n        ...\n        if np.random.rand() > 0.5:\n            if y_true == 0:\n                sample = self.train.sample()\n            else:\n                sample = self.train_target0.sample()\n            wave2_path = sample.iloc[0]['file_path']\n            waves2 = self.load_img(wave2_path)\n\n            waves = waves + waves2\n            if sample.iloc[0]['target'] == 1:\n                y_true = torch.tensor(1).float()\n```\n  \n- albumentations\n```\nalbumentations.ShiftScaleRotate(p=0.5, shift_limit=0.0, scale_limit=0.2or0.3, rotate_limit=0)\n```\n\n\n# 1dCNN\n| Model | oof | Private LB |\n| :---: | :---: | :---: |\n| 1dCNN | 0.8753 | 0.8769 |\n\nThe architecture of 1dcnn used Public Kernel.( https://www.kaggle.com/kit716/grav-wave-detection/data?select=g2net_models.py )\n\n#### preprocessing\n- standardization: We computed statistics on standardization using entire data set.\n- band pass: scipy.signal.butter(6, (35, 800), btype='bandpass', fs=2048)\n- channel add: Same as CQT.\n\n#### Augmentation\n- random invert waves\n```\nif np.random.rand() > 0.5:\n    waves = waves*-1\n```\n- albumentations\n```\nalbumentations.ShiftScaleRotate(p=0.5, shift_limit=0.0, scale_limit=0.1, rotate_limit=0)\n```\n\n#### TTA\n- We used TTA with the same Augmentation as train.\n\n# pseudo label\n- We used a high LB submission.csv as a **soft label**.\n\n# weight optimize blending\n- We used oof to optimize the weights. We used Public Kernel.( https://www.kaggle.com/itsuki9180/g2net-oof-weight-optimizer )\n- **6model oof : CV:  0.8812, Private LB: 0.8805**",
    "1559885": "Hey All,\n\nThank you all for taking part in our competition. The participation has been overwhelmingly positive. We are currently conducting a survey to gauge the demographic and outreach achieved. Kindly spare 2min and fill in this survey https://forms.gle/QP9L16niPexozyhu5.\n\nThank you all,\n\nRegards,\nChris"
  },
  "source": "meta"
}