{
  "id": 240319,
  "title": "13th place solution",
  "url": "/competitions/indoor-location-navigation/writeups/olaf-placha-13th-place-solution",
  "author_name": "",
  "post_date": "2021-05-28T21:42:22.280Z",
  "votes": 17,
  "comment_count": 2,
  "views": 0,
  "content": "<p>In the beginning I would like to thank <a href=\"https://www.kaggle.com/kokitanisaka\" target=\"_blank\">@kokitanisaka</a> for unified wifi dataset, <a href=\"https://www.kaggle.com/robikscube\" target=\"_blank\">@robikscube</a> for snap to grid, <a href=\"https://www.kaggle.com/saitodevel01\" target=\"_blank\">@saitodevel01</a> for cost minimization and <a href=\"https://www.kaggle.com/joelqv\" target=\"_blank\">@joelqv</a> for MLP and shapely notebooks. They were really helpful!</p>\n<p>My pipeline was as follows (it is simplified, but shows the core ideas of my solution):</p>\n<ol>\n<li>train floor LSTM. I used predicted floor as an input to the following models</li>\n<li>train a stack of BiLSTMs which predicted position with 2 seconds frequency. I used smoothed wifi and beacons RSSI values as well as IMU data. The architecture was: <a href=\"https://imgur.com/9Zqxlex\" target=\"_blank\">link</a></li>\n<li>train a stack of MLPs using unified wifi dataset</li>\n<li>ensemble 2. and 3. </li>\n<li>train LSTM which predicted distance covered between 2 waypoints. I used the whole data, from over 100 buildings. It achieved 70 cm accuracy</li>\n<li>train delta correction LSTM. Refer to <a href=\"https://www.kaggle.com/c/indoor-location-navigation/discussion/239884\" target=\"_blank\">my previous post</a></li>\n<li>cost minimize 4., 5. and 6. </li>\n</ol>\n<p>At this point path trajectories looked really promising, they were usually just shifted. So I decided to come up with a method which would shift them into corridors. I defined a cost function which for every predicted coordinate in the path calculated squared distance from the closest waypoint and summed it up (I also used distance from the corridor calculated by BFS. It gave slightly worse score, but didn't require waypoints). The goal was to minimize this cost (which was intended to be local minimum). The iterative algorithm worked as follows:</p>\n<ul>\n<li>for every vector <em>v</em> in [-1, -0.5, 0, 0.5, 1] x [-1, -0.5, 0, 0.5, 1] calculate what would be the cost after shifting the path by this vector</li>\n<li>choose the shift that gives the smallest cost and shift the path by this vector</li>\n<li>repeat the procedure until the cost converges</li>\n</ul>\n<p>The results can be found <a href=\"https://imgur.com/a/K7u8izU\" target=\"_blank\">here</a> and <a href=\"https://imgur.com/a/zdbt0qP\" target=\"_blank\">here</a> (this technique is <strong>different from what other teams have used</strong>, so I recommend to take a look at the result :))</p>\n<p>Finally snap to grid </p>\n<p>I used automatically generated waypoints which were created by the following procedure:</p>\n<ul>\n<li>create a floor mask using shapely</li>\n<li>\"flood\" area around every training waypoint</li>\n<li>in areas that remained unchanged create dense grid<br>\nExample of the resulting mask is <a href=\"https://imgur.com/a/KP43X58\" target=\"_blank\">here</a></li>\n</ul>\n<p>Once again thank you all for the competition. It was my first one. I'll definitely take part in another in the future.</p>",
  "messages": [
    {
      "id": "1314595",
      "postDate": "05/19/2021 08:58:14",
      "content": "<p>In the beginning I would like to thank <a href=\"https://www.kaggle.com/kokitanisaka\" target=\"_blank\">@kokitanisaka</a> for unified wifi dataset, <a href=\"https://www.kaggle.com/robikscube\" target=\"_blank\">@robikscube</a> for snap to grid, <a href=\"https://www.kaggle.com/saitodevel01\" target=\"_blank\">@saitodevel01</a> for cost minimization and <a href=\"https://www.kaggle.com/joelqv\" target=\"_blank\">@joelqv</a> for MLP and shapely notebooks. They were really helpful!</p>\n<p>My pipeline was as follows (it is simplified, but shows the core ideas of my solution):</p>\n<ol>\n<li>train floor LSTM. I used predicted floor as an input to the following models</li>\n<li>train a stack of BiLSTMs which predicted position with 2 seconds frequency. I used smoothed wifi and beacons RSSI values as well as IMU data. The architecture was: <a href=\"https://imgur.com/9Zqxlex\" target=\"_blank\">link</a></li>\n<li>train a stack of MLPs using unified wifi dataset</li>\n<li>ensemble 2. and 3. </li>\n<li>train LSTM which predicted distance covered between 2 waypoints. I used the whole data, from over 100 buildings. It achieved 70 cm accuracy</li>\n<li>train delta correction LSTM. Refer to <a href=\"https://www.kaggle.com/c/indoor-location-navigation/discussion/239884\" target=\"_blank\">my previous post</a></li>\n<li>cost minimize 4., 5. and 6. </li>\n</ol>\n<p>At this point path trajectories looked really promising, they were usually just shifted. So I decided to come up with a method which would shift them into corridors. I defined a cost function which for every predicted coordinate in the path calculated squared distance from the closest waypoint and summed it up (I also used distance from the corridor calculated by BFS. It gave slightly worse score, but didn't require waypoints). The goal was to minimize this cost (which was intended to be local minimum). The iterative algorithm worked as follows:</p>\n<ul>\n<li>for every vector <em>v</em> in [-1, -0.5, 0, 0.5, 1] x [-1, -0.5, 0, 0.5, 1] calculate what would be the cost after shifting the path by this vector</li>\n<li>choose the shift that gives the smallest cost and shift the path by this vector</li>\n<li>repeat the procedure until the cost converges</li>\n</ul>\n<p>The results can be found <a href=\"https://imgur.com/a/K7u8izU\" target=\"_blank\">here</a> and <a href=\"https://imgur.com/a/zdbt0qP\" target=\"_blank\">here</a> (this technique is <strong>different from what other teams have used</strong>, so I recommend to take a look at the result :))</p>\n<p>Finally snap to grid </p>\n<p>I used automatically generated waypoints which were created by the following procedure:</p>\n<ul>\n<li>create a floor mask using shapely</li>\n<li>\"flood\" area around every training waypoint</li>\n<li>in areas that remained unchanged create dense grid<br>\nExample of the resulting mask is <a href=\"https://imgur.com/a/KP43X58\" target=\"_blank\">here</a></li>\n</ul>\n<p>Once again thank you all for the competition. It was my first one. I'll definitely take part in another in the future.</p>",
      "rawMarkdown": "In the beginning I would like to thank @kokitanisaka for unified wifi dataset, @robikscube for snap to grid, @saitodevel01 for cost minimization and @joelqv for MLP and shapely notebooks. They were really helpful!\n\nMy pipeline was as follows (it is simplified, but shows the core ideas of my solution):\n\n1. train floor LSTM. I used predicted floor as an input to the following models\n2. train a stack of BiLSTMs which predicted position with 2 seconds frequency. I used smoothed wifi and beacons RSSI values as well as IMU data. The architecture was: [link](https://imgur.com/9Zqxlex)\n3. train a stack of MLPs using unified wifi dataset\n4. ensemble 2. and 3. \n5. train LSTM which predicted distance covered between 2 waypoints. I used the whole data, from over 100 buildings. It achieved 70 cm accuracy\n6. train delta correction LSTM. Refer to [my previous post](https://www.kaggle.com/c/indoor-location-navigation/discussion/239884)\n7. cost minimize 4., 5. and 6. \n\nAt this point path trajectories looked really promising, they were usually just shifted. So I decided to come up with a method which would shift them into corridors. I defined a cost function which for every predicted coordinate in the path calculated squared distance from the closest waypoint and summed it up (I also used distance from the corridor calculated by BFS. It gave slightly worse score, but didn't require waypoints). The goal was to minimize this cost (which was intended to be local minimum). The iterative algorithm worked as follows:\n- for every vector *v* in [-1, -0.5, 0, 0.5, 1] x [-1, -0.5, 0, 0.5, 1] calculate what would be the cost after shifting the path by this vector\n- choose the shift that gives the smallest cost and shift the path by this vector\n- repeat the procedure until the cost converges\n\nThe results can be found [here](https://imgur.com/a/K7u8izU) and [here] (https://imgur.com/a/zdbt0qP) (this technique is **different from what other teams have used**, so I recommend to take a look at the result :))\n\nFinally snap to grid \n\nI used automatically generated waypoints which were created by the following procedure:\n- create a floor mask using shapely\n- \"flood\" area around every training waypoint\n- in areas that remained unchanged create dense grid\nExample of the resulting mask is [here](https://imgur.com/a/KP43X58)\n\nOnce again thank you all for the competition. It was my first one. I'll definitely take part in another in the future.",
      "votes": null
    },
    {
      "id": "1317857",
      "postDate": "05/21/2021 18:40:13",
      "content": "<p>Hey Olaf I am very happy that my public code contributed to your solution somehow. Congratulations on your great work! Just one position below the gold zone!</p>",
      "rawMarkdown": "Hey Olaf I am very happy that my public code contributed to your solution somehow. Congratulations on your great work! Just one position below the gold zone!",
      "votes": null
    },
    {
      "id": "1318394",
      "postDate": "05/22/2021 09:47:41",
      "content": "<p>Thank you!</p>",
      "rawMarkdown": "Thank you!",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 1317857,
      "author_name": "joelqv",
      "author_url": "",
      "post_date": "05/21/2021 18:40:13",
      "content": "<p>Hey Olaf I am very happy that my public code contributed to your solution somehow. Congratulations on your great work! Just one position below the gold zone!</p>",
      "votes": null,
      "replies": [
        {
          "id": 1318394,
          "author_name": "olaf2000",
          "author_url": "",
          "post_date": "05/22/2021 09:47:41",
          "content": "<p>Thank you!</p>",
          "votes": null,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "1314595": "In the beginning I would like to thank @kokitanisaka for unified wifi dataset, @robikscube for snap to grid, @saitodevel01 for cost minimization and @joelqv for MLP and shapely notebooks. They were really helpful!\n\nMy pipeline was as follows (it is simplified, but shows the core ideas of my solution):\n\n1. train floor LSTM. I used predicted floor as an input to the following models\n2. train a stack of BiLSTMs which predicted position with 2 seconds frequency. I used smoothed wifi and beacons RSSI values as well as IMU data. The architecture was: [link](https://imgur.com/9Zqxlex)\n3. train a stack of MLPs using unified wifi dataset\n4. ensemble 2. and 3. \n5. train LSTM which predicted distance covered between 2 waypoints. I used the whole data, from over 100 buildings. It achieved 70 cm accuracy\n6. train delta correction LSTM. Refer to [my previous post](https://www.kaggle.com/c/indoor-location-navigation/discussion/239884)\n7. cost minimize 4., 5. and 6. \n\nAt this point path trajectories looked really promising, they were usually just shifted. So I decided to come up with a method which would shift them into corridors. I defined a cost function which for every predicted coordinate in the path calculated squared distance from the closest waypoint and summed it up (I also used distance from the corridor calculated by BFS. It gave slightly worse score, but didn't require waypoints). The goal was to minimize this cost (which was intended to be local minimum). The iterative algorithm worked as follows:\n- for every vector *v* in [-1, -0.5, 0, 0.5, 1] x [-1, -0.5, 0, 0.5, 1] calculate what would be the cost after shifting the path by this vector\n- choose the shift that gives the smallest cost and shift the path by this vector\n- repeat the procedure until the cost converges\n\nThe results can be found [here](https://imgur.com/a/K7u8izU) and [here] (https://imgur.com/a/zdbt0qP) (this technique is **different from what other teams have used**, so I recommend to take a look at the result :))\n\nFinally snap to grid \n\nI used automatically generated waypoints which were created by the following procedure:\n- create a floor mask using shapely\n- \"flood\" area around every training waypoint\n- in areas that remained unchanged create dense grid\nExample of the resulting mask is [here](https://imgur.com/a/KP43X58)\n\nOnce again thank you all for the competition. It was my first one. I'll definitely take part in another in the future.",
    "1317857": "Hey Olaf I am very happy that my public code contributed to your solution somehow. Congratulations on your great work! Just one position below the gold zone!",
    "1318394": "Thank you!"
  },
  "source": "meta"
}