{
  "id": 391792,
  "title": "16th place solution - Team : Deimon Devil Bats",
  "url": "/competitions/nfl-player-contact-detection/writeups/deimon-devil-bats-16th-place-solution-team-deimon-",
  "author_name": "",
  "post_date": "2023-03-02T17:34:36.345009900Z",
  "votes": 18,
  "comment_count": 2,
  "views": 0,
  "content": "<p>Thanks to the organizers and the kaggle team for organizing the contest. EDA(match watching) was a lot of fun. Thanks to all participants for their hard work. I'll be reading and learning from your solutions!</p>\n<p>Also, thanks to the team, I could do best until the finish. Thanks <a href=\"https://www.kaggle.com/yokuyama\" target=\"_blank\">@yokuyama</a> <a href=\"https://www.kaggle.com/shimishige\" target=\"_blank\">@shimishige</a> !</p>\n<p>During the first half of the competition, each team member tried to create models in their own way (3D segmentaion, CenterNet , etc.), but unfortunately, the scores did not increase at all (LB score &lt; 0.7). With 3 weeks remaining, the policy was changed to proceed on the basis of public notebooks.</p>\n<h2>Summary</h2>\n<p>This is a 2-stage model of Deep Learning (2.5D CNN, Transformer) and GBDT. Each is based on two public notebooks. Thanks <a href=\"https://www.kaggle.com/zzy990106\" target=\"_blank\">@zzy990106</a> (<a href=\"https://www.kaggle.com/code/zzy990106/nfl-2-5d-cnn-baseline-inference\" target=\"_blank\">2.5DCNN</a>) , <a href=\"https://www.kaggle.com/columbia2131\" target=\"_blank\">@columbia2131</a> (<a href=\"https://www.kaggle.com/code/columbia2131/nfl-player-contact-detection-simple-xgb-baseline\" target=\"_blank\">GBDT</a> ).</p>\n<p>Deep is poor at the level of worrying about the correctness of the CV calculation, but it seems to have been sufficient as a feature to GBDT. deep has CV calculation with dist&lt;2 only.\n<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F3381868%2F6d49493565d812fb14f36fded4e4e005%2Fnfl_summary.png?generation=1677776470936082&amp;alt=media\" alt=\"\"></p>\n<h2>1st stage</h2>\n<p><strong>2.5D CNN</strong><br>\nWe created a 1-class output model that predicts player contact and G in the same class, and a 2-class output model that predicts them separately. Two models were created for Endzone and Sideline, respectively, for a total of 4 models.</p>\n<ul>\n<li>Common settings<ul>\n<li>input : Image (±4frame), Tracking data</li>\n<li>backbone : tf_efficientnet_b0_ns</li>\n<li>Image cropping based on predicted player helmet size (max(width, height)*5)</li>\n<li>Prediction only for distance&lt;2</li>\n<li>mixup</li></ul></li>\n<li>1class<ul>\n<li>Train data downsmpling (negative sample to 40,000sample)</li></ul></li>\n<li>2class<ul>\n<li>Helmet position heatmap for player 1 and 2 (<a href=\"https://www.kaggle.com/competitions/nfl-impact-detection/discussion/208947\" target=\"_blank\">reference</a>)</li>\n<li>Temporal Shift Module (<a href=\"https://www.kaggle.com/competitions/dfl-bundesliga-data-shootout/discussion/360236#2003353\" target=\"_blank\">reference code</a> Thanks <a href=\"https://www.kaggle.com/bamps53\" target=\"_blank\">@bamps53</a>)</li></ul></li>\n</ul>\n<p><strong>Transformer + LSTM</strong></p>\n<ul>\n<li>30% skip connection Transformer (<a href=\"https://www.kaggle.com/code/cdeotte/tensorflow-transformer-0-112?scriptVersionId=79039122&amp;cellId=21\" target=\"_blank\">reference code</a> Thanks <a href=\"https://www.kaggle.com/cdeotte\" target=\"_blank\">@cdeotte</a> )</li>\n<li>LSTM in last layer</li>\n<li>25 features based on tracking data</li>\n<li>Scaling with RobustScaler</li>\n</ul>\n<h2>2nd stage</h2>\n<ul>\n<li>catboost was a little better than XGB</li>\n<li>Features (public notebook +)<ul>\n<li>Tracking data : diff, shift, product</li>\n<li>Deep model prob : shift, cummax, cumsum</li>\n<li>helmet size, etc.</li></ul></li>\n</ul>\n<p>↓Adding Deep model predictions (especially CNN) improves the score</p>\n<table>\n<thead>\n<tr>\n<th></th>\n<th>CV</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>Table only</td>\n<td>0.7030</td>\n</tr>\n<tr>\n<td>+ 2.5D CNN 1class</td>\n<td>0.7540</td>\n</tr>\n<tr>\n<td>+ 2.5D CNN 2class</td>\n<td>0.7681</td>\n</tr>\n<tr>\n<td>+ Transformer+LSTM</td>\n<td>0.7683</td>\n</tr>\n</tbody>\n</table>\n<hr>\n<p><strong>Not work</strong></p>\n<ul>\n<li>Interpolation of box undetected helmets by homography transformation. Probably there was a lot of noise, and the score worsened when the box interpolated by the transformation was used honestly.</li>\n<li>Using embedding of CNN</li>\n<li>Batch prediction of players in images (3D segmentaion, CenterNet, etc.)</li>\n</ul>",
  "messages": [
    {
      "id": "2166225",
      "postDate": "03/02/2023 17:34:36",
      "content": "<p>Thanks to the organizers and the kaggle team for organizing the contest. EDA(match watching) was a lot of fun. Thanks to all participants for their hard work. I'll be reading and learning from your solutions!</p>\n<p>Also, thanks to the team, I could do best until the finish. Thanks <a href=\"https://www.kaggle.com/yokuyama\" target=\"_blank\">@yokuyama</a> <a href=\"https://www.kaggle.com/shimishige\" target=\"_blank\">@shimishige</a> !</p>\n<p>During the first half of the competition, each team member tried to create models in their own way (3D segmentaion, CenterNet , etc.), but unfortunately, the scores did not increase at all (LB score &lt; 0.7). With 3 weeks remaining, the policy was changed to proceed on the basis of public notebooks.</p>\n<h2>Summary</h2>\n<p>This is a 2-stage model of Deep Learning (2.5D CNN, Transformer) and GBDT. Each is based on two public notebooks. Thanks <a href=\"https://www.kaggle.com/zzy990106\" target=\"_blank\">@zzy990106</a> (<a href=\"https://www.kaggle.com/code/zzy990106/nfl-2-5d-cnn-baseline-inference\" target=\"_blank\">2.5DCNN</a>) , <a href=\"https://www.kaggle.com/columbia2131\" target=\"_blank\">@columbia2131</a> (<a href=\"https://www.kaggle.com/code/columbia2131/nfl-player-contact-detection-simple-xgb-baseline\" target=\"_blank\">GBDT</a> ).</p>\n<p>Deep is poor at the level of worrying about the correctness of the CV calculation, but it seems to have been sufficient as a feature to GBDT. deep has CV calculation with dist&lt;2 only.\n<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F3381868%2F6d49493565d812fb14f36fded4e4e005%2Fnfl_summary.png?generation=1677776470936082&amp;alt=media\" alt=\"\"></p>\n<h2>1st stage</h2>\n<p><strong>2.5D CNN</strong><br>\nWe created a 1-class output model that predicts player contact and G in the same class, and a 2-class output model that predicts them separately. Two models were created for Endzone and Sideline, respectively, for a total of 4 models.</p>\n<ul>\n<li>Common settings<ul>\n<li>input : Image (±4frame), Tracking data</li>\n<li>backbone : tf_efficientnet_b0_ns</li>\n<li>Image cropping based on predicted player helmet size (max(width, height)*5)</li>\n<li>Prediction only for distance&lt;2</li>\n<li>mixup</li></ul></li>\n<li>1class<ul>\n<li>Train data downsmpling (negative sample to 40,000sample)</li></ul></li>\n<li>2class<ul>\n<li>Helmet position heatmap for player 1 and 2 (<a href=\"https://www.kaggle.com/competitions/nfl-impact-detection/discussion/208947\" target=\"_blank\">reference</a>)</li>\n<li>Temporal Shift Module (<a href=\"https://www.kaggle.com/competitions/dfl-bundesliga-data-shootout/discussion/360236#2003353\" target=\"_blank\">reference code</a> Thanks <a href=\"https://www.kaggle.com/bamps53\" target=\"_blank\">@bamps53</a>)</li></ul></li>\n</ul>\n<p><strong>Transformer + LSTM</strong></p>\n<ul>\n<li>30% skip connection Transformer (<a href=\"https://www.kaggle.com/code/cdeotte/tensorflow-transformer-0-112?scriptVersionId=79039122&amp;cellId=21\" target=\"_blank\">reference code</a> Thanks <a href=\"https://www.kaggle.com/cdeotte\" target=\"_blank\">@cdeotte</a> )</li>\n<li>LSTM in last layer</li>\n<li>25 features based on tracking data</li>\n<li>Scaling with RobustScaler</li>\n</ul>\n<h2>2nd stage</h2>\n<ul>\n<li>catboost was a little better than XGB</li>\n<li>Features (public notebook +)<ul>\n<li>Tracking data : diff, shift, product</li>\n<li>Deep model prob : shift, cummax, cumsum</li>\n<li>helmet size, etc.</li></ul></li>\n</ul>\n<p>↓Adding Deep model predictions (especially CNN) improves the score</p>\n<table>\n<thead>\n<tr>\n<th></th>\n<th>CV</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>Table only</td>\n<td>0.7030</td>\n</tr>\n<tr>\n<td>+ 2.5D CNN 1class</td>\n<td>0.7540</td>\n</tr>\n<tr>\n<td>+ 2.5D CNN 2class</td>\n<td>0.7681</td>\n</tr>\n<tr>\n<td>+ Transformer+LSTM</td>\n<td>0.7683</td>\n</tr>\n</tbody>\n</table>\n<hr>\n<p><strong>Not work</strong></p>\n<ul>\n<li>Interpolation of box undetected helmets by homography transformation. Probably there was a lot of noise, and the score worsened when the box interpolated by the transformation was used honestly.</li>\n<li>Using embedding of CNN</li>\n<li>Batch prediction of players in images (3D segmentaion, CenterNet, etc.)</li>\n</ul>",
      "rawMarkdown": "Thanks to the organizers and the kaggle team for organizing the contest. EDA(match watching) was a lot of fun. Thanks to all participants for their hard work. I'll be reading and learning from your solutions!\n\nAlso, thanks to the team, I could do best until the finish. Thanks @yokuyama @shimishige !\n\n\nDuring the first half of the competition, each team member tried to create models in their own way (3D segmentaion, CenterNet , etc.), but unfortunately, the scores did not increase at all (LB score < 0.7). With 3 weeks remaining, the policy was changed to proceed on the basis of public notebooks.\n\n## Summary\nThis is a 2-stage model of Deep Learning (2.5D CNN, Transformer) and GBDT. Each is based on two public notebooks. Thanks @zzy990106 ([2.5DCNN](https://www.kaggle.com/code/zzy990106/nfl-2-5d-cnn-baseline-inference)) , @columbia2131 ([GBDT](https://www.kaggle.com/code/columbia2131/nfl-player-contact-detection-simple-xgb-baseline) ).\n\nDeep is poor at the level of worrying about the correctness of the CV calculation, but it seems to have been sufficient as a feature to GBDT. deep has CV calculation with dist<2 only.\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F3381868%2F6d49493565d812fb14f36fded4e4e005%2Fnfl_summary.png?generation=1677776470936082&alt=media)\n\n## 1st stage\n**2.5D CNN**\nWe created a 1-class output model that predicts player contact and G in the same class, and a 2-class output model that predicts them separately. Two models were created for Endzone and Sideline, respectively, for a total of 4 models.\n- Common settings\n    - input : Image (±4frame), Tracking data\n    - backbone : tf_efficientnet_b0_ns\n    - Image cropping based on predicted player helmet size (max(width, height)*5)\n    - Prediction only for distance<2\n    - mixup\n- 1class\n    - Train data downsmpling (negative sample to 40,000sample)\n- 2class\n    - Helmet position heatmap for player 1 and 2 ([reference](https://www.kaggle.com/competitions/nfl-impact-detection/discussion/208947))\n    - Temporal Shift Module ([reference code](https://www.kaggle.com/competitions/dfl-bundesliga-data-shootout/discussion/360236#2003353) Thanks @bamps53)\n\n**Transformer + LSTM**\n- 30% skip connection Transformer ([reference code](https://www.kaggle.com/code/cdeotte/tensorflow-transformer-0-112?scriptVersionId=79039122&cellId=21) Thanks @cdeotte )\n- LSTM in last layer\n- 25 features based on tracking data\n- Scaling with RobustScaler\n\n\n## 2nd stage\n- catboost was a little better than XGB\n- Features (public notebook +)\n    - Tracking data : diff, shift, product\n    - Deep model prob : shift, cummax, cumsum\n    - helmet size, etc.\n\n↓Adding Deep model predictions (especially CNN) improves the score\n|  | CV |\n| --- | --- |\n| Table only | 0.7030 |\n| + 2.5D CNN 1class | 0.7540 |\n| + 2.5D CNN 2class | 0.7681 |\n| + Transformer+LSTM | 0.7683 |\n\n---\n**Not work**\n- Interpolation of box undetected helmets by homography transformation. Probably there was a lot of noise, and the score worsened when the box interpolated by the transformation was used honestly.\n- Using embedding of CNN\n- Batch prediction of players in images (3D segmentaion, CenterNet, etc.)",
      "votes": null
    },
    {
      "id": "2170761",
      "postDate": "03/06/2023 09:11:03",
      "content": "<p>thanks for your sharing， may I ask you how you do the shift in the second stage?</p>\n<pre><code>o    Tracking data : diff, shift, product\no    Deep model prob : shift, cummax, cumsum\n</code></pre>",
      "rawMarkdown": "thanks for your sharing， may I ask you how you do the shift in the second stage?\n\n```python\no\tTracking data : diff, shift, product\no\tDeep model prob : shift, cummax, cumsum\n```",
      "votes": null
    },
    {
      "id": "2170765",
      "postDate": "03/06/2023 09:14:29",
      "content": "<p>Thank you for your comment.<br>\nThe implementation is as follows</p>\n<pre><code>    gb = test.groupby([, , ])\n    test[] = gb[col_name].shift(-)\n    test[] = gb[col_name].shift()\n</code></pre>",
      "rawMarkdown": "Thank you for your comment.\nThe implementation is as follows\n```python\n    gb = test.groupby([\"game_play\", \"nfl_player_id_1\", \"nfl_player_id_2\"])\n    test[f\"{col_name}_next\"] = gb[col_name].shift(-2)\n    test[f\"{col_name}_prev\"] = gb[col_name].shift(2)\n```",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 2170761,
      "author_name": "chg0901",
      "author_url": "",
      "post_date": "03/06/2023 09:11:03",
      "content": "<p>thanks for your sharing， may I ask you how you do the shift in the second stage?</p>\n<pre><code>o    Tracking data : diff, shift, product\no    Deep model prob : shift, cummax, cumsum\n</code></pre>",
      "votes": null,
      "replies": [
        {
          "id": 2170765,
          "author_name": "anyai28",
          "author_url": "",
          "post_date": "03/06/2023 09:14:29",
          "content": "<p>Thank you for your comment.<br>\nThe implementation is as follows</p>\n<pre><code>    gb = test.groupby([, , ])\n    test[] = gb[col_name].shift(-)\n    test[] = gb[col_name].shift()\n</code></pre>",
          "votes": null,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "2166225": "Thanks to the organizers and the kaggle team for organizing the contest. EDA(match watching) was a lot of fun. Thanks to all participants for their hard work. I'll be reading and learning from your solutions!\n\nAlso, thanks to the team, I could do best until the finish. Thanks @yokuyama @shimishige !\n\n\nDuring the first half of the competition, each team member tried to create models in their own way (3D segmentaion, CenterNet , etc.), but unfortunately, the scores did not increase at all (LB score < 0.7). With 3 weeks remaining, the policy was changed to proceed on the basis of public notebooks.\n\n## Summary\nThis is a 2-stage model of Deep Learning (2.5D CNN, Transformer) and GBDT. Each is based on two public notebooks. Thanks @zzy990106 ([2.5DCNN](https://www.kaggle.com/code/zzy990106/nfl-2-5d-cnn-baseline-inference)) , @columbia2131 ([GBDT](https://www.kaggle.com/code/columbia2131/nfl-player-contact-detection-simple-xgb-baseline) ).\n\nDeep is poor at the level of worrying about the correctness of the CV calculation, but it seems to have been sufficient as a feature to GBDT. deep has CV calculation with dist<2 only.\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F3381868%2F6d49493565d812fb14f36fded4e4e005%2Fnfl_summary.png?generation=1677776470936082&alt=media)\n\n## 1st stage\n**2.5D CNN**\nWe created a 1-class output model that predicts player contact and G in the same class, and a 2-class output model that predicts them separately. Two models were created for Endzone and Sideline, respectively, for a total of 4 models.\n- Common settings\n    - input : Image (±4frame), Tracking data\n    - backbone : tf_efficientnet_b0_ns\n    - Image cropping based on predicted player helmet size (max(width, height)*5)\n    - Prediction only for distance<2\n    - mixup\n- 1class\n    - Train data downsmpling (negative sample to 40,000sample)\n- 2class\n    - Helmet position heatmap for player 1 and 2 ([reference](https://www.kaggle.com/competitions/nfl-impact-detection/discussion/208947))\n    - Temporal Shift Module ([reference code](https://www.kaggle.com/competitions/dfl-bundesliga-data-shootout/discussion/360236#2003353) Thanks @bamps53)\n\n**Transformer + LSTM**\n- 30% skip connection Transformer ([reference code](https://www.kaggle.com/code/cdeotte/tensorflow-transformer-0-112?scriptVersionId=79039122&cellId=21) Thanks @cdeotte )\n- LSTM in last layer\n- 25 features based on tracking data\n- Scaling with RobustScaler\n\n\n## 2nd stage\n- catboost was a little better than XGB\n- Features (public notebook +)\n    - Tracking data : diff, shift, product\n    - Deep model prob : shift, cummax, cumsum\n    - helmet size, etc.\n\n↓Adding Deep model predictions (especially CNN) improves the score\n|  | CV |\n| --- | --- |\n| Table only | 0.7030 |\n| + 2.5D CNN 1class | 0.7540 |\n| + 2.5D CNN 2class | 0.7681 |\n| + Transformer+LSTM | 0.7683 |\n\n---\n**Not work**\n- Interpolation of box undetected helmets by homography transformation. Probably there was a lot of noise, and the score worsened when the box interpolated by the transformation was used honestly.\n- Using embedding of CNN\n- Batch prediction of players in images (3D segmentaion, CenterNet, etc.)",
    "2170761": "thanks for your sharing， may I ask you how you do the shift in the second stage?\n\n```python\no\tTracking data : diff, shift, product\no\tDeep model prob : shift, cummax, cumsum\n```",
    "2170765": "Thank you for your comment.\nThe implementation is as follows\n```python\n    gb = test.groupby([\"game_play\", \"nfl_player_id_1\", \"nfl_player_id_2\"])\n    test[f\"{col_name}_next\"] = gb[col_name].shift(-2)\n    test[f\"{col_name}_prev\"] = gb[col_name].shift(2)\n```"
  },
  "source": "meta"
}