{
  "id": 291520,
  "title": "Future frames are available in Time-series API",
  "url": "/competitions/tensorflow-great-barrier-reef/discussion/291520",
  "author_name": "Yauhen Babakhin",
  "post_date": "2021-11-29T19:24:01.342000",
  "votes": 32,
  "comment_count": 3,
  "views": 0,
  "content": "<p>It seems that participants have access to the future frames in Time-series API during the submission. There is <code>features</code> attribute that is available in <code>env</code> object during the first iterator step.</p>\n<p>For example, for 3 sample test images, this code snippet:</p>\n<pre><code>import numpy as np\nimport sys\nsys.path.append('../input/tensorflow-great-barrier-reef')   \n\nimport greatbarrierreef\nenv = greatbarrierreef.make_env()\niter_test = env.iter_test()\n\nfor idx, (pixel_array, sample_prediction_df) in enumerate(iter_test):\n    if idx == 0:\n        print(f\"IDX: {idx}\", env.__dict__.keys())\n        print(f\"IDX: {idx}. Features shape: {env.features.shape}\")\n        features_idx_0 = np.copy(env.features)\n    print(f\"Features are equal to pixel_array for idx=={idx}:\", np.all(features_idx_0[idx] == pixel_array))\n\n    env.predict(sample_prediction_df)\n</code></pre>\n<p>gives the following output:</p>\n<pre><code>IDX: 0 dict_keys(['features', 'sample', 'predictions'])\nIDX: 0. Features shape: (3, 720, 1280, 3)\nFeatures are equal to pixel_array for idx==0: True\nFeatures are equal to pixel_array for idx==1: True\nFeatures are equal to pixel_array for idx==2: True\n</code></pre>\n<p>So, we have access to the numpy array of the shape <code>(3, 720, 1280, 3)</code> during the first step and its content is all three test images. And it seems to hold for submissions with the whole test data, as well.</p>",
  "messages": [
    {
      "id": 1599760,
      "postDate": "2021-11-29T19:24:01.343Z",
      "content": "<p>It seems that participants have access to the future frames in Time-series API during the submission. There is <code>features</code> attribute that is available in <code>env</code> object during the first iterator step.</p>\n<p>For example, for 3 sample test images, this code snippet:</p>\n<pre><code>import numpy as np\nimport sys\nsys.path.append('../input/tensorflow-great-barrier-reef')   \n\nimport greatbarrierreef\nenv = greatbarrierreef.make_env()\niter_test = env.iter_test()\n\nfor idx, (pixel_array, sample_prediction_df) in enumerate(iter_test):\n    if idx == 0:\n        print(f\"IDX: {idx}\", env.__dict__.keys())\n        print(f\"IDX: {idx}. Features shape: {env.features.shape}\")\n        features_idx_0 = np.copy(env.features)\n    print(f\"Features are equal to pixel_array for idx=={idx}:\", np.all(features_idx_0[idx] == pixel_array))\n\n    env.predict(sample_prediction_df)\n</code></pre>\n<p>gives the following output:</p>\n<pre><code>IDX: 0 dict_keys(['features', 'sample', 'predictions'])\nIDX: 0. Features shape: (3, 720, 1280, 3)\nFeatures are equal to pixel_array for idx==0: True\nFeatures are equal to pixel_array for idx==1: True\nFeatures are equal to pixel_array for idx==2: True\n</code></pre>\n<p>So, we have access to the numpy array of the shape <code>(3, 720, 1280, 3)</code> during the first step and its content is all three test images. And it seems to hold for submissions with the whole test data, as well.</p>",
      "rawMarkdown": "It seems that participants have access to the future frames in Time-series API during the submission. There is `features` attribute that is available in `env` object during the first iterator step.\n\nFor example, for 3 sample test images, this code snippet:\n```\nimport numpy as np\nimport sys\nsys.path.append('../input/tensorflow-great-barrier-reef')   \n\nimport greatbarrierreef\nenv = greatbarrierreef.make_env()\niter_test = env.iter_test()\n\nfor idx, (pixel_array, sample_prediction_df) in enumerate(iter_test):\n    if idx == 0:\n        print(f\"IDX: {idx}\", env.__dict__.keys())\n        print(f\"IDX: {idx}. Features shape: {env.features.shape}\")\n        features_idx_0 = np.copy(env.features)\n    print(f\"Features are equal to pixel_array for idx=={idx}:\", np.all(features_idx_0[idx] == pixel_array))\n\n    env.predict(sample_prediction_df)\n```\n\ngives the following output:\n```\nIDX: 0 dict_keys(['features', 'sample', 'predictions'])\nIDX: 0. Features shape: (3, 720, 1280, 3)\nFeatures are equal to pixel_array for idx==0: True\nFeatures are equal to pixel_array for idx==1: True\nFeatures are equal to pixel_array for idx==2: True\n```\n\nSo, we have access to the numpy array of the shape `(3, 720, 1280, 3)` during the first step and its content is all three test images. And it seems to hold for submissions with the whole test data, as well.",
      "votes": 32
    },
    {
      "id": 1599795,
      "postDate": "2021-11-29T20:20:25.297Z",
      "content": "<p>I can confirm that this does not work on the version of the API that delivers the hidden test set.</p>",
      "rawMarkdown": "I can confirm that this does not work on the version of the API that delivers the hidden test set.",
      "votes": 16,
      "replies": [
        {
          "id": 1602082,
          "postDate": "2021-12-01T18:46:01.690Z",
          "content": "<p>Is there <em>any</em> way to revise or asynchronously assign annotations for previous images (<code>current_frame - n</code>) after we have been presented with a new image <code>current_frame</code>? In other words, MUST we <em>immutably</em> set <code>df['annotations']</code> prior to the next iteration of the loop? </p>",
          "rawMarkdown": "Is there *any* way to revise or asynchronously assign annotations for previous images (`current_frame - n`) after we have been presented with a new image `current_frame`? In other words, MUST we _immutably_ set `df['annotations']` prior to the next iteration of the loop? ",
          "votes": 1
        }
      ]
    },
    {
      "id": 1599794,
      "postDate": "2021-11-29T20:18:35.740Z",
      "rawMarkdown": "",
      "isDeleted": true
    }
  ],
  "comments": [
    {
      "id": 1599795,
      "author_name": "Sohier Dane",
      "author_url": "",
      "post_date": "2021-11-29T20:20:25.297000",
      "content": "<p>I can confirm that this does not work on the version of the API that delivers the hidden test set.</p>",
      "votes": 16,
      "replies": [
        {
          "id": 1602082,
          "author_name": "LarryOBrien",
          "author_url": "",
          "post_date": "2021-12-01T18:46:01.690000",
          "content": "<p>Is there <em>any</em> way to revise or asynchronously assign annotations for previous images (<code>current_frame - n</code>) after we have been presented with a new image <code>current_frame</code>? In other words, MUST we <em>immutably</em> set <code>df['annotations']</code> prior to the next iteration of the loop? </p>",
          "votes": 1,
          "replies": []
        }
      ]
    },
    {
      "id": 1599794,
      "author_name": "",
      "author_url": "",
      "post_date": "2021-11-29T20:18:35.740000",
      "content": "",
      "votes": 0,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "1599760": "It seems that participants have access to the future frames in Time-series API during the submission. There is `features` attribute that is available in `env` object during the first iterator step.\n\nFor example, for 3 sample test images, this code snippet:\n```\nimport numpy as np\nimport sys\nsys.path.append('../input/tensorflow-great-barrier-reef')   \n\nimport greatbarrierreef\nenv = greatbarrierreef.make_env()\niter_test = env.iter_test()\n\nfor idx, (pixel_array, sample_prediction_df) in enumerate(iter_test):\n    if idx == 0:\n        print(f\"IDX: {idx}\", env.__dict__.keys())\n        print(f\"IDX: {idx}. Features shape: {env.features.shape}\")\n        features_idx_0 = np.copy(env.features)\n    print(f\"Features are equal to pixel_array for idx=={idx}:\", np.all(features_idx_0[idx] == pixel_array))\n\n    env.predict(sample_prediction_df)\n```\n\ngives the following output:\n```\nIDX: 0 dict_keys(['features', 'sample', 'predictions'])\nIDX: 0. Features shape: (3, 720, 1280, 3)\nFeatures are equal to pixel_array for idx==0: True\nFeatures are equal to pixel_array for idx==1: True\nFeatures are equal to pixel_array for idx==2: True\n```\n\nSo, we have access to the numpy array of the shape `(3, 720, 1280, 3)` during the first step and its content is all three test images. And it seems to hold for submissions with the whole test data, as well.",
    "1599795": "I can confirm that this does not work on the version of the API that delivers the hidden test set.",
    "1599794": ""
  }
}