{
  "id": 77338,
  "title": "Need help with CNN",
  "url": "/competitions/humpback-whale-identification/discussion/77338",
  "author_name": "Fizpok",
  "post_date": "2019-01-11T16:23:44.595000",
  "votes": -2,
  "comment_count": 0,
  "views": 0,
  "content": "<p>Hi,</p>\n\n<p>I have a kernel, that implements a simple CNN on whales: <a href=\"https://www.kaggle.com/fizpok/humpback-whale-2\">link to kernel</a></p>\n\n<p>Now, as we have a rather complex case, with non-equal number of samples for different whale ids and \"new_whale\" id, that does not quite fit to CNN model, I did some simplifications: just to test the code.</p>\n\n<p>First, I have removed \"new_whale\".\nSecond, I have sorted whales by number of images, and kept only first 50 whales, this way the min. number of images per whale was 22.\nThird, i have copied 20 images per whale from the (2), so that all whales had equal (20) number of pictures.</p>\n\n<p>Then I divided images on training, validation and test data sets. So far, it is trivial.\nI trained the CNN, and saw some convergence on validation loss (it will take you about 20 minutes to reproduce the results).</p>\n\n<p>Then i used </p>\n\n<pre><code>predictions = model.predict(x_test, batch_size=100)\n</code></pre>\n\n<p>to test the result. Just to discover, that feeding the net different values yeilds EXACTLY the same results:</p>\n\n<pre><code>predictions[0] - predictions[20]\n</code></pre>\n\n<p>produces</p>\n\n<pre><code>array([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,\n   0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,\n   0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n  dtype=float32)\n</code></pre>\n\n<p>I would appreciate help: I think, it is a code error, something stupid, but hard to figure.</p>\n\n<p>Thanks.</p>",
  "messages": [
    {
      "id": 454430,
      "postDate": "2019-01-11T16:23:44.597Z",
      "content": "<p>Hi,</p>\n\n<p>I have a kernel, that implements a simple CNN on whales: <a href=\"https://www.kaggle.com/fizpok/humpback-whale-2\">link to kernel</a></p>\n\n<p>Now, as we have a rather complex case, with non-equal number of samples for different whale ids and \"new_whale\" id, that does not quite fit to CNN model, I did some simplifications: just to test the code.</p>\n\n<p>First, I have removed \"new_whale\".\nSecond, I have sorted whales by number of images, and kept only first 50 whales, this way the min. number of images per whale was 22.\nThird, i have copied 20 images per whale from the (2), so that all whales had equal (20) number of pictures.</p>\n\n<p>Then I divided images on training, validation and test data sets. So far, it is trivial.\nI trained the CNN, and saw some convergence on validation loss (it will take you about 20 minutes to reproduce the results).</p>\n\n<p>Then i used </p>\n\n<pre><code>predictions = model.predict(x_test, batch_size=100)\n</code></pre>\n\n<p>to test the result. Just to discover, that feeding the net different values yeilds EXACTLY the same results:</p>\n\n<pre><code>predictions[0] - predictions[20]\n</code></pre>\n\n<p>produces</p>\n\n<pre><code>array([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,\n   0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,\n   0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n  dtype=float32)\n</code></pre>\n\n<p>I would appreciate help: I think, it is a code error, something stupid, but hard to figure.</p>\n\n<p>Thanks.</p>",
      "rawMarkdown": "Hi,\n\nI have a kernel, that implements a simple CNN on whales: [link to kernel][1]\n\nNow, as we have a rather complex case, with non-equal number of samples for different whale ids and \"new_whale\" id, that does not quite fit to CNN model, I did some simplifications: just to test the code.\n\nFirst, I have removed \"new_whale\".\nSecond, I have sorted whales by number of images, and kept only first 50 whales, this way the min. number of images per whale was 22.\nThird, i have copied 20 images per whale from the (2), so that all whales had equal (20) number of pictures.\n\nThen I divided images on training, validation and test data sets. So far, it is trivial.\nI trained the CNN, and saw some convergence on validation loss (it will take you about 20 minutes to reproduce the results).\n\nThen i used \n\n    predictions = model.predict(x_test, batch_size=100)\n\nto test the result. Just to discover, that feeding the net different values yeilds EXACTLY the same results:\n\n    predictions[0] - predictions[20]\nproduces\n\n    array([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,\n       0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,\n       0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n      dtype=float32)\n\nI would appreciate help: I think, it is a code error, something stupid, but hard to figure.\n\nThanks.\n\n  [1]: https://www.kaggle.com/fizpok/humpback-whale-2",
      "votes": -2
    }
  ],
  "comments": [],
  "raw_markdown_by_id": {
    "454430": "Hi,\n\nI have a kernel, that implements a simple CNN on whales: [link to kernel][1]\n\nNow, as we have a rather complex case, with non-equal number of samples for different whale ids and \"new_whale\" id, that does not quite fit to CNN model, I did some simplifications: just to test the code.\n\nFirst, I have removed \"new_whale\".\nSecond, I have sorted whales by number of images, and kept only first 50 whales, this way the min. number of images per whale was 22.\nThird, i have copied 20 images per whale from the (2), so that all whales had equal (20) number of pictures.\n\nThen I divided images on training, validation and test data sets. So far, it is trivial.\nI trained the CNN, and saw some convergence on validation loss (it will take you about 20 minutes to reproduce the results).\n\nThen i used \n\n    predictions = model.predict(x_test, batch_size=100)\n\nto test the result. Just to discover, that feeding the net different values yeilds EXACTLY the same results:\n\n    predictions[0] - predictions[20]\nproduces\n\n    array([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,\n       0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,\n       0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n      dtype=float32)\n\nI would appreciate help: I think, it is a code error, something stupid, but hard to figure.\n\nThanks.\n\n  [1]: https://www.kaggle.com/fizpok/humpback-whale-2"
  }
}