{
  "id": 50903,
  "title": "Full submission pipeline based on matterport Mask-RCNN [LB 0.361]",
  "url": "/competitions/data-science-bowl-2018/discussion/50903",
  "author_name": "Nikolay Shebanov",
  "post_date": "2018-03-02T15:37:19.216000",
  "votes": 54,
  "comment_count": 63,
  "views": 0,
  "content": "<p>Hey guys,</p>\n\n<p>This can save you a day or two to start with the competition in case if you struggle to make your first submit. PRs are more than welcome!</p>\n\n<p><a href=\"https://github.com/killthekitten/kaggle-ds-bowl-2018-baseline\">https://github.com/killthekitten/kaggle-ds-bowl-2018-baseline</a></p>",
  "messages": [
    {
      "id": 289913,
      "postDate": "2018-03-02T15:37:19.217Z",
      "content": "<p>Hey guys,</p>\n\n<p>This can save you a day or two to start with the competition in case if you struggle to make your first submit. PRs are more than welcome!</p>\n\n<p><a href=\"https://github.com/killthekitten/kaggle-ds-bowl-2018-baseline\">https://github.com/killthekitten/kaggle-ds-bowl-2018-baseline</a></p>",
      "rawMarkdown": "Hey guys,\n\nThis can save you a day or two to start with the competition in case if you struggle to make your first submit. PRs are more than welcome!\n\nhttps://github.com/killthekitten/kaggle-ds-bowl-2018-baseline",
      "votes": 53
    },
    {
      "id": 308907,
      "postDate": "2018-04-04T10:04:47.130Z",
      "content": "<p>Thanks for sharing @Nikolay Shebanov. </p>\n\n<p>I just took a look at your code and I could not find where you did the train/validation split. I can only see that you passed the stage1_train directory to get both train and validation data.  I assumed you have split them up in another function right? If so where?</p>",
      "rawMarkdown": "Thanks for sharing @Nikolay Shebanov. \n\nI just took a look at your code and I could not find where you did the train/validation split. I can only see that you passed the stage1_train directory to get both train and validation data.  I assumed you have split them up in another function right? If so where?"
    },
    {
      "id": 296196,
      "postDate": "2018-03-14T22:19:28.640Z",
      "content": "<p>I'm looking for a description of the following parameters in config</p>\n\n<p>MASK_POOL_SIZE = 14\nMASK_SHAPE = [28, 28]</p>\n\n<p>Does it make sense to adapt them to our task?</p>",
      "rawMarkdown": "I'm looking for a description of the following parameters in config\n\nMASK_POOL_SIZE = 14\nMASK_SHAPE = [28, 28]\n\nDoes it make sense to adapt them to our task?\n",
      "replies": [
        {
          "id": 297123,
          "postDate": "2018-03-16T10:40:00.090Z",
          "content": "<p>I'm still not sure about the MASK_SHAPE since it's role in the original implementation is kinda similar to MINI_MASK_SHAPE, although it's used only during training. I suppose you will not be able to use pretrained weights if you change this. </p>\n\n<p>As for the MASK_POOL_SIZE, that's <code>The width of the square feature map generated from ROI Pooling.</code>, i.e. the size of the input feature of the masking branch. </p>\n\n<p>It definitely makes sense to tune these. This paper can give you an idea how to approach this:</p>\n\n<p><a href=\"http://ieeexplore.ieee.org/document/8019550/\">http://ieeexplore.ieee.org/document/8019550/</a></p>\n\n<p>But be ready for everything to stop working :)</p>",
          "rawMarkdown": "I'm still not sure about the MASK_SHAPE since it's role in the original implementation is kinda similar to MINI_MASK_SHAPE, although it's used only during training. I suppose you will not be able to use pretrained weights if you change this. \n\nAs for the MASK_POOL_SIZE, that's `The width of the square feature map generated from ROI Pooling.`, i.e. the size of the input feature of the masking branch. \n\nIt definitely makes sense to tune these. This paper can give you an idea how to approach this:\n\nhttp://ieeexplore.ieee.org/document/8019550/\n\nBut be ready for everything to stop working :)"
        }
      ]
    },
    {
      "id": 295620,
      "postDate": "2018-03-13T23:24:58.860Z",
      "content": "<p>When running <code>CUDA_VISIBLE_DEVICES=\"0\" python train.py</code>, I get this error, </p>\n\n<p><code>Traceback (most recent call last):</code></p>\n\n<p>&nbsp; &nbsp; <code>File \"train.py\", line 68, in &lt;module&gt;</code></p>\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; <code>layers=\"all\")</code>\n&nbsp;&nbsp;<code>File \"/content/kaggle-ds-bowl-2018-baseline/model.py\", line 2237, in train</code>\n&nbsp;&nbsp;&nbsp;&nbsp;<code>validation_data=next(</code></p>\n\n<p>&nbsp;&nbsp; <code>File \"/content/kaggle-ds-bowl-2018-baseline/model.py\", line 1736, in data_generator</code></p>\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp;<code>dataset.image_info[image_id]))</code></p>\n\n<p><code>UnboundLocalError: local variable 'image_id' referenced before assignment</code></p>\n\n<p>Do you know why this is happening? Thanks </p>",
      "rawMarkdown": "When running `CUDA_VISIBLE_DEVICES=\"0\" python train.py`, I get this error, \n\n`Traceback (most recent call last):`\n\n&nbsp; &nbsp; `File \"train.py\", line 68, in ",
      "replies": [
        {
          "id": 295624,
          "postDate": "2018-03-13T23:45:09.543Z",
          "content": "<p>Hard to tell, image_id should be on its place at this point.</p>\n\n<ol>\n<li>Have you modified the code?</li>\n<li>Have you downloaded all the data?</li>\n</ol>",
          "rawMarkdown": "Hard to tell, image_id should be on its place at this point.\n\n 1. Have you modified the code?\n 2. Have you downloaded all the data?"
        },
        {
          "id": 295720,
          "postDate": "2018-03-14T04:16:52.253Z",
          "content": "<p>I have not changed the code.\nI think that I have downloaded all the data but I’m not sure where to put it. Can you tell me what folders to put the data I to and what to name the folders ?</p>",
          "rawMarkdown": "I have not changed the code.\nI think that I have downloaded all the data but I’m not sure where to put it. Can you tell me what folders to put the data I to and what to name the folders ?",
          "votes": 1
        },
        {
          "id": 295942,
          "postDate": "2018-03-14T12:57:25.133Z",
          "content": "<p>Check the README carefully, please. <code>stage1_train</code> and <code>stage1_test</code> should be at the root of the project. </p>\n\n<p>If you use the fixed dataset, then check for the <code>stage1_train</code> directory at the root of Lopuhin's repo:\n<a href=\"https://github.com/lopuhin/kaggle-dsbowl-2018-dataset-fixes\">https://github.com/lopuhin/kaggle-dsbowl-2018-dataset-fixes</a></p>",
          "rawMarkdown": "Check the README carefully, please. `stage1_train` and `stage1_test` should be at the root of the project. \n\nIf you use the fixed dataset, then check for the `stage1_train` directory at the root of Lopuhin's repo:\nhttps://github.com/lopuhin/kaggle-dsbowl-2018-dataset-fixes"
        },
        {
          "id": 296336,
          "postDate": "2018-03-15T04:07:25.220Z",
          "content": "<p>Thank you, it worked out.</p>",
          "rawMarkdown": "Thank you, it worked out."
        }
      ]
    },
    {
      "id": 294145,
      "postDate": "2018-03-11T11:58:25.087Z",
      "content": "<p>Hi, thanks for the code. One thing that I didn't understand, though, is why do you need/is advised to use the ResNet model? Do you use the pre-trained weights because of the RPN and mask prediction?\nOne other question is what is the least amount of memory required to run this model? I've got 2GB and I'm getting OOM even with 128x128 images and 1 image per GPU.\nThanks</p>",
      "rawMarkdown": "Hi, thanks for the code. One thing that I didn't understand, though, is why do you need/is advised to use the ResNet model? Do you use the pre-trained weights because of the RPN and mask prediction?\nOne other question is what is the least amount of memory required to run this model? I've got 2GB and I'm getting OOM even with 128x128 images and 1 image per GPU.\nThanks",
      "replies": [
        {
          "id": 294193,
          "postDate": "2018-03-11T14:41:32.563Z",
          "content": "<p>ResNet is a natural choice for the task, especially because the original paper was built using it. Yes, I use pre-trained weights. I'm not sure about the memory, but I run it on 1080ti, which has over 11 gigs of it. </p>\n\n<p>Not sure if it's possible to run on 2 gigs without some weird tricks. You can cut most of the constants in the config file to make it lightweight but there's no sense in using it this way.</p>",
          "rawMarkdown": "ResNet is a natural choice for the task, especially because the original paper was built using it. Yes, I use pre-trained weights. I'm not sure about the memory, but I run it on 1080ti, which has over 11 gigs of it. \n\nNot sure if it's possible to run on 2 gigs without some weird tricks. You can cut most of the constants in the config file to make it lightweight but there's no sense in using it this way.",
          "votes": 2
        },
        {
          "id": 294388,
          "postDate": "2018-03-11T21:40:08.727Z",
          "content": "<p>I may be wrong but in the orignal paper they had a lot of classes to classify and much more data, so I guess it is natural that the model needs to be deeper. However, in our case we are just using 2 classes and have less images.. \nOr are the pre-trained weights mainly useful for the RPN and mask prediction part?</p>",
          "rawMarkdown": "I may be wrong but in the orignal paper they had a lot of classes to classify and much more data, so I guess it is natural that the model needs to be deeper. However, in our case we are just using 2 classes and have less images.. \nOr are the pre-trained weights mainly useful for the RPN and mask prediction part?"
        },
        {
          "id": 295623,
          "postDate": "2018-03-13T23:41:41.210Z",
          "content": "<p>Pre-trained weights are mainly useful to compensate for the lack of training data. It's much harder to train from scratch on the data and it takes more time. </p>\n\n<p>You may be right as for the argument that there could be a better and simpler architecture for the competition, but I had no goal to alter the one from the matterport Mask R-CNN code, I just wanted to make it work. Remember, it's not exactly my code, it's just a fork :)</p>",
          "rawMarkdown": "Pre-trained weights are mainly useful to compensate for the lack of training data. It's much harder to train from scratch on the data and it takes more time. \n\nYou may be right as for the argument that there could be a better and simpler architecture for the competition, but I had no goal to alter the one from the matterport Mask R-CNN code, I just wanted to make it work. Remember, it's not exactly my code, it's just a fork :)",
          "votes": 1
        },
        {
          "id": 295646,
          "postDate": "2018-03-14T01:01:45.150Z",
          "content": "<p>I see, thanks :)\nBtw, I managed to run the ResNet but now I'm getting this error:</p>\n\n<p>&gt; Exception: Invalid bounding box with area of zero</p>\n\n<p>I tried for both the usual Kaggle dataset and the one with the fixes, is there any modification that must be done to the masks before training?</p>\n\n<p>-Edit- I found out the error. I was resizing the images and because of that some masks were disappearing.</p>",
          "rawMarkdown": "I see, thanks :)\nBtw, I managed to run the ResNet but now I'm getting this error:\n\n&gt; Exception: Invalid bounding box with area of zero\n\nI tried for both the usual Kaggle dataset and the one with the fixes, is there any modification that must be done to the masks before training?\n\n-Edit- I found out the error. I was resizing the images and because of that some masks were disappearing.\n"
        }
      ]
    },
    {
      "id": 292949,
      "postDate": "2018-03-08T23:51:45.047Z",
      "content": "<p>Hey everybody. Great start and thank you for the post. Was wondering if somebody could help me with an issue. Running the code gives me the following error when running the training. My platform is a Win 2016 server with 2 GPU's. I have tensorflow 1.5 and Keras 2.0.9. I have verified that all datasets are being built properly with the visualization tools. Kind of stuck. Thanks in advance!!</p>\n\n<p>StopIteration                             Traceback (most recent call last)\n in ()\n      6             learning_rate=config.LEARNING_RATE / 10,\n      7             epochs=2,\n----&gt; 8             layers=\"all\")</p>\n\n<p>~\\model.py in train(self, train_dataset, val_dataset, learning_rate, epochs, layers)\n   2236             max_queue_size=100,\n   2237             workers=workers,\n-&gt; 2238             use_multiprocessing=False,\n   2239         )\n   2240         self.epoch = max(self.epoch, epochs)</p>\n\n<p>C:\\Anaconda\\envs\\py35\\lib\\site-packages\\keras\\legacy\\interfaces.py in wrapper(*args, **kwargs)\n     85                 warnings.warn('Update your <code>' + object_name +\n     86                               '</code> call to the Keras 2 API: ' + signature, stacklevel=2)\n---&gt; 87             return func(*args, **kwargs)\n     88         wrapper._original_function = func\n     89         return wrapper</p>\n\n<p>C:\\Anaconda\\envs\\py35\\lib\\site-packages\\keras\\engine\\training.py in fit_generator(self, generator, steps_per_epoch, epochs, verbose, callbacks, validation_data, validation_steps, class_weight, max_queue_size, workers, use_multiprocessing, shuffle, initial_epoch)\n   2044                 batch_index = 0\n   2045                 while steps_done &lt; steps_per_epoch:\n-&gt; 2046                     generator_output = next(output_generator)\n   2047 \n   2048                     if not hasattr(generator_output, '<strong>len</strong>'):</p>\n\n<p>C:\\Anaconda\\envs\\py35\\lib\\site-packages\\keras\\utils\\data_utils.py in get(self)\n    657                 all_finished = all([not thread.is_alive() for thread in self._threads])\n    658                 if all_finished and self.queue.empty():\n--&gt; 659                     raise StopIteration()\n    660                 else:\n    661                     time.sleep(self.wait_time)</p>\n\n<p>StopIteration: </p>",
      "rawMarkdown": "Hey everybody. Great start and thank you for the post. Was wondering if somebody could help me with an issue. Running the code gives me the following error when running the training. My platform is a Win 2016 server with 2 GPU's. I have tensorflow 1.5 and Keras 2.0.9. I have verified that all datasets are being built properly with the visualization tools. Kind of stuck. Thanks in advance!!\n\nStopIteration                             Traceback (most recent call last)\n",
      "replies": [
        {
          "id": 292981,
          "postDate": "2018-03-09T01:12:50.090Z",
          "content": "<p>Do you mind reformatting the code to make it more readable? For now I can see only that it isn't a full backtrace, there should be something more.</p>",
          "rawMarkdown": "Do you mind reformatting the code to make it more readable? For now I can see only that it isn't a full backtrace, there should be something more."
        },
        {
          "id": 293028,
          "postDate": "2018-03-09T03:29:46.807Z",
          "content": "<p>Hey Nikolay.</p>\n\n<p>Here is the code:</p>\n\n<p>C:\\Anaconda\\envs\\py35\\lib\\site-packages\\scipy\\ndimage\\interpolation.py:600: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n  \"the returned array has changed.\", UserWarning)\nC:\\Anaconda\\envs\\py35\\lib\\site-packages\\tensorflow\\python\\ops\\gradients_impl.py:97: UserWarning: Converting sparse IndexedSlices to a dense Tensor of unknown shape. This may consume a large amount of memory.\n  \"Converting sparse IndexedSlices to a dense Tensor of unknown shape. \"\nEpoch 1/100\nTraceback (most recent call last):</p>\n\n<p>File \"\", line 1, in \n    runfile('C:/kaggle-ds-bowl-2018-baseline-master/train.py', wdir='C:/kaggle-ds-bowl-2018-baseline-master')</p>\n\n<p>File \"C:\\Anaconda\\envs\\py35\\lib\\site-packages\\spyder\\utils\\site\\sitecustomize.py\", line 710, in runfile\n    execfile(filename, namespace)</p>\n\n<p>File \"C:\\Anaconda\\envs\\py35\\lib\\site-packages\\spyder\\utils\\site\\sitecustomize.py\", line 101, in execfile\n    exec(compile(f.read(), filename, 'exec'), namespace)</p>\n\n<p>File \"C:/kaggle-ds-bowl-2018-baseline-master/train.py\", line 78, in \n    layers=\"all\")</p>\n\n<p>File \"C:\\kaggle-ds-bowl-2018-baseline-master\\model.py\", line 2241, in train\n    use_multiprocessing=False,</p>\n\n<p>File \"C:\\Anaconda\\envs\\py35\\lib\\site-packages\\keras\\legacy\\interfaces.py\", line 87, in wrapper\n    return func(*args, **kwargs)</p>\n\n<p>File \"C:\\Anaconda\\envs\\py35\\lib\\site-packages\\keras\\engine\\training.py\", line 2046, in fit_generator\n    generator_output = next(output_generator)</p>\n\n<p>File \"C:\\Anaconda\\envs\\py35\\lib\\site-packages\\keras\\utils\\data_utils.py\", line 659, in get\n    raise StopIteration()</p>\n\n<p>StopIteration</p>",
          "rawMarkdown": "Hey Nikolay.\n\nHere is the code:\n\nC:\\Anaconda\\envs\\py35\\lib\\site-packages\\scipy\\ndimage\\interpolation.py:600: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n  \"the returned array has changed.\", UserWarning)\nC:\\Anaconda\\envs\\py35\\lib\\site-packages\\tensorflow\\python\\ops\\gradients_impl.py:97: UserWarning: Converting sparse IndexedSlices to a dense Tensor of unknown shape. This may consume a large amount of memory.\n  \"Converting sparse IndexedSlices to a dense Tensor of unknown shape. \"\nEpoch 1/100\nTraceback (most recent call last):\n\n  File \""
        },
        {
          "id": 293199,
          "postDate": "2018-03-09T11:36:55.297Z",
          "content": "<p>This might be obvious, but StopIteration means that the training generator is empty.\n<a href=\"https://github.com/keras-team/keras/blob/4b74fc5418944c9f449eb88ed4b40ada280fa5ca/keras/utils/data_utils.py#L784\">https://github.com/keras-team/keras/blob/4b74fc5418944c9f449eb88ed4b40ada280fa5ca/keras/utils/data_utils.py#L784</a></p>\n\n<p>Are you sure you tested the datasets well? Also, have you made any notable changes to my code or you just run it as is?</p>",
          "rawMarkdown": "This might be obvious, but StopIteration means that the training generator is empty.\nhttps://github.com/keras-team/keras/blob/4b74fc5418944c9f449eb88ed4b40ada280fa5ca/keras/utils/data_utils.py#L784\n\nAre you sure you tested the datasets well? Also, have you made any notable changes to my code or you just run it as is?"
        },
        {
          "id": 293260,
          "postDate": "2018-03-09T14:42:21.497Z",
          "content": "<p>No I appreciate the info :). Yes I agree the training generator is dropping data. But i have used the verification and visualization code to check the and I can see training data in the data dataset_training, it shows masks on that data and it returns shapes of the data. Which is why I am very confused why it's dropping. I thought it might be an issue between Linux and Windows but I tested code to change the worker roles and multithreaded processing to false and that had no effect.</p>",
          "rawMarkdown": "No I appreciate the info :). Yes I agree the training generator is dropping data. But i have used the verification and visualization code to check the and I can see training data in the data dataset_training, it shows masks on that data and it returns shapes of the data. Which is why I am very confused why it's dropping. I thought it might be an issue between Linux and Windows but I tested code to change the worker roles and multithreaded processing to false and that had no effect."
        },
        {
          "id": 293267,
          "postDate": "2018-03-09T14:53:42.707Z",
          "content": "<p>Try to drop a <code>import pdb; pdb.set_trace()</code> on this line and debug if the data gets loaded properly <a href=\"https://github.com/killthekitten/kaggle-ds-bowl-2018-baseline/blob/master/model.py#L1639\">https://github.com/killthekitten/kaggle-ds-bowl-2018-baseline/blob/master/model.py#L1639</a></p>\n\n<p>It feels like some windows black magic is going on here.</p>",
          "rawMarkdown": "Try to drop a `import pdb; pdb.set_trace()` on this line and debug if the data gets loaded properly https://github.com/killthekitten/kaggle-ds-bowl-2018-baseline/blob/master/model.py#L1639\n\nIt feels like some windows black magic is going on here."
        },
        {
          "id": 293268,
          "postDate": "2018-03-09T14:56:55.590Z",
          "content": "<p>Ill give it a shot! Thank you sir!</p>",
          "rawMarkdown": "Ill give it a shot! Thank you sir!"
        },
        {
          "id": 293295,
          "postDate": "2018-03-09T15:43:06.820Z",
          "content": "<p>Still hunting. It looks like the dataset is getting images and masks. I am wondering if it's something in the batch. Dataset, batches, image returns, classes are all showing data. Bizzaro...</p>",
          "rawMarkdown": "Still hunting. It looks like the dataset is getting images and masks. I am wondering if it's something in the batch. Dataset, batches, image returns, classes are all showing data. Bizzaro...\n"
        },
        {
          "id": 293360,
          "postDate": "2018-03-09T17:47:46.520Z",
          "content": "<p>Might have a theory, since there is so much processing going on, I had noticed that I set my config to: GPU 2 / IMAGES_PER_GPU = 4. This value is setting the batch size. I wonder if it was too low and therefore the queue was empty before preprocessing another batch occurred.</p>",
          "rawMarkdown": "Might have a theory, since there is so much processing going on, I had noticed that I set my config to: GPU 2 / IMAGES_PER_GPU = 4. This value is setting the batch size. I wonder if it was too low and therefore the queue was empty before preprocessing another batch occurred."
        },
        {
          "id": 293375,
          "postDate": "2018-03-09T18:39:44.677Z",
          "content": "<p>Shouldn't be an issue. Anyway, I've found it slower to use multiple GPUs, at least with the current dataset setup (reading multiple files).</p>",
          "rawMarkdown": "Shouldn't be an issue. Anyway, I've found it slower to use multiple GPUs, at least with the current dataset setup (reading multiple files)."
        },
        {
          "id": 293415,
          "postDate": "2018-03-09T19:40:22.943Z",
          "content": "<p>So I went back to basics. Verified that the only change to the original code was to mod the regex to allow // on the path. Aside from that it is a straight run with. The only thing i am doing is running from spyder and not a command prompt. Out of curiosity, are you running 3.5 or 2.7 for your version?</p>",
          "rawMarkdown": "So I went back to basics. Verified that the only change to the original code was to mod the regex to allow // on the path. Aside from that it is a straight run with. The only thing i am doing is running from spyder and not a command prompt. Out of curiosity, are you running 3.5 or 2.7 for your version?"
        },
        {
          "id": 293427,
          "postDate": "2018-03-09T20:08:58.773Z",
          "content": "<p>I'm on 3.6.4 to be exact :) Is that the regex from the comment somewhere above on this page?</p>",
          "rawMarkdown": "I'm on 3.6.4 to be exact :) Is that the regex from the comment somewhere above on this page?"
        },
        {
          "id": 293428,
          "postDate": "2018-03-09T20:10:32.407Z",
          "content": "<p>Yes. I saw something about pycotools not being verified on anything past 2.7. I have verified that the queue is empty on reaching that point. It has memory allocation but nothing inside. Very strange </p>",
          "rawMarkdown": "Yes. I saw something about pycotools not being verified on anything past 2.7. I have verified that the queue is empty on reaching that point. It has memory allocation but nothing inside. Very strange "
        },
        {
          "id": 293431,
          "postDate": "2018-03-09T20:13:06.710Z",
          "content": "<p>Oh wait, I run Keras 2.1.3 / tensorflow 1.4.1, try to update yours</p>",
          "rawMarkdown": "Oh wait, I run Keras 2.1.3 / tensorflow 1.4.1, try to update yours"
        },
        {
          "id": 293433,
          "postDate": "2018-03-09T20:20:52.080Z",
          "content": "<p>Ok even the demo run fails in the same spot. Something's up :)</p>",
          "rawMarkdown": "Ok even the demo run fails in the same spot. Something's up :)"
        },
        {
          "id": 294190,
          "postDate": "2018-03-11T14:37:36.047Z",
          "content": "<p>I was getting the StopIteration raised as well, I fixed by updating both Tensorflow and Keras</p>",
          "rawMarkdown": "I was getting the StopIteration raised as well, I fixed by updating both Tensorflow and Keras",
          "votes": 2
        },
        {
          "id": 294312,
          "postDate": "2018-03-11T18:06:07.407Z",
          "content": "<p>What versions of Keras and Tensorflow are you running now?</p>",
          "rawMarkdown": "What versions of Keras and Tensorflow are you running now?"
        },
        {
          "id": 294387,
          "postDate": "2018-03-11T21:34:53.913Z",
          "content": "<pre><code>tf.__version__ : '1.4.1'\nkeras.__version__ : '2.1.4'\n</code></pre>",
          "rawMarkdown": "    tf.__version__ : '1.4.1'\n    keras.__version__ : '2.1.4'"
        },
        {
          "id": 294795,
          "postDate": "2018-03-12T16:43:16.437Z",
          "content": "<p>Hey everybody thanks for the help on this. It was indeed the Keras version needed to be updated as well as Tensorflow. But a word to my colleagues out there, if you are using Windows. If you update Tensorflow make sure you force install the gpu version as it will upgrade Tensorflow to 1.5 but it will wipe out the GPU version. So you have to force pip install into your conda environment no less than 1.3 or it will fail the version check. Training now! </p>",
          "rawMarkdown": "Hey everybody thanks for the help on this. It was indeed the Keras version needed to be updated as well as Tensorflow. But a word to my colleagues out there, if you are using Windows. If you update Tensorflow make sure you force install the gpu version as it will upgrade Tensorflow to 1.5 but it will wipe out the GPU version. So you have to force pip install into your conda environment no less than 1.3 or it will fail the version check. Training now! ",
          "votes": 1
        },
        {
          "id": 294809,
          "postDate": "2018-03-12T16:57:55.637Z",
          "content": "<p>Glad to hear that. I hope it was worth the troubles!</p>",
          "rawMarkdown": "Glad to hear that. I hope it was worth the troubles!"
        }
      ]
    },
    {
      "id": 291395,
      "postDate": "2018-03-06T03:28:42.427Z",
      "content": "<p>Anyone tried the script under windows 10. Seems the path parsing under windows is different from linux (Solved)</p>",
      "rawMarkdown": "Anyone tried the script under windows 10. Seems the path parsing under windows is different from linux (Solved)",
      "replies": [
        {
          "id": 291449,
          "postDate": "2018-03-06T06:41:12.717Z",
          "content": "<p>yes. add <strong>.replace(\"\\\\\", \"/\")</strong> after <strong>mask_path</strong> in bowl_dataset.py</p>",
          "rawMarkdown": "yes. add **.replace(\"\\\\\\\", \"/\")** after **mask_path** in bowl_dataset.py",
          "votes": 2
        },
        {
          "id": 291543,
          "postDate": "2018-03-06T10:24:37.483Z",
          "content": "<p>Sorry guys, I tried to make it portable, but didn't actually test it. I'd appreciate if someone will send a PR to fix the regex here <a href=\"https://github.com/killthekitten/kaggle-ds-bowl-2018-baseline/blob/master/bowl_dataset.py#L19\">https://github.com/killthekitten/kaggle-ds-bowl-2018-baseline/blob/master/bowl_dataset.py#L19</a></p>",
          "rawMarkdown": "Sorry guys, I tried to make it portable, but didn't actually test it. I'd appreciate if someone will send a PR to fix the regex here https://github.com/killthekitten/kaggle-ds-bowl-2018-baseline/blob/master/bowl_dataset.py#L19"
        },
        {
          "id": 291571,
          "postDate": "2018-03-06T11:56:46.677Z",
          "content": "<p>Thx Wei Lu and Nikolay Shebanov</p>\n\n<p>Now it works with the following fix in bowl_dataset.py </p>\n\n<p><code>for mask_path in glob(os.path.join(base_path, \"**\", \"masks\", \"*.png\")):</code></p>\n\n<pre><code>   `mask_path = mask_path.replace(\"\\\\\", \"/\") `\n   `matches = id_extractor.match(mask_path)`\n</code></pre>\n\n<p>Cheers</p>",
          "rawMarkdown": "Thx Wei Lu and Nikolay Shebanov\n\nNow it works with the following fix in bowl_dataset.py \n\n`for mask_path in glob(os.path.join(base_path, \"**\", \"masks\", \"*.png\")):`\n\n       `mask_path = mask_path.replace(\"\\\\\", \"/\") `\n       `matches = id_extractor.match(mask_path)`\n\nCheers"
        },
        {
          "id": 291589,
          "postDate": "2018-03-06T12:27:07.977Z",
          "content": "<p>There's a couple of mistakes in your code, try this instead:</p>\n\n<pre><code>mask_path = mask_path.replace(\"\\\\\", \"/\")\n</code></pre>",
          "rawMarkdown": "There's a couple of mistakes in your code, try this instead:\n\n    mask_path = mask_path.replace(\"\\\\\", \"/\")",
          "votes": 1
        },
        {
          "id": 299295,
          "postDate": "2018-03-20T19:01:59.320Z",
          "content": "<p>Hi Nikolay, I am a windows 10 user, I am getting an error on line 20 in bowl_dataset.py:</p>\n\n<p>id_extractor = re.compile(f\"{base_path}{os.sep}(?P.){os.sep}masks{os.sep}(?P.*).png\") that says \"sre_constants.error: unbalanced parenthesis at position 30\".</p>\n\n<p>The mask_path line occurs below this line, so the above fixes do not help. Any idea what could be causing this? Would appreciate any help!</p>",
          "rawMarkdown": "Hi Nikolay, I am a windows 10 user, I am getting an error on line 20 in bowl_dataset.py:\n\nid_extractor = re.compile(f\"{base_path}{os.sep}(?P.){os.sep}masks{os.sep}(?P"
        },
        {
          "id": 299417,
          "postDate": "2018-03-20T21:10:31.157Z",
          "content": "<p>What line do you pass as a <code>base_path</code>? i.e. what goes as an argument to <code>load_bowl()</code>? </p>\n\n<p>If you could drop an <code>import pdb; pdb.set_trace()</code> directly before this line and then check what's the value of <code>f\"{base_path}{os.sep}(?P.){os.sep}masks{os.sep}(?P.*).png\"</code> then it would be easier to understand the problem.</p>",
          "rawMarkdown": "What line do you pass as a `base_path`? i.e. what goes as an argument to `load_bowl()`? \n\nIf you could drop an `import pdb; pdb.set_trace()` directly before this line and then check what's the value of `f\"{base_path}{os.sep}(?P.){os.sep}masks{os.sep}(?P.*).png\"` then it would be easier to understand the problem."
        },
        {
          "id": 300086,
          "postDate": "2018-03-21T09:07:49.983Z",
          "content": "<p>This is what I get:</p>\n\n<pre><code>ipdb&gt; print(f\"{base_path}\\{os.sep}(?P&lt;image_id&gt;.*)\\{os.sep}masks\\{os.sep}(?P&lt;mask_id&gt;.*)\\.png\")\n</code></pre>\n\n<p><code>stage1_train\\{\\(?P&lt;image_id&gt;.*)\\{\\masks\\{\\(?P&lt;mask_id&gt;.*)\\.png</code> </p>\n\n<p>There is a bracket mismatch definitely. I am fairly new to Python and I did try correcting this but no luck! Any ideas on what is going wrong?</p>",
          "rawMarkdown": "This is what I get:\n\n    ipdb&gt; print(f\"{base_path}\\{os.sep}(?P"
        },
        {
          "id": 301035,
          "postDate": "2018-03-22T07:38:26.090Z",
          "content": "<p>Which version of Python are you on?</p>",
          "rawMarkdown": "Which version of Python are you on?"
        },
        {
          "id": 301038,
          "postDate": "2018-03-22T07:42:50.403Z",
          "content": "<p>Python 3.6.1</p>",
          "rawMarkdown": "Python 3.6.1"
        }
      ]
    },
    {
      "id": 290858,
      "postDate": "2018-03-05T03:45:32.677Z",
      "content": "<p>Thank you for sharing!</p>\n\n<p>When I running your code in model training,  I encounter one error : \nTraceback (most recent call last):\n  File \"train.py\", line 63, in \n    layers='heads')\n  File \"/home/hkueee/kaggle/DataScienceBowl/dsbowl/model.py\", line 2237, in train\n    validation_data=next(val_generator),\n  File \"/home/hkueee/kaggle/DataScienceBowl/dsbowl/model.py\", line 1736, in data_generator\n    dataset.image_info[image_id]))\nUnboundLocalError: local variable 'image_id' referenced before assignment</p>\n\n<p>Do you know how to fix that? Thanks!</p>",
      "rawMarkdown": "Thank you for sharing!\n\nWhen I running your code in model training,  I encounter one error : \nTraceback (most recent call last):\n  File \"train.py\", line 63, in ",
      "replies": [
        {
          "id": 290920,
          "postDate": "2018-03-05T07:18:24.523Z",
          "content": "<p>Fixed. Need to specify the path of data first. </p>",
          "rawMarkdown": "Fixed. Need to specify the path of data first. ",
          "votes": 1
        },
        {
          "id": 372571,
          "postDate": "2018-08-19T18:32:52.597Z",
          "rawMarkdown": "",
          "isDeleted": true
        },
        {
          "id": 372594,
          "postDate": "2018-08-19T20:19:08.023Z",
          "content": "<p>Hey Kate, did you experience the same error? I think it's easy to fix by providing relative paths to data as an argument to the load_bowl function. Let me know if that's worked.</p>",
          "rawMarkdown": "Hey Kate, did you experience the same error? I think it's easy to fix by providing relative paths to data as an argument to the load_bowl function. Let me know if that's worked."
        },
        {
          "id": 372620,
          "postDate": "2018-08-19T22:12:28.327Z",
          "rawMarkdown": "",
          "isDeleted": true
        }
      ]
    },
    {
      "id": 290650,
      "postDate": "2018-03-04T16:33:25.020Z",
      "content": "<p>What graphics card do you use? I'm trying to start train on NVidia 1070 (8 GB), but I got a out of memory error on start like this:</p>\n\n<pre><code>ResourceExhaustedError (see above for traceback): OOM when allocating tensor with shape[1200,256,14,14]\n     [[Node: training/SGD/gradients/mrcnn_mask_deconv/conv2d_transpose_grad/Conv2D = Conv2D[T=DT_FLOAT, _class=[\"loc:@mrcnn_mask_deconv/conv2d_transpose\"], data_format=\"NHWC\", padding=\"VALID\", strides=[1, 2, 2, 1], use_cudnn_on_gpu=true, _device=\"/job:localhost/replica:0/task:0/device:GPU:0\"](training/SGD/gradients/mrcnn_mask_deconv/Relu_grad/ReluGrad, mrcnn_mask_deconv/kernel/read)]]\n     [[Node: training/SGD/gradients/mrcnn_mask_conv1/convolution_grad/Conv2DBackpropInput/_2931 = _Recv[client_terminated=false, recv_device=\"/job:localhost/replica:0/task:0/device:CPU:0\", send_device=\"/job:localhost/replica:0/task:0/device:GPU:0\", send_device_incarnation=1, tensor_name=\"edge_7871_training/SGD/gradients/mrcnn_mask_conv1/convolution_grad/Conv2DBackpropInput\", tensor_type=DT_FLOAT, _device=\"/job:localhost/replica:0/task:0/device:CPU:0\"]()]]\n</code></pre>",
      "rawMarkdown": "What graphics card do you use? I'm trying to start train on NVidia 1070 (8 GB), but I got a out of memory error on start like this:\n\n    ResourceExhaustedError (see above for traceback): OOM when allocating tensor with shape[1200,256,14,14]\n    \t [[Node: training/SGD/gradients/mrcnn_mask_deconv/conv2d_transpose_grad/Conv2D = Conv2D[T=DT_FLOAT, _class=[\"loc:@mrcnn_mask_deconv/conv2d_transpose\"], data_format=\"NHWC\", padding=\"VALID\", strides=[1, 2, 2, 1], use_cudnn_on_gpu=true, _device=\"/job:localhost/replica:0/task:0/device:GPU:0\"](training/SGD/gradients/mrcnn_mask_deconv/Relu_grad/ReluGrad, mrcnn_mask_deconv/kernel/read)]]\n    \t [[Node: training/SGD/gradients/mrcnn_mask_conv1/convolution_grad/Conv2DBackpropInput/_2931 = _Recv[client_terminated=false, recv_device=\"/job:localhost/replica:0/task:0/device:CPU:0\", send_device=\"/job:localhost/replica:0/task:0/device:GPU:0\", send_device_incarnation=1, tensor_name=\"edge_7871_training/SGD/gradients/mrcnn_mask_conv1/convolution_grad/Conv2DBackpropInput\", tensor_type=DT_FLOAT, _device=\"/job:localhost/replica:0/task:0/device:CPU:0\"]()]]\n",
      "replies": [
        {
          "id": 290657,
          "postDate": "2018-03-04T17:01:42.240Z",
          "content": "<p>A couple of 1080TIs actually, so that's more memory than you have. Try to change this variable to 1 locally: <a href=\"https://github.com/killthekitten/kaggle-ds-bowl-2018-baseline/blob/master/bowl_config.py#L14\">https://github.com/killthekitten/kaggle-ds-bowl-2018-baseline/blob/master/bowl_config.py#L14</a></p>\n\n<p>Tell me if it helps.</p>",
          "rawMarkdown": "A couple of 1080TIs actually, so that's more memory than you have. Try to change this variable to 1 locally: https://github.com/killthekitten/kaggle-ds-bowl-2018-baseline/blob/master/bowl_config.py#L14\n\nTell me if it helps.",
          "votes": 2
        },
        {
          "id": 290707,
          "postDate": "2018-03-04T18:01:32.783Z",
          "content": "<p>Yes, it works with \"IMAGES_PER_GPU = 1\". Thank you.</p>",
          "rawMarkdown": "Yes, it works with \"IMAGES_PER_GPU = 1\". Thank you."
        },
        {
          "id": 291447,
          "postDate": "2018-03-06T06:38:11.680Z",
          "content": "<p>Hello Roman, would you mind telling us how you reach 49th place? Did you use this mask-rcnn method? Thanks.</p>",
          "rawMarkdown": "Hello Roman, would you mind telling us how you reach 49th place? Did you use this mask-rcnn method? Thanks."
        },
        {
          "id": 291597,
          "postDate": "2018-03-06T12:37:04.953Z",
          "content": "<p>No, I'm using UNet-based CNN with additional post-processing.</p>",
          "rawMarkdown": "No, I'm using UNet-based CNN with additional post-processing."
        },
        {
          "id": 291692,
          "postDate": "2018-03-06T17:16:42.933Z",
          "content": "<p>I see. Thanks</p>",
          "rawMarkdown": "I see. Thanks"
        }
      ]
    },
    {
      "id": 290505,
      "postDate": "2018-03-04T10:11:26.223Z",
      "content": "<p>Hi Nikolay, thanks for the code and the steps. </p>\n\n<p>I am running your code on Google cloud with Tesla K80 GPU but it took over 5 hours to complete 1 epoch (total 100 epochs). It is taking approximately 30 seconds for each image to run (total 664 images). After going through the forums, I think that cudnn might not be installed properly. \nCan you please guide me in the proper direction so that I do not waste a lot of time on setup.</p>\n\n<p>I am new with GPUs and your help is greatly appreciated.</p>",
      "rawMarkdown": "Hi Nikolay, thanks for the code and the steps. \n\nI am running your code on Google cloud with Tesla K80 GPU but it took over 5 hours to complete 1 epoch (total 100 epochs). It is taking approximately 30 seconds for each image to run (total 664 images). After going through the forums, I think that cudnn might not be installed properly. \nCan you please guide me in the proper direction so that I do not waste a lot of time on setup.\n\nI am new with GPUs and your help is greatly appreciated.",
      "replies": [
        {
          "id": 290550,
          "postDate": "2018-03-04T12:06:37.507Z",
          "content": "<p>Easy first step would be to follow one of the tutorials specific to Google Cloud setup.</p>\n\n<p>I think this should work: <a href=\"https://github.com/eshvk/gcp-dl\">https://github.com/eshvk/gcp-dl</a></p>",
          "rawMarkdown": "Easy first step would be to follow one of the tutorials specific to Google Cloud setup.\n\nI think this should work: https://github.com/eshvk/gcp-dl"
        },
        {
          "id": 290590,
          "postDate": "2018-03-04T13:55:02.347Z",
          "content": "<p>Hi Abhishek \n the issue is using too much I/O operation when loading：\ndef load_image(self, image_id):\n        info = self.image_info[image_id]\n        return cv2.imread(info[\"path\"])</p>",
          "rawMarkdown": "Hi Abhishek \n the issue is using too much I/O operation when loading：\ndef load_image(self, image_id):\n        info = self.image_info[image_id]\n        return cv2.imread(info[\"path\"])\n"
        }
      ]
    },
    {
      "id": 290500,
      "postDate": "2018-03-04T10:00:46.803Z",
      "content": "<p>Hi Nikolay! Thanks for sharing the code. \nIn train.py I see:\nmodel.train(dataset_train, dataset_val, \n            learning_rate=bowl_config.LEARNING_RATE, \n            epochs=1, \n            layers='heads')</p>\n\n<p>model.train(dataset_train, dataset_val, \n            learning_rate=bowl_config.LEARNING_RATE / 10,\n            epochs=100, \n            layers=\"all\")</p>\n\n<p>I think we can just run the second model.train (with layers==all) and skip the first one right ? \nOr is there a reason to run it this way ? \nThanks\nMehul</p>",
      "rawMarkdown": "Hi Nikolay! Thanks for sharing the code. \nIn train.py I see:\nmodel.train(dataset_train, dataset_val, \n            learning_rate=bowl_config.LEARNING_RATE, \n            epochs=1, \n            layers='heads')\n\nmodel.train(dataset_train, dataset_val, \n            learning_rate=bowl_config.LEARNING_RATE / 10,\n            epochs=100, \n            layers=\"all\")\n\nI think we can just run the second model.train (with layers==all) and skip the first one right ? \nOr is there a reason to run it this way ? \nThanks\nMehul",
      "replies": [
        {
          "id": 290544,
          "postDate": "2018-03-04T11:49:35.293Z",
          "content": "<p>I copied that from the original repo. You can run it with \"all\" right from the start.</p>\n\n<p>However, the paper says that:</p>\n\n<blockquote>\n  <p>To  unify  RPNs  with  Fast  R-CNN  [2]  object  detec-\n  tion  networks,  we  propose  a  training  scheme  that\n  alternates between fine-tuning for the region proposal\n  task  and  then  fine-tuning  for  object  detection,  while\n  keeping  the  proposals  fixed.  This  scheme  converges\n  quickly and produces a unified network with convo-\n  lutional features that are shared between both tasks.</p>\n</blockquote>\n\n<p>Not sure yet how to train like that using the matterport framework.</p>",
          "rawMarkdown": "I copied that from the original repo. You can run it with \"all\" right from the start.\n\nHowever, the paper says that:\n\n&gt; To  unify  RPNs  with  Fast  R-CNN  [2]  object  detec-\ntion  networks,  we  propose  a  training  scheme  that\nalternates between fine-tuning for the region proposal\ntask  and  then  fine-tuning  for  object  detection,  while\nkeeping  the  proposals  fixed.  This  scheme  converges\nquickly and produces a unified network with convo-\nlutional features that are shared between both tasks.\n\nNot sure yet how to train like that using the matterport framework."
        }
      ]
    },
    {
      "id": 290464,
      "postDate": "2018-03-04T06:32:09.190Z",
      "content": "<p>Hi Nikolay, thank you for sharing your code.  </p>\n\n<p>Can you also share the versions of python packages used (including tensorflow and scipy)?  I am seeing rpn_bbox_loss: nan after some point during training.  Since I was running the code as is without changes, I am guessing I may have a version which causes issue but I am not sure.</p>",
      "rawMarkdown": "Hi Nikolay, thank you for sharing your code.  \n\nCan you also share the versions of python packages used (including tensorflow and scipy)?  I am seeing rpn_bbox_loss: nan after some point during training.  Since I was running the code as is without changes, I am guessing I may have a version which causes issue but I am not sure.\n\n",
      "replies": [
        {
          "id": 290547,
          "postDate": "2018-03-04T11:54:24.087Z",
          "content": "<p>Here you go:</p>\n\n<pre><code>Cython==0.27.3\nnumpy==1.14.0\nopencv-python==3.4.0.12\npycocotools==2.0\nscikit-image==0.13.1\nscikit-learn==0.19.1\nscipy==1.0.0\ntensorflow-gpu==1.4.1\ntensorflow-tensorboard==0.4.0\n</code></pre>\n\n<p>I've heard of the same issue from <a href=\"https://www.kaggle.com/maksimovka\">Konstantin Maksimov</a>. He's using his own fork, so let's ask him how he fixed that.</p>",
          "rawMarkdown": "Here you go:\n\n    Cython==0.27.3\n    numpy==1.14.0\n    opencv-python==3.4.0.12\n    pycocotools==2.0\n    scikit-image==0.13.1\n    scikit-learn==0.19.1\n    scipy==1.0.0\n    tensorflow-gpu==1.4.1\n    tensorflow-tensorboard==0.4.0\n\nI've heard of the same issue from [Konstantin Maksimov][1]. He's using his own fork, so let's ask him how he fixed that.\n\n\n  [1]: https://www.kaggle.com/maksimovka",
          "votes": 2
        },
        {
          "id": 290562,
          "postDate": "2018-03-04T12:41:58.927Z",
          "content": "<p><a href=\"https://www.kaggle.com/c/data-science-bowl-2018/discussion/49805#289277\">https://www.kaggle.com/c/data-science-bowl-2018/discussion/49805#289277</a></p>",
          "rawMarkdown": "https://www.kaggle.com/c/data-science-bowl-2018/discussion/49805#289277",
          "votes": 2
        },
        {
          "id": 290884,
          "postDate": "2018-03-05T05:12:34.903Z",
          "content": "<p>Makes sense.  Thanks for the help!</p>",
          "rawMarkdown": "Makes sense.  Thanks for the help!"
        }
      ]
    }
  ],
  "comments": [
    {
      "id": 308907,
      "author_name": "YaGana Sheriff-Hussaini",
      "author_url": "",
      "post_date": "2018-04-04T10:04:47.130000",
      "content": "<p>Thanks for sharing @Nikolay Shebanov. </p>\n\n<p>I just took a look at your code and I could not find where you did the train/validation split. I can only see that you passed the stage1_train directory to get both train and validation data.  I assumed you have split them up in another function right? If so where?</p>",
      "votes": 0,
      "replies": []
    },
    {
      "id": 296196,
      "author_name": "tichy ijon",
      "author_url": "",
      "post_date": "2018-03-14T22:19:28.640000",
      "content": "<p>I'm looking for a description of the following parameters in config</p>\n\n<p>MASK_POOL_SIZE = 14\nMASK_SHAPE = [28, 28]</p>\n\n<p>Does it make sense to adapt them to our task?</p>",
      "votes": 0,
      "replies": [
        {
          "id": 297123,
          "author_name": "Nikolay Shebanov",
          "author_url": "",
          "post_date": "2018-03-16T10:40:00.090000",
          "content": "<p>I'm still not sure about the MASK_SHAPE since it's role in the original implementation is kinda similar to MINI_MASK_SHAPE, although it's used only during training. I suppose you will not be able to use pretrained weights if you change this. </p>\n\n<p>As for the MASK_POOL_SIZE, that's <code>The width of the square feature map generated from ROI Pooling.</code>, i.e. the size of the input feature of the masking branch. </p>\n\n<p>It definitely makes sense to tune these. This paper can give you an idea how to approach this:</p>\n\n<p><a href=\"http://ieeexplore.ieee.org/document/8019550/\">http://ieeexplore.ieee.org/document/8019550/</a></p>\n\n<p>But be ready for everything to stop working :)</p>",
          "votes": 0,
          "replies": []
        }
      ]
    },
    {
      "id": 295620,
      "author_name": "bilal2vec",
      "author_url": "",
      "post_date": "2018-03-13T23:24:58.860000",
      "content": "<p>When running <code>CUDA_VISIBLE_DEVICES=\"0\" python train.py</code>, I get this error, </p>\n\n<p><code>Traceback (most recent call last):</code></p>\n\n<p>&nbsp; &nbsp; <code>File \"train.py\", line 68, in &lt;module&gt;</code></p>\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; <code>layers=\"all\")</code>\n&nbsp;&nbsp;<code>File \"/content/kaggle-ds-bowl-2018-baseline/model.py\", line 2237, in train</code>\n&nbsp;&nbsp;&nbsp;&nbsp;<code>validation_data=next(</code></p>\n\n<p>&nbsp;&nbsp; <code>File \"/content/kaggle-ds-bowl-2018-baseline/model.py\", line 1736, in data_generator</code></p>\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp;<code>dataset.image_info[image_id]))</code></p>\n\n<p><code>UnboundLocalError: local variable 'image_id' referenced before assignment</code></p>\n\n<p>Do you know why this is happening? Thanks </p>",
      "votes": 0,
      "replies": [
        {
          "id": 295624,
          "author_name": "Nikolay Shebanov",
          "author_url": "",
          "post_date": "2018-03-13T23:45:09.543000",
          "content": "<p>Hard to tell, image_id should be on its place at this point.</p>\n\n<ol>\n<li>Have you modified the code?</li>\n<li>Have you downloaded all the data?</li>\n</ol>",
          "votes": 0,
          "replies": []
        },
        {
          "id": 295720,
          "author_name": "bilal2vec",
          "author_url": "",
          "post_date": "2018-03-14T04:16:52.253000",
          "content": "<p>I have not changed the code.\nI think that I have downloaded all the data but I’m not sure where to put it. Can you tell me what folders to put the data I to and what to name the folders ?</p>",
          "votes": 1,
          "replies": []
        },
        {
          "id": 295942,
          "author_name": "Nikolay Shebanov",
          "author_url": "",
          "post_date": "2018-03-14T12:57:25.133000",
          "content": "<p>Check the README carefully, please. <code>stage1_train</code> and <code>stage1_test</code> should be at the root of the project. </p>\n\n<p>If you use the fixed dataset, then check for the <code>stage1_train</code> directory at the root of Lopuhin's repo:\n<a href=\"https://github.com/lopuhin/kaggle-dsbowl-2018-dataset-fixes\">https://github.com/lopuhin/kaggle-dsbowl-2018-dataset-fixes</a></p>",
          "votes": 0,
          "replies": []
        },
        {
          "id": 296336,
          "author_name": "bilal2vec",
          "author_url": "",
          "post_date": "2018-03-15T04:07:25.220000",
          "content": "<p>Thank you, it worked out.</p>",
          "votes": 0,
          "replies": []
        }
      ]
    },
    {
      "id": 294145,
      "author_name": "Eduardo Rocha de Andrade",
      "author_url": "",
      "post_date": "2018-03-11T11:58:25.087000",
      "content": "<p>Hi, thanks for the code. One thing that I didn't understand, though, is why do you need/is advised to use the ResNet model? Do you use the pre-trained weights because of the RPN and mask prediction?\nOne other question is what is the least amount of memory required to run this model? I've got 2GB and I'm getting OOM even with 128x128 images and 1 image per GPU.\nThanks</p>",
      "votes": 0,
      "replies": [
        {
          "id": 294193,
          "author_name": "Nikolay Shebanov",
          "author_url": "",
          "post_date": "2018-03-11T14:41:32.563000",
          "content": "<p>ResNet is a natural choice for the task, especially because the original paper was built using it. Yes, I use pre-trained weights. I'm not sure about the memory, but I run it on 1080ti, which has over 11 gigs of it. </p>\n\n<p>Not sure if it's possible to run on 2 gigs without some weird tricks. You can cut most of the constants in the config file to make it lightweight but there's no sense in using it this way.</p>",
          "votes": 2,
          "replies": []
        },
        {
          "id": 294388,
          "author_name": "Eduardo Rocha de Andrade",
          "author_url": "",
          "post_date": "2018-03-11T21:40:08.727000",
          "content": "<p>I may be wrong but in the orignal paper they had a lot of classes to classify and much more data, so I guess it is natural that the model needs to be deeper. However, in our case we are just using 2 classes and have less images.. \nOr are the pre-trained weights mainly useful for the RPN and mask prediction part?</p>",
          "votes": 0,
          "replies": []
        },
        {
          "id": 295623,
          "author_name": "Nikolay Shebanov",
          "author_url": "",
          "post_date": "2018-03-13T23:41:41.210000",
          "content": "<p>Pre-trained weights are mainly useful to compensate for the lack of training data. It's much harder to train from scratch on the data and it takes more time. </p>\n\n<p>You may be right as for the argument that there could be a better and simpler architecture for the competition, but I had no goal to alter the one from the matterport Mask R-CNN code, I just wanted to make it work. Remember, it's not exactly my code, it's just a fork :)</p>",
          "votes": 1,
          "replies": []
        },
        {
          "id": 295646,
          "author_name": "Eduardo Rocha de Andrade",
          "author_url": "",
          "post_date": "2018-03-14T01:01:45.150000",
          "content": "<p>I see, thanks :)\nBtw, I managed to run the ResNet but now I'm getting this error:</p>\n\n<p>&gt; Exception: Invalid bounding box with area of zero</p>\n\n<p>I tried for both the usual Kaggle dataset and the one with the fixes, is there any modification that must be done to the masks before training?</p>\n\n<p>-Edit- I found out the error. I was resizing the images and because of that some masks were disappearing.</p>",
          "votes": 0,
          "replies": []
        }
      ]
    },
    {
      "id": 292949,
      "author_name": "maddocmatt",
      "author_url": "",
      "post_date": "2018-03-08T23:51:45.047000",
      "content": "<p>Hey everybody. Great start and thank you for the post. Was wondering if somebody could help me with an issue. Running the code gives me the following error when running the training. My platform is a Win 2016 server with 2 GPU's. I have tensorflow 1.5 and Keras 2.0.9. I have verified that all datasets are being built properly with the visualization tools. Kind of stuck. Thanks in advance!!</p>\n\n<p>StopIteration                             Traceback (most recent call last)\n in ()\n      6             learning_rate=config.LEARNING_RATE / 10,\n      7             epochs=2,\n----&gt; 8             layers=\"all\")</p>\n\n<p>~\\model.py in train(self, train_dataset, val_dataset, learning_rate, epochs, layers)\n   2236             max_queue_size=100,\n   2237             workers=workers,\n-&gt; 2238             use_multiprocessing=False,\n   2239         )\n   2240         self.epoch = max(self.epoch, epochs)</p>\n\n<p>C:\\Anaconda\\envs\\py35\\lib\\site-packages\\keras\\legacy\\interfaces.py in wrapper(*args, **kwargs)\n     85                 warnings.warn('Update your <code>' + object_name +\n     86                               '</code> call to the Keras 2 API: ' + signature, stacklevel=2)\n---&gt; 87             return func(*args, **kwargs)\n     88         wrapper._original_function = func\n     89         return wrapper</p>\n\n<p>C:\\Anaconda\\envs\\py35\\lib\\site-packages\\keras\\engine\\training.py in fit_generator(self, generator, steps_per_epoch, epochs, verbose, callbacks, validation_data, validation_steps, class_weight, max_queue_size, workers, use_multiprocessing, shuffle, initial_epoch)\n   2044                 batch_index = 0\n   2045                 while steps_done &lt; steps_per_epoch:\n-&gt; 2046                     generator_output = next(output_generator)\n   2047 \n   2048                     if not hasattr(generator_output, '<strong>len</strong>'):</p>\n\n<p>C:\\Anaconda\\envs\\py35\\lib\\site-packages\\keras\\utils\\data_utils.py in get(self)\n    657                 all_finished = all([not thread.is_alive() for thread in self._threads])\n    658                 if all_finished and self.queue.empty():\n--&gt; 659                     raise StopIteration()\n    660                 else:\n    661                     time.sleep(self.wait_time)</p>\n\n<p>StopIteration: </p>",
      "votes": 0,
      "replies": [
        {
          "id": 292981,
          "author_name": "Nikolay Shebanov",
          "author_url": "",
          "post_date": "2018-03-09T01:12:50.090000",
          "content": "<p>Do you mind reformatting the code to make it more readable? For now I can see only that it isn't a full backtrace, there should be something more.</p>",
          "votes": 0,
          "replies": []
        },
        {
          "id": 293028,
          "author_name": "maddocmatt",
          "author_url": "",
          "post_date": "2018-03-09T03:29:46.807000",
          "content": "<p>Hey Nikolay.</p>\n\n<p>Here is the code:</p>\n\n<p>C:\\Anaconda\\envs\\py35\\lib\\site-packages\\scipy\\ndimage\\interpolation.py:600: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.\n  \"the returned array has changed.\", UserWarning)\nC:\\Anaconda\\envs\\py35\\lib\\site-packages\\tensorflow\\python\\ops\\gradients_impl.py:97: UserWarning: Converting sparse IndexedSlices to a dense Tensor of unknown shape. This may consume a large amount of memory.\n  \"Converting sparse IndexedSlices to a dense Tensor of unknown shape. \"\nEpoch 1/100\nTraceback (most recent call last):</p>\n\n<p>File \"\", line 1, in \n    runfile('C:/kaggle-ds-bowl-2018-baseline-master/train.py', wdir='C:/kaggle-ds-bowl-2018-baseline-master')</p>\n\n<p>File \"C:\\Anaconda\\envs\\py35\\lib\\site-packages\\spyder\\utils\\site\\sitecustomize.py\", line 710, in runfile\n    execfile(filename, namespace)</p>\n\n<p>File \"C:\\Anaconda\\envs\\py35\\lib\\site-packages\\spyder\\utils\\site\\sitecustomize.py\", line 101, in execfile\n    exec(compile(f.read(), filename, 'exec'), namespace)</p>\n\n<p>File \"C:/kaggle-ds-bowl-2018-baseline-master/train.py\", line 78, in \n    layers=\"all\")</p>\n\n<p>File \"C:\\kaggle-ds-bowl-2018-baseline-master\\model.py\", line 2241, in train\n    use_multiprocessing=False,</p>\n\n<p>File \"C:\\Anaconda\\envs\\py35\\lib\\site-packages\\keras\\legacy\\interfaces.py\", line 87, in wrapper\n    return func(*args, **kwargs)</p>\n\n<p>File \"C:\\Anaconda\\envs\\py35\\lib\\site-packages\\keras\\engine\\training.py\", line 2046, in fit_generator\n    generator_output = next(output_generator)</p>\n\n<p>File \"C:\\Anaconda\\envs\\py35\\lib\\site-packages\\keras\\utils\\data_utils.py\", line 659, in get\n    raise StopIteration()</p>\n\n<p>StopIteration</p>",
          "votes": 0,
          "replies": []
        },
        {
          "id": 293199,
          "author_name": "Nikolay Shebanov",
          "author_url": "",
          "post_date": "2018-03-09T11:36:55.297000",
          "content": "<p>This might be obvious, but StopIteration means that the training generator is empty.\n<a href=\"https://github.com/keras-team/keras/blob/4b74fc5418944c9f449eb88ed4b40ada280fa5ca/keras/utils/data_utils.py#L784\">https://github.com/keras-team/keras/blob/4b74fc5418944c9f449eb88ed4b40ada280fa5ca/keras/utils/data_utils.py#L784</a></p>\n\n<p>Are you sure you tested the datasets well? Also, have you made any notable changes to my code or you just run it as is?</p>",
          "votes": 0,
          "replies": []
        },
        {
          "id": 293260,
          "author_name": "maddocmatt",
          "author_url": "",
          "post_date": "2018-03-09T14:42:21.497000",
          "content": "<p>No I appreciate the info :). Yes I agree the training generator is dropping data. But i have used the verification and visualization code to check the and I can see training data in the data dataset_training, it shows masks on that data and it returns shapes of the data. Which is why I am very confused why it's dropping. I thought it might be an issue between Linux and Windows but I tested code to change the worker roles and multithreaded processing to false and that had no effect.</p>",
          "votes": 0,
          "replies": []
        },
        {
          "id": 293267,
          "author_name": "Nikolay Shebanov",
          "author_url": "",
          "post_date": "2018-03-09T14:53:42.707000",
          "content": "<p>Try to drop a <code>import pdb; pdb.set_trace()</code> on this line and debug if the data gets loaded properly <a href=\"https://github.com/killthekitten/kaggle-ds-bowl-2018-baseline/blob/master/model.py#L1639\">https://github.com/killthekitten/kaggle-ds-bowl-2018-baseline/blob/master/model.py#L1639</a></p>\n\n<p>It feels like some windows black magic is going on here.</p>",
          "votes": 0,
          "replies": []
        },
        {
          "id": 293268,
          "author_name": "maddocmatt",
          "author_url": "",
          "post_date": "2018-03-09T14:56:55.590000",
          "content": "<p>Ill give it a shot! Thank you sir!</p>",
          "votes": 0,
          "replies": []
        },
        {
          "id": 293295,
          "author_name": "maddocmatt",
          "author_url": "",
          "post_date": "2018-03-09T15:43:06.820000",
          "content": "<p>Still hunting. It looks like the dataset is getting images and masks. I am wondering if it's something in the batch. Dataset, batches, image returns, classes are all showing data. Bizzaro...</p>",
          "votes": 0,
          "replies": []
        },
        {
          "id": 293360,
          "author_name": "maddocmatt",
          "author_url": "",
          "post_date": "2018-03-09T17:47:46.520000",
          "content": "<p>Might have a theory, since there is so much processing going on, I had noticed that I set my config to: GPU 2 / IMAGES_PER_GPU = 4. This value is setting the batch size. I wonder if it was too low and therefore the queue was empty before preprocessing another batch occurred.</p>",
          "votes": 0,
          "replies": []
        },
        {
          "id": 293375,
          "author_name": "Nikolay Shebanov",
          "author_url": "",
          "post_date": "2018-03-09T18:39:44.677000",
          "content": "<p>Shouldn't be an issue. Anyway, I've found it slower to use multiple GPUs, at least with the current dataset setup (reading multiple files).</p>",
          "votes": 0,
          "replies": []
        },
        {
          "id": 293415,
          "author_name": "maddocmatt",
          "author_url": "",
          "post_date": "2018-03-09T19:40:22.943000",
          "content": "<p>So I went back to basics. Verified that the only change to the original code was to mod the regex to allow // on the path. Aside from that it is a straight run with. The only thing i am doing is running from spyder and not a command prompt. Out of curiosity, are you running 3.5 or 2.7 for your version?</p>",
          "votes": 0,
          "replies": []
        },
        {
          "id": 293427,
          "author_name": "Nikolay Shebanov",
          "author_url": "",
          "post_date": "2018-03-09T20:08:58.773000",
          "content": "<p>I'm on 3.6.4 to be exact :) Is that the regex from the comment somewhere above on this page?</p>",
          "votes": 0,
          "replies": []
        },
        {
          "id": 293428,
          "author_name": "maddocmatt",
          "author_url": "",
          "post_date": "2018-03-09T20:10:32.407000",
          "content": "<p>Yes. I saw something about pycotools not being verified on anything past 2.7. I have verified that the queue is empty on reaching that point. It has memory allocation but nothing inside. Very strange </p>",
          "votes": 0,
          "replies": []
        },
        {
          "id": 293431,
          "author_name": "Nikolay Shebanov",
          "author_url": "",
          "post_date": "2018-03-09T20:13:06.710000",
          "content": "<p>Oh wait, I run Keras 2.1.3 / tensorflow 1.4.1, try to update yours</p>",
          "votes": 0,
          "replies": []
        },
        {
          "id": 293433,
          "author_name": "maddocmatt",
          "author_url": "",
          "post_date": "2018-03-09T20:20:52.080000",
          "content": "<p>Ok even the demo run fails in the same spot. Something's up :)</p>",
          "votes": 0,
          "replies": []
        },
        {
          "id": 294190,
          "author_name": "Eduardo Rocha de Andrade",
          "author_url": "",
          "post_date": "2018-03-11T14:37:36.047000",
          "content": "<p>I was getting the StopIteration raised as well, I fixed by updating both Tensorflow and Keras</p>",
          "votes": 2,
          "replies": []
        },
        {
          "id": 294312,
          "author_name": "maddocmatt",
          "author_url": "",
          "post_date": "2018-03-11T18:06:07.407000",
          "content": "<p>What versions of Keras and Tensorflow are you running now?</p>",
          "votes": 0,
          "replies": []
        },
        {
          "id": 294387,
          "author_name": "Eduardo Rocha de Andrade",
          "author_url": "",
          "post_date": "2018-03-11T21:34:53.913000",
          "content": "<pre><code>tf.__version__ : '1.4.1'\nkeras.__version__ : '2.1.4'\n</code></pre>",
          "votes": 0,
          "replies": []
        },
        {
          "id": 294795,
          "author_name": "maddocmatt",
          "author_url": "",
          "post_date": "2018-03-12T16:43:16.437000",
          "content": "<p>Hey everybody thanks for the help on this. It was indeed the Keras version needed to be updated as well as Tensorflow. But a word to my colleagues out there, if you are using Windows. If you update Tensorflow make sure you force install the gpu version as it will upgrade Tensorflow to 1.5 but it will wipe out the GPU version. So you have to force pip install into your conda environment no less than 1.3 or it will fail the version check. Training now! </p>",
          "votes": 1,
          "replies": []
        },
        {
          "id": 294809,
          "author_name": "Nikolay Shebanov",
          "author_url": "",
          "post_date": "2018-03-12T16:57:55.637000",
          "content": "<p>Glad to hear that. I hope it was worth the troubles!</p>",
          "votes": 0,
          "replies": []
        }
      ]
    },
    {
      "id": 291395,
      "author_name": "Kelvin Au",
      "author_url": "",
      "post_date": "2018-03-06T03:28:42.427000",
      "content": "<p>Anyone tried the script under windows 10. Seems the path parsing under windows is different from linux (Solved)</p>",
      "votes": 0,
      "replies": [
        {
          "id": 291449,
          "author_name": "Wei Lu",
          "author_url": "",
          "post_date": "2018-03-06T06:41:12.717000",
          "content": "<p>yes. add <strong>.replace(\"\\\\\", \"/\")</strong> after <strong>mask_path</strong> in bowl_dataset.py</p>",
          "votes": 2,
          "replies": []
        },
        {
          "id": 291543,
          "author_name": "Nikolay Shebanov",
          "author_url": "",
          "post_date": "2018-03-06T10:24:37.483000",
          "content": "<p>Sorry guys, I tried to make it portable, but didn't actually test it. I'd appreciate if someone will send a PR to fix the regex here <a href=\"https://github.com/killthekitten/kaggle-ds-bowl-2018-baseline/blob/master/bowl_dataset.py#L19\">https://github.com/killthekitten/kaggle-ds-bowl-2018-baseline/blob/master/bowl_dataset.py#L19</a></p>",
          "votes": 0,
          "replies": []
        },
        {
          "id": 291571,
          "author_name": "Kelvin Au",
          "author_url": "",
          "post_date": "2018-03-06T11:56:46.677000",
          "content": "<p>Thx Wei Lu and Nikolay Shebanov</p>\n\n<p>Now it works with the following fix in bowl_dataset.py </p>\n\n<p><code>for mask_path in glob(os.path.join(base_path, \"**\", \"masks\", \"*.png\")):</code></p>\n\n<pre><code>   `mask_path = mask_path.replace(\"\\\\\", \"/\") `\n   `matches = id_extractor.match(mask_path)`\n</code></pre>\n\n<p>Cheers</p>",
          "votes": 0,
          "replies": []
        },
        {
          "id": 291589,
          "author_name": "Nikolay Shebanov",
          "author_url": "",
          "post_date": "2018-03-06T12:27:07.977000",
          "content": "<p>There's a couple of mistakes in your code, try this instead:</p>\n\n<pre><code>mask_path = mask_path.replace(\"\\\\\", \"/\")\n</code></pre>",
          "votes": 1,
          "replies": []
        },
        {
          "id": 299295,
          "author_name": "Ankita Jha",
          "author_url": "",
          "post_date": "2018-03-20T19:01:59.320000",
          "content": "<p>Hi Nikolay, I am a windows 10 user, I am getting an error on line 20 in bowl_dataset.py:</p>\n\n<p>id_extractor = re.compile(f\"{base_path}{os.sep}(?P.){os.sep}masks{os.sep}(?P.*).png\") that says \"sre_constants.error: unbalanced parenthesis at position 30\".</p>\n\n<p>The mask_path line occurs below this line, so the above fixes do not help. Any idea what could be causing this? Would appreciate any help!</p>",
          "votes": 0,
          "replies": []
        },
        {
          "id": 299417,
          "author_name": "Nikolay Shebanov",
          "author_url": "",
          "post_date": "2018-03-20T21:10:31.157000",
          "content": "<p>What line do you pass as a <code>base_path</code>? i.e. what goes as an argument to <code>load_bowl()</code>? </p>\n\n<p>If you could drop an <code>import pdb; pdb.set_trace()</code> directly before this line and then check what's the value of <code>f\"{base_path}{os.sep}(?P.){os.sep}masks{os.sep}(?P.*).png\"</code> then it would be easier to understand the problem.</p>",
          "votes": 0,
          "replies": []
        },
        {
          "id": 300086,
          "author_name": "Ankita Jha",
          "author_url": "",
          "post_date": "2018-03-21T09:07:49.983000",
          "content": "<p>This is what I get:</p>\n\n<pre><code>ipdb&gt; print(f\"{base_path}\\{os.sep}(?P&lt;image_id&gt;.*)\\{os.sep}masks\\{os.sep}(?P&lt;mask_id&gt;.*)\\.png\")\n</code></pre>\n\n<p><code>stage1_train\\{\\(?P&lt;image_id&gt;.*)\\{\\masks\\{\\(?P&lt;mask_id&gt;.*)\\.png</code> </p>\n\n<p>There is a bracket mismatch definitely. I am fairly new to Python and I did try correcting this but no luck! Any ideas on what is going wrong?</p>",
          "votes": 0,
          "replies": []
        },
        {
          "id": 301035,
          "author_name": "Nikolay Shebanov",
          "author_url": "",
          "post_date": "2018-03-22T07:38:26.090000",
          "content": "<p>Which version of Python are you on?</p>",
          "votes": 0,
          "replies": []
        },
        {
          "id": 301038,
          "author_name": "Ankita Jha",
          "author_url": "",
          "post_date": "2018-03-22T07:42:50.403000",
          "content": "<p>Python 3.6.1</p>",
          "votes": 0,
          "replies": []
        }
      ]
    },
    {
      "id": 290858,
      "author_name": "Binyu Wang",
      "author_url": "",
      "post_date": "2018-03-05T03:45:32.677000",
      "content": "<p>Thank you for sharing!</p>\n\n<p>When I running your code in model training,  I encounter one error : \nTraceback (most recent call last):\n  File \"train.py\", line 63, in \n    layers='heads')\n  File \"/home/hkueee/kaggle/DataScienceBowl/dsbowl/model.py\", line 2237, in train\n    validation_data=next(val_generator),\n  File \"/home/hkueee/kaggle/DataScienceBowl/dsbowl/model.py\", line 1736, in data_generator\n    dataset.image_info[image_id]))\nUnboundLocalError: local variable 'image_id' referenced before assignment</p>\n\n<p>Do you know how to fix that? Thanks!</p>",
      "votes": 0,
      "replies": [
        {
          "id": 290920,
          "author_name": "Binyu Wang",
          "author_url": "",
          "post_date": "2018-03-05T07:18:24.523000",
          "content": "<p>Fixed. Need to specify the path of data first. </p>",
          "votes": 1,
          "replies": []
        },
        {
          "id": 372571,
          "author_name": "",
          "author_url": "",
          "post_date": "2018-08-19T18:32:52.597000",
          "content": "",
          "votes": 0,
          "replies": []
        },
        {
          "id": 372594,
          "author_name": "Nikolay Shebanov",
          "author_url": "",
          "post_date": "2018-08-19T20:19:08.023000",
          "content": "<p>Hey Kate, did you experience the same error? I think it's easy to fix by providing relative paths to data as an argument to the load_bowl function. Let me know if that's worked.</p>",
          "votes": 0,
          "replies": []
        },
        {
          "id": 372620,
          "author_name": "",
          "author_url": "",
          "post_date": "2018-08-19T22:12:28.327000",
          "content": "",
          "votes": 0,
          "replies": []
        }
      ]
    },
    {
      "id": 290650,
      "author_name": "Roman Chernenko",
      "author_url": "",
      "post_date": "2018-03-04T16:33:25.020000",
      "content": "<p>What graphics card do you use? I'm trying to start train on NVidia 1070 (8 GB), but I got a out of memory error on start like this:</p>\n\n<pre><code>ResourceExhaustedError (see above for traceback): OOM when allocating tensor with shape[1200,256,14,14]\n     [[Node: training/SGD/gradients/mrcnn_mask_deconv/conv2d_transpose_grad/Conv2D = Conv2D[T=DT_FLOAT, _class=[\"loc:@mrcnn_mask_deconv/conv2d_transpose\"], data_format=\"NHWC\", padding=\"VALID\", strides=[1, 2, 2, 1], use_cudnn_on_gpu=true, _device=\"/job:localhost/replica:0/task:0/device:GPU:0\"](training/SGD/gradients/mrcnn_mask_deconv/Relu_grad/ReluGrad, mrcnn_mask_deconv/kernel/read)]]\n     [[Node: training/SGD/gradients/mrcnn_mask_conv1/convolution_grad/Conv2DBackpropInput/_2931 = _Recv[client_terminated=false, recv_device=\"/job:localhost/replica:0/task:0/device:CPU:0\", send_device=\"/job:localhost/replica:0/task:0/device:GPU:0\", send_device_incarnation=1, tensor_name=\"edge_7871_training/SGD/gradients/mrcnn_mask_conv1/convolution_grad/Conv2DBackpropInput\", tensor_type=DT_FLOAT, _device=\"/job:localhost/replica:0/task:0/device:CPU:0\"]()]]\n</code></pre>",
      "votes": 0,
      "replies": [
        {
          "id": 290657,
          "author_name": "Nikolay Shebanov",
          "author_url": "",
          "post_date": "2018-03-04T17:01:42.240000",
          "content": "<p>A couple of 1080TIs actually, so that's more memory than you have. Try to change this variable to 1 locally: <a href=\"https://github.com/killthekitten/kaggle-ds-bowl-2018-baseline/blob/master/bowl_config.py#L14\">https://github.com/killthekitten/kaggle-ds-bowl-2018-baseline/blob/master/bowl_config.py#L14</a></p>\n\n<p>Tell me if it helps.</p>",
          "votes": 2,
          "replies": []
        },
        {
          "id": 290707,
          "author_name": "Roman Chernenko",
          "author_url": "",
          "post_date": "2018-03-04T18:01:32.783000",
          "content": "<p>Yes, it works with \"IMAGES_PER_GPU = 1\". Thank you.</p>",
          "votes": 0,
          "replies": []
        },
        {
          "id": 291447,
          "author_name": "Wei Lu",
          "author_url": "",
          "post_date": "2018-03-06T06:38:11.680000",
          "content": "<p>Hello Roman, would you mind telling us how you reach 49th place? Did you use this mask-rcnn method? Thanks.</p>",
          "votes": 0,
          "replies": []
        },
        {
          "id": 291597,
          "author_name": "Roman Chernenko",
          "author_url": "",
          "post_date": "2018-03-06T12:37:04.953000",
          "content": "<p>No, I'm using UNet-based CNN with additional post-processing.</p>",
          "votes": 0,
          "replies": []
        },
        {
          "id": 291692,
          "author_name": "Wei Lu",
          "author_url": "",
          "post_date": "2018-03-06T17:16:42.933000",
          "content": "<p>I see. Thanks</p>",
          "votes": 0,
          "replies": []
        }
      ]
    },
    {
      "id": 290505,
      "author_name": "Abhishek Jindal",
      "author_url": "",
      "post_date": "2018-03-04T10:11:26.223000",
      "content": "<p>Hi Nikolay, thanks for the code and the steps. </p>\n\n<p>I am running your code on Google cloud with Tesla K80 GPU but it took over 5 hours to complete 1 epoch (total 100 epochs). It is taking approximately 30 seconds for each image to run (total 664 images). After going through the forums, I think that cudnn might not be installed properly. \nCan you please guide me in the proper direction so that I do not waste a lot of time on setup.</p>\n\n<p>I am new with GPUs and your help is greatly appreciated.</p>",
      "votes": 0,
      "replies": [
        {
          "id": 290550,
          "author_name": "Nikolay Shebanov",
          "author_url": "",
          "post_date": "2018-03-04T12:06:37.507000",
          "content": "<p>Easy first step would be to follow one of the tutorials specific to Google Cloud setup.</p>\n\n<p>I think this should work: <a href=\"https://github.com/eshvk/gcp-dl\">https://github.com/eshvk/gcp-dl</a></p>",
          "votes": 0,
          "replies": []
        },
        {
          "id": 290590,
          "author_name": "Kevin Liu",
          "author_url": "",
          "post_date": "2018-03-04T13:55:02.347000",
          "content": "<p>Hi Abhishek \n the issue is using too much I/O operation when loading：\ndef load_image(self, image_id):\n        info = self.image_info[image_id]\n        return cv2.imread(info[\"path\"])</p>",
          "votes": 0,
          "replies": []
        }
      ]
    },
    {
      "id": 290500,
      "author_name": "Mehul Sampat",
      "author_url": "",
      "post_date": "2018-03-04T10:00:46.803000",
      "content": "<p>Hi Nikolay! Thanks for sharing the code. \nIn train.py I see:\nmodel.train(dataset_train, dataset_val, \n            learning_rate=bowl_config.LEARNING_RATE, \n            epochs=1, \n            layers='heads')</p>\n\n<p>model.train(dataset_train, dataset_val, \n            learning_rate=bowl_config.LEARNING_RATE / 10,\n            epochs=100, \n            layers=\"all\")</p>\n\n<p>I think we can just run the second model.train (with layers==all) and skip the first one right ? \nOr is there a reason to run it this way ? \nThanks\nMehul</p>",
      "votes": 0,
      "replies": [
        {
          "id": 290544,
          "author_name": "Nikolay Shebanov",
          "author_url": "",
          "post_date": "2018-03-04T11:49:35.293000",
          "content": "<p>I copied that from the original repo. You can run it with \"all\" right from the start.</p>\n\n<p>However, the paper says that:</p>\n\n<blockquote>\n  <p>To  unify  RPNs  with  Fast  R-CNN  [2]  object  detec-\n  tion  networks,  we  propose  a  training  scheme  that\n  alternates between fine-tuning for the region proposal\n  task  and  then  fine-tuning  for  object  detection,  while\n  keeping  the  proposals  fixed.  This  scheme  converges\n  quickly and produces a unified network with convo-\n  lutional features that are shared between both tasks.</p>\n</blockquote>\n\n<p>Not sure yet how to train like that using the matterport framework.</p>",
          "votes": 0,
          "replies": []
        }
      ]
    },
    {
      "id": 290464,
      "author_name": "jackkwok",
      "author_url": "",
      "post_date": "2018-03-04T06:32:09.190000",
      "content": "<p>Hi Nikolay, thank you for sharing your code.  </p>\n\n<p>Can you also share the versions of python packages used (including tensorflow and scipy)?  I am seeing rpn_bbox_loss: nan after some point during training.  Since I was running the code as is without changes, I am guessing I may have a version which causes issue but I am not sure.</p>",
      "votes": 0,
      "replies": [
        {
          "id": 290547,
          "author_name": "Nikolay Shebanov",
          "author_url": "",
          "post_date": "2018-03-04T11:54:24.087000",
          "content": "<p>Here you go:</p>\n\n<pre><code>Cython==0.27.3\nnumpy==1.14.0\nopencv-python==3.4.0.12\npycocotools==2.0\nscikit-image==0.13.1\nscikit-learn==0.19.1\nscipy==1.0.0\ntensorflow-gpu==1.4.1\ntensorflow-tensorboard==0.4.0\n</code></pre>\n\n<p>I've heard of the same issue from <a href=\"https://www.kaggle.com/maksimovka\">Konstantin Maksimov</a>. He's using his own fork, so let's ask him how he fixed that.</p>",
          "votes": 2,
          "replies": []
        },
        {
          "id": 290562,
          "author_name": "Kostiantyn Maksymov",
          "author_url": "",
          "post_date": "2018-03-04T12:41:58.927000",
          "content": "<p><a href=\"https://www.kaggle.com/c/data-science-bowl-2018/discussion/49805#289277\">https://www.kaggle.com/c/data-science-bowl-2018/discussion/49805#289277</a></p>",
          "votes": 2,
          "replies": []
        },
        {
          "id": 290884,
          "author_name": "jackkwok",
          "author_url": "",
          "post_date": "2018-03-05T05:12:34.903000",
          "content": "<p>Makes sense.  Thanks for the help!</p>",
          "votes": 0,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "289913": "Hey guys,\n\nThis can save you a day or two to start with the competition in case if you struggle to make your first submit. PRs are more than welcome!\n\nhttps://github.com/killthekitten/kaggle-ds-bowl-2018-baseline",
    "308907": "Thanks for sharing @Nikolay Shebanov. \n\nI just took a look at your code and I could not find where you did the train/validation split. I can only see that you passed the stage1_train directory to get both train and validation data.  I assumed you have split them up in another function right? If so where?",
    "296196": "I'm looking for a description of the following parameters in config\n\nMASK_POOL_SIZE = 14\nMASK_SHAPE = [28, 28]\n\nDoes it make sense to adapt them to our task?\n",
    "295620": "When running `CUDA_VISIBLE_DEVICES=\"0\" python train.py`, I get this error, \n\n`Traceback (most recent call last):`\n\n&nbsp; &nbsp; `File \"train.py\", line 68, in ",
    "294145": "Hi, thanks for the code. One thing that I didn't understand, though, is why do you need/is advised to use the ResNet model? Do you use the pre-trained weights because of the RPN and mask prediction?\nOne other question is what is the least amount of memory required to run this model? I've got 2GB and I'm getting OOM even with 128x128 images and 1 image per GPU.\nThanks",
    "292949": "Hey everybody. Great start and thank you for the post. Was wondering if somebody could help me with an issue. Running the code gives me the following error when running the training. My platform is a Win 2016 server with 2 GPU's. I have tensorflow 1.5 and Keras 2.0.9. I have verified that all datasets are being built properly with the visualization tools. Kind of stuck. Thanks in advance!!\n\nStopIteration                             Traceback (most recent call last)\n",
    "291395": "Anyone tried the script under windows 10. Seems the path parsing under windows is different from linux (Solved)",
    "290858": "Thank you for sharing!\n\nWhen I running your code in model training,  I encounter one error : \nTraceback (most recent call last):\n  File \"train.py\", line 63, in ",
    "290650": "What graphics card do you use? I'm trying to start train on NVidia 1070 (8 GB), but I got a out of memory error on start like this:\n\n    ResourceExhaustedError (see above for traceback): OOM when allocating tensor with shape[1200,256,14,14]\n    \t [[Node: training/SGD/gradients/mrcnn_mask_deconv/conv2d_transpose_grad/Conv2D = Conv2D[T=DT_FLOAT, _class=[\"loc:@mrcnn_mask_deconv/conv2d_transpose\"], data_format=\"NHWC\", padding=\"VALID\", strides=[1, 2, 2, 1], use_cudnn_on_gpu=true, _device=\"/job:localhost/replica:0/task:0/device:GPU:0\"](training/SGD/gradients/mrcnn_mask_deconv/Relu_grad/ReluGrad, mrcnn_mask_deconv/kernel/read)]]\n    \t [[Node: training/SGD/gradients/mrcnn_mask_conv1/convolution_grad/Conv2DBackpropInput/_2931 = _Recv[client_terminated=false, recv_device=\"/job:localhost/replica:0/task:0/device:CPU:0\", send_device=\"/job:localhost/replica:0/task:0/device:GPU:0\", send_device_incarnation=1, tensor_name=\"edge_7871_training/SGD/gradients/mrcnn_mask_conv1/convolution_grad/Conv2DBackpropInput\", tensor_type=DT_FLOAT, _device=\"/job:localhost/replica:0/task:0/device:CPU:0\"]()]]\n",
    "290505": "Hi Nikolay, thanks for the code and the steps. \n\nI am running your code on Google cloud with Tesla K80 GPU but it took over 5 hours to complete 1 epoch (total 100 epochs). It is taking approximately 30 seconds for each image to run (total 664 images). After going through the forums, I think that cudnn might not be installed properly. \nCan you please guide me in the proper direction so that I do not waste a lot of time on setup.\n\nI am new with GPUs and your help is greatly appreciated.",
    "290500": "Hi Nikolay! Thanks for sharing the code. \nIn train.py I see:\nmodel.train(dataset_train, dataset_val, \n            learning_rate=bowl_config.LEARNING_RATE, \n            epochs=1, \n            layers='heads')\n\nmodel.train(dataset_train, dataset_val, \n            learning_rate=bowl_config.LEARNING_RATE / 10,\n            epochs=100, \n            layers=\"all\")\n\nI think we can just run the second model.train (with layers==all) and skip the first one right ? \nOr is there a reason to run it this way ? \nThanks\nMehul",
    "290464": "Hi Nikolay, thank you for sharing your code.  \n\nCan you also share the versions of python packages used (including tensorflow and scipy)?  I am seeing rpn_bbox_loss: nan after some point during training.  Since I was running the code as is without changes, I am guessing I may have a version which causes issue but I am not sure.\n\n"
  }
}