{
  "id": 371638,
  "title": "More Understanding of the data",
  "url": "/competitions/nfl-player-contact-detection/discussion/371638",
  "author_name": "",
  "post_date": "2022-12-11T13:28:22.134499500Z",
  "votes": 10,
  "comment_count": 4,
  "views": 0,
  "content": "<p>Hello everyone, </p>\n<p>I'm having a hard time to understand how to align train labels with train_player_tracking with the video, since each video has approximately 711 frames. How do I align these data with the video? <br>\nMy question is how to know each frame will take which row in these csv files. </p>\n<p>Thank you! <br>\nany help is much apppreciated</p>",
  "messages": [
    {
      "id": "2061777",
      "postDate": "12/11/2022 13:28:22",
      "content": "<p>Hello everyone, </p>\n<p>I'm having a hard time to understand how to align train labels with train_player_tracking with the video, since each video has approximately 711 frames. How do I align these data with the video? <br>\nMy question is how to know each frame will take which row in these csv files. </p>\n<p>Thank you! <br>\nany help is much apppreciated</p>",
      "rawMarkdown": "Hello everyone, \n\nI'm having a hard time to understand how to align train labels with train_player_tracking with the video, since each video has approximately 711 frames. How do I align these data with the video? \nMy question is how to know each frame will take which row in these csv files. \n\nThank you! \nany help is much apppreciated",
      "votes": null
    },
    {
      "id": "2063356",
      "postDate": "12/12/2022 20:14:37",
      "content": "<p><a href=\"https://www.kaggle.com/naifalkhunaizi3\" target=\"_blank\">@naifalkhunaizi3</a> - A few things to keep in mind about the two data sources:</p>\n<ul>\n<li>Tracking data is collected at 10Hz every 0.1 second should have a datapoint.</li>\n<li>Video data is collected at 59.94Hz.</li>\n<li>Submissions are at the tracking data 10Hz.</li>\n</ul>\n<p>Because of the differences in sample rate it's impossible to perfectly line up the two datasets. One approach is to use the <code>metadata</code> file which gives the approximate <code>start_time</code> of each video, then calculate the approximate timestamp of each frame to merge with the tracking data.</p>\n<p>You can check the <code>join_helmets_contact</code> function in the starter notebook here: <a href=\"https://www.kaggle.com/code/robikscube/nfl-player-contact-detection-getting-started\" target=\"_blank\">https://www.kaggle.com/code/robikscube/nfl-player-contact-detection-getting-started</a></p>\n<p>You can also look at solutions from prior years to see how others approached merging this data.</p>\n<p>Hope that helps. Good luck!</p>",
      "rawMarkdown": "naifalkhunaizi3 - A few things to keep in mind about the two data sources:\n- Tracking data is collected at 10Hz every 0.1 second should have a datapoint.\n- Video data is collected at 59.94Hz.\n- Submissions are at the tracking data 10Hz.\n\nBecause of the differences in sample rate it's impossible to perfectly line up the two datasets. One approach is to use the `metadata` file which gives the approximate `start_time` of each video, then calculate the approximate timestamp of each frame to merge with the tracking data.\n\nYou can check the `join_helmets_contact` function in the starter notebook here: https://www.kaggle.com/code/robikscube/nfl-player-contact-detection-getting-started\n\nYou can also look at solutions from prior years to see how others approached merging this data.\n\nHope that helps. Good luck!",
      "votes": null
    },
    {
      "id": "2063533",
      "postDate": "12/13/2022 03:28:13",
      "content": "<p>Can we directly convert between step and frame? I currently use <code>frame = int(step/10*59.95+5*59.95)</code> instead of datetime. Do you think it's right? Thank you.</p>",
      "rawMarkdown": "Can we directly convert between step and frame? I currently use `frame = int(step/10*59.95+5*59.95)` instead of datetime. Do you think it's right? Thank you.",
      "votes": null
    },
    {
      "id": "2064184",
      "postDate": "12/13/2022 15:09:14",
      "content": "<p><a href=\"https://www.kaggle.com/zzy990106\" target=\"_blank\">@zzy990106</a> I can't say which works best because I don't know. You might want to try different methods and validate if they make a difference. Your calculation looks okay but note you truncate the frame when using <code>int</code></p>\n<pre><code>&gt;&gt;&gt; for step in range(10):\n&gt;&gt;&gt;      frame_ = step/10*59.94+5*59.94\n&gt;&gt;&gt;      frame = int(frame_)\n&gt;&gt;&gt;      print(step, frame, frame_)\n\n0 299 299.7\n1 305 305.69399999999996\n2 311 311.688\n3 317 317.682\n4 323 323.676\n5 329 329.66999999999996\n6 335 335.664\n7 341 341.658\n8 347 347.652\n9 353 353.64599999999996\n</code></pre>\n<p>To any that are wondering how this equation works: We know the start of the play (step 0) for Sideline/Endzone videos is roughly 5 seconds into the video and the video is sampled at roughly <code>59.94Hz</code>. So the frame of step 0 should be 5*59.94 (frame 299). Every other step is an increment of 0.1 seconds and can be computed by adding (step/10*59.94).</p>\n<p>Note the video is sampled at 59.94Hz not 59.95Hz. Practically this shouldn't change anything. There was a typo in the data description now fixed.</p>",
      "rawMarkdown": "zzy990106 I can't say which works best because I don't know. You might want to try different methods and validate if they make a difference. Your calculation looks okay but note you truncate the frame when using `int`\n\n```\n>>> for step in range(10):\n>>>      frame_ = step/10*59.94+5*59.94\n>>>      frame = int(frame_)\n>>>      print(step, frame, frame_)\n\n0 299 299.7\n1 305 305.69399999999996\n2 311 311.688\n3 317 317.682\n4 323 323.676\n5 329 329.66999999999996\n6 335 335.664\n7 341 341.658\n8 347 347.652\n9 353 353.64599999999996\n```\n\nTo any that are wondering how this equation works: We know the start of the play (step 0) for Sideline/Endzone videos is roughly 5 seconds into the video and the video is sampled at roughly `59.94Hz`. So the frame of step 0 should be 5\\*59.94 (frame 299). Every other step is an increment of 0.1 seconds and can be computed by adding (step/10*59.94).\n\nNote the video is sampled at 59.94Hz not 59.95Hz. Practically this shouldn't change anything. There was a typo in the data description now fixed.",
      "votes": null
    },
    {
      "id": "2064191",
      "postDate": "12/13/2022 15:12:45",
      "content": "<p>Thank you for detailed explanation. Helps a lot.</p>",
      "rawMarkdown": "Thank you for detailed explanation. Helps a lot.",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 2063356,
      "author_name": "robikscube",
      "author_url": "",
      "post_date": "12/12/2022 20:14:37",
      "content": "<p><a href=\"https://www.kaggle.com/naifalkhunaizi3\" target=\"_blank\">@naifalkhunaizi3</a> - A few things to keep in mind about the two data sources:</p>\n<ul>\n<li>Tracking data is collected at 10Hz every 0.1 second should have a datapoint.</li>\n<li>Video data is collected at 59.94Hz.</li>\n<li>Submissions are at the tracking data 10Hz.</li>\n</ul>\n<p>Because of the differences in sample rate it's impossible to perfectly line up the two datasets. One approach is to use the <code>metadata</code> file which gives the approximate <code>start_time</code> of each video, then calculate the approximate timestamp of each frame to merge with the tracking data.</p>\n<p>You can check the <code>join_helmets_contact</code> function in the starter notebook here: <a href=\"https://www.kaggle.com/code/robikscube/nfl-player-contact-detection-getting-started\" target=\"_blank\">https://www.kaggle.com/code/robikscube/nfl-player-contact-detection-getting-started</a></p>\n<p>You can also look at solutions from prior years to see how others approached merging this data.</p>\n<p>Hope that helps. Good luck!</p>",
      "votes": null,
      "replies": [
        {
          "id": 2063533,
          "author_name": "zzy990106",
          "author_url": "",
          "post_date": "12/13/2022 03:28:13",
          "content": "<p>Can we directly convert between step and frame? I currently use <code>frame = int(step/10*59.95+5*59.95)</code> instead of datetime. Do you think it's right? Thank you.</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 2064184,
          "author_name": "robikscube",
          "author_url": "",
          "post_date": "12/13/2022 15:09:14",
          "content": "<p><a href=\"https://www.kaggle.com/zzy990106\" target=\"_blank\">@zzy990106</a> I can't say which works best because I don't know. You might want to try different methods and validate if they make a difference. Your calculation looks okay but note you truncate the frame when using <code>int</code></p>\n<pre><code>&gt;&gt;&gt; for step in range(10):\n&gt;&gt;&gt;      frame_ = step/10*59.94+5*59.94\n&gt;&gt;&gt;      frame = int(frame_)\n&gt;&gt;&gt;      print(step, frame, frame_)\n\n0 299 299.7\n1 305 305.69399999999996\n2 311 311.688\n3 317 317.682\n4 323 323.676\n5 329 329.66999999999996\n6 335 335.664\n7 341 341.658\n8 347 347.652\n9 353 353.64599999999996\n</code></pre>\n<p>To any that are wondering how this equation works: We know the start of the play (step 0) for Sideline/Endzone videos is roughly 5 seconds into the video and the video is sampled at roughly <code>59.94Hz</code>. So the frame of step 0 should be 5*59.94 (frame 299). Every other step is an increment of 0.1 seconds and can be computed by adding (step/10*59.94).</p>\n<p>Note the video is sampled at 59.94Hz not 59.95Hz. Practically this shouldn't change anything. There was a typo in the data description now fixed.</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 2064191,
          "author_name": "zzy990106",
          "author_url": "",
          "post_date": "12/13/2022 15:12:45",
          "content": "<p>Thank you for detailed explanation. Helps a lot.</p>",
          "votes": null,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "2061777": "Hello everyone, \n\nI'm having a hard time to understand how to align train labels with train_player_tracking with the video, since each video has approximately 711 frames. How do I align these data with the video? \nMy question is how to know each frame will take which row in these csv files. \n\nThank you! \nany help is much apppreciated",
    "2063356": "naifalkhunaizi3 - A few things to keep in mind about the two data sources:\n- Tracking data is collected at 10Hz every 0.1 second should have a datapoint.\n- Video data is collected at 59.94Hz.\n- Submissions are at the tracking data 10Hz.\n\nBecause of the differences in sample rate it's impossible to perfectly line up the two datasets. One approach is to use the `metadata` file which gives the approximate `start_time` of each video, then calculate the approximate timestamp of each frame to merge with the tracking data.\n\nYou can check the `join_helmets_contact` function in the starter notebook here: https://www.kaggle.com/code/robikscube/nfl-player-contact-detection-getting-started\n\nYou can also look at solutions from prior years to see how others approached merging this data.\n\nHope that helps. Good luck!",
    "2063533": "Can we directly convert between step and frame? I currently use `frame = int(step/10*59.95+5*59.95)` instead of datetime. Do you think it's right? Thank you.",
    "2064184": "zzy990106 I can't say which works best because I don't know. You might want to try different methods and validate if they make a difference. Your calculation looks okay but note you truncate the frame when using `int`\n\n```\n>>> for step in range(10):\n>>>      frame_ = step/10*59.94+5*59.94\n>>>      frame = int(frame_)\n>>>      print(step, frame, frame_)\n\n0 299 299.7\n1 305 305.69399999999996\n2 311 311.688\n3 317 317.682\n4 323 323.676\n5 329 329.66999999999996\n6 335 335.664\n7 341 341.658\n8 347 347.652\n9 353 353.64599999999996\n```\n\nTo any that are wondering how this equation works: We know the start of the play (step 0) for Sideline/Endzone videos is roughly 5 seconds into the video and the video is sampled at roughly `59.94Hz`. So the frame of step 0 should be 5\\*59.94 (frame 299). Every other step is an increment of 0.1 seconds and can be computed by adding (step/10*59.94).\n\nNote the video is sampled at 59.94Hz not 59.95Hz. Practically this shouldn't change anything. There was a typo in the data description now fixed.",
    "2064191": "Thank you for detailed explanation. Helps a lot."
  },
  "source": "meta"
}