{
  "id": 46508,
  "title": "Sharing our approach to the problem ",
  "url": "/competitions/sp-society-camera-model-identification/discussion/46508",
  "author_name": "CVxTz",
  "post_date": "2017-12-28T14:40:10.331000",
  "votes": 10,
  "comment_count": 46,
  "views": 0,
  "content": "<p>Hello ! \nSince this is definitely an odd problem I am very curious about what approaches are other kagglers using to solve it.</p>\n\n<p>I'll start with myself : I am using an average of multiple architectures of deep CNNs ( like the kernel I shared ) applied to small crops of the training images, though I am not really sure what the models are learning exactly and I have a huge score mismatch between Validation and LB that I can't explain.</p>\n\n<p>Are there people using other types of methods ? </p>",
  "messages": [
    {
      "id": 262984,
      "postDate": "2017-12-28T14:40:10.330Z",
      "content": "<p>Hello ! \nSince this is definitely an odd problem I am very curious about what approaches are other kagglers using to solve it.</p>\n\n<p>I'll start with myself : I am using an average of multiple architectures of deep CNNs ( like the kernel I shared ) applied to small crops of the training images, though I am not really sure what the models are learning exactly and I have a huge score mismatch between Validation and LB that I can't explain.</p>\n\n<p>Are there people using other types of methods ? </p>",
      "rawMarkdown": "Hello ! \nSince this is definitely an odd problem I am very curious about what approaches are other kagglers using to solve it.\n\nI'll start with myself : I am using an average of multiple architectures of deep CNNs ( like the kernel I shared ) applied to small crops of the training images, though I am not really sure what the models are learning exactly and I have a huge score mismatch between Validation and LB that I can't explain.\n\nAre there people using other types of methods ? \n",
      "votes": 10
    },
    {
      "id": 263078,
      "postDate": "2017-12-28T21:37:47.893Z",
      "content": "<p>I am seeing similar things. (validation 97, Test 80)  My theory is that the modified images in the test set is dragging down the total score.  I am using a variety of Xfr learning and averaging.  I found that center patches seem to work the best.</p>",
      "rawMarkdown": "I am seeing similar things. (validation 97, Test 80)  My theory is that the modified images in the test set is dragging down the total score.  I am using a variety of Xfr learning and averaging.  I found that center patches seem to work the best.",
      "votes": 1,
      "replies": [
        {
          "id": 263093,
          "postDate": "2017-12-28T22:04:40.120Z",
          "content": "<p>What is Xfr learning ?</p>",
          "rawMarkdown": "What is Xfr learning ?",
          "votes": 1
        },
        {
          "id": 263096,
          "postDate": "2017-12-28T22:12:20.993Z",
          "content": "<p>Transfer learning.  You take a pretrained deep network (ResNet, Inception) and attach your own end layer.  <a href=\"https://machinelearningmastery.com/transfer-learning-for-deep-learning/\">https://machinelearningmastery.com/transfer-learning-for-deep-learning/</a>.  Useful when you don't have a lot of training data.</p>",
          "rawMarkdown": " Transfer learning.  You take a pretrained deep network (ResNet, Inception) and attach your own end layer.  https://machinelearningmastery.com/transfer-learning-for-deep-learning/.  Useful when you don't have a lot of training data.",
          "votes": -3
        },
        {
          "id": 263099,
          "postDate": "2017-12-28T22:17:07.580Z",
          "content": "<p>Oh Yeah I get it ! I am doing the same </p>",
          "rawMarkdown": "Oh Yeah I get it ! I am doing the same "
        },
        {
          "id": 268023,
          "postDate": "2018-01-13T02:54:53.910Z",
          "content": "<p>does it work in this task? i thought that it only works for similiar tasks. - -|</p>",
          "rawMarkdown": "does it work in this task? i thought that it only works for similiar tasks. - -|",
          "votes": -1
        }
      ]
    },
    {
      "id": 263495,
      "postDate": "2017-12-30T13:21:20.403Z",
      "content": "<p>I split all training images into 512x512 then resized all to 256x256 (similar approach used to feed test into the model). Getting &gt; 90% validation but on test goes almost half. I am assuming it's due to altered images... I tried setting all altered images to one category and the score goes down just a little.</p>",
      "rawMarkdown": "I split all training images into 512x512 then resized all to 256x256 (similar approach used to feed test into the model). Getting &gt; 90% validation but on test goes almost half. I am assuming it's due to altered images... I tried setting all altered images to one category and the score goes down just a little.",
      "votes": 1
    },
    {
      "id": 263384,
      "postDate": "2017-12-30T00:27:15.927Z",
      "content": "<p>CVxTz in your approach How can you be sure that your model isn't just detecting objects that are same in training data and testing data... </p>",
      "rawMarkdown": "CVxTz in your approach How can you be sure that your model isn't just detecting objects that are same in training data and testing data... ",
      "votes": 1,
      "replies": [
        {
          "id": 263486,
          "postDate": "2017-12-30T12:29:57.480Z",
          "content": "<p>Images in the train are not in the validation set.</p>",
          "rawMarkdown": "Images in the train are not in the validation set."
        },
        {
          "id": 263493,
          "postDate": "2017-12-30T13:17:43.923Z",
          "content": "<p>For this to be the case, there would have to be objects specific to photos taken on a single phone model. I.e. All Samsung Galaxy S6 photos having dogs in them.</p>",
          "rawMarkdown": "For this to be the case, there would have to be objects specific to photos taken on a single phone model. I.e. All Samsung Galaxy S6 photos having dogs in them."
        }
      ]
    },
    {
      "id": 262992,
      "postDate": "2017-12-28T15:03:28.643Z",
      "content": "<p>Similar approach but no ensembl model yet. </p>",
      "rawMarkdown": "Similar approach but no ensembl model yet. ",
      "votes": 1
    },
    {
      "id": 263235,
      "postDate": "2017-12-29T11:30:53.453Z",
      "content": "<p>We have the same issue. There might be another case, which is, in the test dataset, all the images are captured from another devices (but the models are same). So there is a high possibility that deep cnns are learning the device specific PRNU noises.</p>",
      "rawMarkdown": "We have the same issue. There might be another case, which is, in the test dataset, all the images are captured from another devices (but the models are same). So there is a high possibility that deep cnns are learning the device specific PRNU noises.\n ",
      "votes": 2,
      "replies": [
        {
          "id": 263238,
          "postDate": "2017-12-29T11:36:00Z",
          "content": "<p>I had the same doubts so I asked this question in the Presentation thread but the organizers did not answer </p>",
          "rawMarkdown": "I had the same doubts so I asked this question in the Presentation thread but the organizers did not answer "
        },
        {
          "id": 265300,
          "postDate": "2018-01-05T04:47:09.330Z",
          "content": "<p>Have any thoughts about improving this situation?</p>",
          "rawMarkdown": "Have any thoughts about improving this situation?"
        },
        {
          "id": 265336,
          "postDate": "2018-01-05T08:39:46.087Z",
          "rawMarkdown": "",
          "isDeleted": true
        },
        {
          "id": 265354,
          "postDate": "2018-01-05T09:57:29.353Z",
          "content": "<p>I don't think purely ensembling might help a lot. The variance between test set and validation set is too large.</p>",
          "rawMarkdown": "I don't think purely ensembling might help a lot. The variance between test set and validation set is too large."
        }
      ]
    },
    {
      "id": 263789,
      "postDate": "2017-12-31T22:35:45.113Z",
      "content": "<p>I've been running some tests on data \"out in the wild\" (images from the web).  Even though my current model has a 99% validation accuracy, these get correctly identified around 20-30% of the time.  </p>\n\n<p>As another test, I sent 10 images from the training set through \"google hangouts\" and none of the resulting images get correctly classified.  Looking at the jpeg headers for these failing images, I notice that the quality is reduced to 90%.  However, if I perform the same operation manually (Image.save), I still can identify the resulting images.</p>\n\n<p>I have an old Note 3 and about 90% of these images get correctly classified unless they are sent through google hangout.</p>\n\n<p>I suspect that we probably need to augment the training set with additional images from other sources or reprocessed training files.  too bad ImageDataGenerator doesn't have a \"Google Hangouts\" operator ;)</p>",
      "rawMarkdown": "I've been running some tests on data \"out in the wild\" (images from the web).  Even though my current model has a 99% validation accuracy, these get correctly identified around 20-30% of the time.  \n\nAs another test, I sent 10 images from the training set through \"google hangouts\" and none of the resulting images get correctly classified.  Looking at the jpeg headers for these failing images, I notice that the quality is reduced to 90%.  However, if I perform the same operation manually (Image.save), I still can identify the resulting images.\n\nI have an old Note 3 and about 90% of these images get correctly classified unless they are sent through google hangout.\n\nI suspect that we probably need to augment the training set with additional images from other sources or reprocessed training files.  too bad ImageDataGenerator doesn't have a \"Google Hangouts\" operator ;)",
      "votes": -2
    },
    {
      "id": 263301,
      "postDate": "2017-12-29T17:19:41.973Z",
      "content": "<p>Does anyone have any advice for processing the JPGs in R to get them to a 'model ready' state?</p>",
      "rawMarkdown": "Does anyone have any advice for processing the JPGs in R to get them to a 'model ready' state?",
      "votes": -1
    },
    {
      "id": 265695,
      "postDate": "2018-01-06T10:10:50.987Z",
      "content": "<p>Hi All,\nI am doing transfer learning for RESNET50. I have modified  FC layers-</p>\n\n<pre><code>x = resnet_model.output\nx = Flatten()(x)\nx = Dropout(0.3)(x)\nx = Dense(1024,name='FCL1_1024')(x)\n#x = BatchNormalization()(x)\nx = Dropout(0.3)(x)\nx = Dense(num_class,activation ='sigmoid',name='Class_out')(x)\n</code></pre>\n\n<p>I have my own patch generation code and  random_transform. But even after  20 epochs I am not seeing any improvement in  val_loss/val_acc  --see in the image-</p>\n\n<p>Plz suggest, what could be the reason for this.</p>",
      "rawMarkdown": "Hi All,\nI am doing transfer learning for RESNET50. I have modified  FC layers-\n\n    x = resnet_model.output\n\tx = Flatten()(x)\n\tx = Dropout(0.3)(x)\n\tx = Dense(1024,name='FCL1_1024')(x)\n\t#x = BatchNormalization()(x)\n\tx = Dropout(0.3)(x)\n\tx = Dense(num_class,activation ='sigmoid',name='Class_out')(x)\n\nI have my own patch generation code and  random_transform. But even after  20 epochs I am not seeing any improvement in  val_loss/val_acc  --see in the image-\n\nPlz suggest, what could be the reason for this.\n",
      "replies": [
        {
          "id": 265709,
          "postDate": "2018-01-06T11:42:46.963Z",
          "rawMarkdown": "",
          "isDeleted": true
        },
        {
          "id": 265721,
          "postDate": "2018-01-06T12:23:58.950Z",
          "content": "<p>Just guessing as your splitting code is not there.. Have you shuffled the data?</p>",
          "rawMarkdown": "Just guessing as your splitting code is not there.. Have you shuffled the data?"
        },
        {
          "id": 265731,
          "postDate": "2018-01-06T13:17:50.327Z",
          "content": "<p>You're using sigmoid, which is good for binary classification, not multiclass. Change to:</p>\n\n<p><code>x = Dense(num_class,activation =\"softmax\",name=\"Class_out\")(x)</code></p>",
          "rawMarkdown": "You're using sigmoid, which is good for binary classification, not multiclass. Change to:\n\n`x = Dense(num_class,activation =\"softmax\",name=\"Class_out\")(x)`\n"
        }
      ]
    },
    {
      "id": 264299,
      "postDate": "2018-01-02T18:51:02.353Z",
      "content": "<p>I'm using a mix of features + a random forest classifier, which has the same mismatch between validation and LB, but at a much lower score. Just to get a better idea of approach preferences, I'm curious if anyone in the top 25 is not using a deep learning model?</p>",
      "rawMarkdown": "I'm using a mix of features + a random forest classifier, which has the same mismatch between validation and LB, but at a much lower score. Just to get a better idea of approach preferences, I'm curious if anyone in the top 25 is not using a deep learning model?",
      "replies": [
        {
          "id": 264514,
          "postDate": "2018-01-03T09:22:59.630Z",
          "content": "<blockquote>\n  <p>I'm curious if anyone in the top 25 is not using a deep learning model?</p>\n</blockquote>\n\n<p>Yes, almost all of them. </p>\n\n<blockquote>\n  <p>not </p>\n</blockquote>\n\n<p>Oh. :D</p>",
          "rawMarkdown": "&gt; I'm curious if anyone in the top 25 is not using a deep learning model?\n\nYes, almost all of them. \n\n&gt; not \n\nOh. :D",
          "votes": -1
        }
      ]
    },
    {
      "id": 263864,
      "postDate": "2018-01-01T11:55:20.510Z",
      "content": "<p>Hi All,\nI am facing an issue, I have started training  RESNET18 from scratch. I have written my own data augmentation which randomly picks an image from given Camera model and randomly extract a patch (64x64x3,224x224x3).\nMy training details for resnet18:\npatch size- 64x64x3\nBatch_size = 32![enter image description here][1]\nbatch_per_epoch = 512\nOptimizer- sdg,lr= 0.01</p>\n\n<p>Even after 30 epochs, I am seeing  validation loss = 1.90 (started from 3.3) and accuracy- 30% ( started from 9%). After I am not seeing any improvement. Can you suggest what is the issue? With this model, my score is 0.209.</p>\n\n<p>Also, I am trying transfer learning with RESNET 50 which 2 change- Num class =10 and making 'Activation_43' to FC trainable and other layers untrainable.</p>\n\n<p>Details of training-\npatch size- 224x224x3\nBatch_size = 128\nbatch_per_epoch = 15\nOptimizer- adadelta,</p>\n\n<p>Even with this, I am seeing very poor validation accuracy even though traing accuracy is jumping up but in very oscilating manner. Plz see the graphs of tensorbaords.</p>\n\n<p>If you guys have any suggestion then plz suggest it.</p>",
      "rawMarkdown": "Hi All,\nI am facing an issue, I have started training  RESNET18 from scratch. I have written my own data augmentation which randomly picks an image from given Camera model and randomly extract a patch (64x64x3,224x224x3).\nMy training details for resnet18:\npatch size- 64x64x3\nBatch_size = 32![enter image description here][1]\nbatch_per_epoch = 512\nOptimizer- sdg,lr= 0.01\n\nEven after 30 epochs, I am seeing  validation loss = 1.90 (started from 3.3) and accuracy- 30% ( started from 9%). After I am not seeing any improvement. Can you suggest what is the issue? With this model, my score is 0.209.\n\nAlso, I am trying transfer learning with RESNET 50 which 2 change- Num class =10 and making 'Activation_43' to FC trainable and other layers untrainable.\n\nDetails of training-\npatch size- 224x224x3\nBatch_size = 128\nbatch_per_epoch = 15\nOptimizer- adadelta,\n\nEven with this, I am seeing very poor validation accuracy even though traing accuracy is jumping up but in very oscilating manner. Plz see the graphs of tensorbaords.\n\nIf you guys have any suggestion then plz suggest it.\n\n\n\n\n ",
      "replies": [
        {
          "id": 263911,
          "postDate": "2018-01-01T15:30:00.887Z",
          "content": "<p>What do your final layers look like?  Are you taking the output of the ResNet directly into the softmax layer?  Often I will put an intermediate layer between the output layer.   I then add dropout as needed to reduce overfitting. \n Here is some psudo Keras code:</p>\n\n<pre><code>x = ResNet.output \nx = GlobalAverage2D()(x)\nx = Dense(128) (x)\nx = BatchNormalization(x)\nx = Dropout(0.1)(x)\nx = Dense(10)(x)\nx = Dropout(0.1)(x)\npredictions = Activation('softmax')(x)\n</code></pre>\n\n<p>That's a pretty high learning rate.  When I do transfer learning, I first turn off all the training in the model I am using (In your case ResNet) and train at an LR of 1e-3 (sometimes I will do annealing).  Once I am happy with the results (I find val_acc at around 60%) I will open up the other layers and start training at LR of 1 e-4.</p>",
          "rawMarkdown": "What do your final layers look like?  Are you taking the output of the ResNet directly into the softmax layer?  Often I will put an intermediate layer between the output layer.   I then add dropout as needed to reduce overfitting. \n Here is some psudo Keras code:\n\n    x = ResNet.output \n    x = GlobalAverage2D()(x)\n    x = Dense(128) (x)\n    x = BatchNormalization(x)\n    x = Dropout(0.1)(x)\n    x = Dense(10)(x)\n    x = Dropout(0.1)(x)\n    predictions = Activation('softmax')(x)\n    \n\nThat's a pretty high learning rate.  When I do transfer learning, I first turn off all the training in the model I am using (In your case ResNet) and train at an LR of 1e-3 (sometimes I will do annealing).  Once I am happy with the results (I find val_acc at around 60%) I will open up the other layers and start training at LR of 1 e-4.\n",
          "votes": -3
        },
        {
          "id": 263954,
          "postDate": "2018-01-01T19:52:25.193Z",
          "content": "<p>Hi, \nI am follwoing exactly same approch what you have suggested. However there is mis-match in model.\nThe very first time I have strated with adding 2 drop-out layers as follows-</p>\n\n<pre><code>   x = resnet_model.output #after Avg pooling layer\nx = Flatten()(x) #2048 vector-RESNET 50\nx = Dense(1024,name='FCL1_1024')(x)\nx = BatchNormalization()(x)\nx = Dropout(0.3)(x)\nx = Dense(num_class,activation ='sigmoid',name='Class_out')(x)\n</code></pre>\n\n<p>I was  training on this layers and all others were fixed. I have seen that even after 15 epochs error and accuracy for both -Training/Validation- was not improving much - Training Accuracy-12%, Valid Accu-10%. So, I have stopped training process.</p>\n\n<p>With the latest model, which is currently being trained I have used only-</p>\n\n<pre><code>    x = resnet_model.output #after Avg pooling layer\nx = Flatten()(x) #2048 vector-RESNET 50\nx = Dense(num_class,activation ='sigmoid',name='Class_out')(x)\n</code></pre>\n\n<p>Trained this for 15 epochs- Train_Acc=20-22%, Valid_Accu=10%, I have stopped this and loaded model with this step and made top-2 convolution block trainable. </p>\n\n<p>Current status aftre 18epochs-{128-batch size, 15_batch_per epoch} Training accuracy-40% but validation Accuarcy-10% (same).</p>\n\n<p>The pattern of training accuracy plot follows same as I have sent in the last image..it is periodic..not monotonically increasing/decreasing.</p>\n\n<p>Btw, why are you adding drop-out to the final output of 10 class-</p>\n\n<pre><code>x = Dense(10)(x)\n **x = Dropout(0.1)(x)**\n  predictions = Activation('softmax')(x)\n</code></pre>\n\n<p>Suggest if you have any clue on this. Btw are you training resnet18 or 50 ?</p>",
          "rawMarkdown": "Hi, \nI am follwoing exactly same approch what you have suggested. However there is mis-match in model.\nThe very first time I have strated with adding 2 drop-out layers as follows-\n\n       x = resnet_model.output #after Avg pooling layer\n\tx = Flatten()(x) #2048 vector-RESNET 50\n\tx = Dense(1024,name='FCL1_1024')(x)\n\tx = BatchNormalization()(x)\n\tx = Dropout(0.3)(x)\n\tx = Dense(num_class,activation ='sigmoid',name='Class_out')(x)\nI was  training on this layers and all others were fixed. I have seen that even after 15 epochs error and accuracy for both -Training/Validation- was not improving much - Training Accuracy-12%, Valid Accu-10%. So, I have stopped training process.\n\nWith the latest model, which is currently being trained I have used only-\n\n        x = resnet_model.output #after Avg pooling layer\n\tx = Flatten()(x) #2048 vector-RESNET 50\n\tx = Dense(num_class,activation ='sigmoid',name='Class_out')(x)\n\nTrained this for 15 epochs- Train_Acc=20-22%, Valid_Accu=10%, I have stopped this and loaded model with this step and made top-2 convolution block trainable. \n\nCurrent status aftre 18epochs-{128-batch size, 15_batch_per epoch} Training accuracy-40% but validation Accuarcy-10% (same).\n\nThe pattern of training accuracy plot follows same as I have sent in the last image..it is periodic..not monotonically increasing/decreasing.\n\nBtw, why are you adding drop-out to the final output of 10 class-\n\n    x = Dense(10)(x)\n     **x = Dropout(0.1)(x)**\n      predictions = Activation('softmax')(x)\n\nSuggest if you have any clue on this. Btw are you training resnet18 or 50 ?\n\n"
        },
        {
          "id": 263961,
          "postDate": "2018-01-01T20:22:16.650Z",
          "content": "<p>I used ResNet 50.  My last run with ResNet (256x256) was:\nTraining loss 0.0366\nTraining accuracy: 0.991\nVal loss:  0.355\nVal acc:  0.909</p>\n\n<p>Leaderboard submission:  0.742 (Not one of my best models)</p>\n\n<p>I use multiple layers at the end to have better control overfitting.  ResNet has a tendency to overfit compared to other models. So I almost always use dropout, even at the softmax layer.\nGenerally, I train these models for quite a while (100 + epochs) with fine tuning LR as low as 1e-5.</p>\n\n<p>Are you normalizing your data?   </p>",
          "rawMarkdown": "I used ResNet 50.  My last run with ResNet (256x256) was:\nTraining loss 0.0366\nTraining accuracy: 0.991\nVal loss:  0.355\nVal acc:  0.909\n\nLeaderboard submission:  0.742 (Not one of my best models)\n\nI use multiple layers at the end to have better control overfitting.  ResNet has a tendency to overfit compared to other models. So I almost always use dropout, even at the softmax layer.\nGenerally, I train these models for quite a while (100 + epochs) with fine tuning LR as low as 1e-5.\n\nAre you normalizing your data?   \n",
          "votes": -6
        },
        {
          "id": 263967,
          "postDate": "2018-01-01T20:47:32.450Z",
          "content": "<p>I wouldn't recommend using Dropout at the softmax layer. </p>",
          "rawMarkdown": "I wouldn't recommend using Dropout at the softmax layer. ",
          "votes": 7
        },
        {
          "id": 263970,
          "postDate": "2018-01-01T20:57:13.907Z",
          "content": "<p>Thank you for your comment, but I know what I am doing. </p>",
          "rawMarkdown": "Thank you for your comment, but I know what I am doing. ",
          "votes": -22
        },
        {
          "id": 263973,
          "postDate": "2018-01-01T21:08:40.180Z",
          "content": "<p>Sure. Using dropout before the softmax layer will simply discard x% of the information used to predict the labels (where x is the dropout probability/rate).</p>\n\n<p>Multiple sources to attest this:</p>\n\n<p><a href=\"https://stats.stackexchange.com/questions/299292/dropout-makes-performance-worse\">https://stats.stackexchange.com/questions/299292/dropout-makes-performance-worse</a></p>\n\n<p><a href=\"https://stackoverflow.com/questions/40426737/where-to-add-dropout-in-neural-network\">https://stackoverflow.com/questions/40426737/where-to-add-dropout-in-neural-network</a></p>",
          "rawMarkdown": "Sure. Using dropout before the softmax layer will simply discard x% of the information used to predict the labels (where x is the dropout probability/rate).\n\nMultiple sources to attest this:\n\nhttps://stats.stackexchange.com/questions/299292/dropout-makes-performance-worse\n\nhttps://stackoverflow.com/questions/40426737/where-to-add-dropout-in-neural-network\n",
          "votes": 12
        },
        {
          "id": 263975,
          "postDate": "2018-01-01T21:29:56.747Z",
          "content": "<p>Thanks again for your comments.  I generally don't like to be harassed in Kaggle, but when I do, I prefer to be harassed by someone out-performing me in the competition.</p>",
          "rawMarkdown": "Thanks again for your comments.  I generally don't like to be harassed in Kaggle, but when I do, I prefer to be harassed by someone out-performing me in the competition.",
          "votes": -35
        },
        {
          "id": 263979,
          "postDate": "2018-01-01T21:59:42.883Z",
          "content": "<p>Ah :). The age when sharing advice and expertise is 'harassment'. We've reached peak Trump in 2018 already..</p>",
          "rawMarkdown": "Ah :). The age when sharing advice and expertise is 'harassment'. We've reached peak Trump in 2018 already..",
          "votes": 9
        },
        {
          "id": 263984,
          "postDate": "2018-01-01T22:36:36.510Z",
          "content": "<p>Thank you for your reply.  Your comments are noted and will be given the appropriate amount of attention.  </p>",
          "rawMarkdown": "Thank you for your reply.  Your comments are noted and will be given the appropriate amount of attention.  ",
          "votes": -28
        },
        {
          "id": 264057,
          "postDate": "2018-01-02T05:30:30.023Z",
          "content": "<ol>\n<li>My steps for dats pre processing-</li>\n<li>randomly pic an image for a given camear model and randomly pic patch size of 224x224</li>\n<li><p>random data augmentation/transformation- flip/gamma/rot</p></li>\n<li><p>Patch = patch - { avg of RGB across all the training data}  channel wise</p></li>\n<li>scale it , patch = patch/255 ( -1 to 1 - data range )</li>\n</ol>\n\n<p>This patch goes to model...so No normalization in term of bringing data between 0-1.</p>",
          "rawMarkdown": " 1.  My steps for dats pre processing-\n 2. randomly pic an image for a given camear model and randomly pic patch size of 224x224\n 3. random data augmentation/transformation- flip/gamma/rot\n \n 4. Patch = patch - { avg of RGB across all the training data}  channel wise\n 5. scale it , patch = patch/255 ( -1 to 1 - data range )\n\nThis patch goes to model...so No normalization in term of bringing data between 0-1."
        },
        {
          "id": 268107,
          "postDate": "2018-01-13T11:04:38.183Z",
          "content": "<p>Don't normalise/scale the images - I also fell into that trap... If you are using ResNet in Keras, it expects the images \"as they are\"</p>",
          "rawMarkdown": "Don't normalise/scale the images - I also fell into that trap... If you are using ResNet in Keras, it expects the images \"as they are\"",
          "votes": 1
        },
        {
          "id": 268215,
          "postDate": "2018-01-13T19:44:53.860Z",
          "content": "<p>Out of curiosity (not using ResNet), where did you find this information ?</p>",
          "rawMarkdown": "Out of curiosity (not using ResNet), where did you find this information ?"
        },
        {
          "id": 268216,
          "postDate": "2018-01-13T20:04:27.793Z",
          "content": "<p>trial and error + a hint in this keras thread where someone said \"Probably uint8 rgb images unless specified otherwise.\"</p>\n\n<p><a href=\"https://github.com/keras-team/keras/issues/5154\">https://github.com/keras-team/keras/issues/5154</a></p>\n\n<p>but yes, mostly trial and error...</p>",
          "rawMarkdown": "trial and error + a hint in this keras thread where someone said \"Probably uint8 rgb images unless specified otherwise.\"\n\nhttps://github.com/keras-team/keras/issues/5154\n\nbut yes, mostly trial and error...",
          "votes": 1
        },
        {
          "id": 275676,
          "postDate": "2018-01-29T19:17:41.320Z",
          "content": "<p>The source code for pretrained models is actually available on github. You can check it for yourself instead of making guesses. ResNet50 model in keras was converted from weights trained using caffee and its input has to be normalized. Every model in keras.applications supplies a <code>preprocess_input</code> function which adjusts your images according to the demands of a particular model.</p>",
          "rawMarkdown": "The source code for pretrained models is actually available on github. You can check it for yourself instead of making guesses. ResNet50 model in keras was converted from weights trained using caffee and its input has to be normalized. Every model in keras.applications supplies a `preprocess_input` function which adjusts your images according to the demands of a particular model."
        }
      ]
    },
    {
      "id": 263652,
      "postDate": "2017-12-31T07:01:59.257Z",
      "content": "<p>Share some of my experiments here.</p>\n\n<ol>\n<li>I implemented all the manipulations on the cropped images and used them for training.</li>\n<li>Validation split 0.2, Simple CNN trained 100 epochs had 26% on LB. (Validation acc = 67%)</li>\n<li>Transfer learning with ResNet50, trained 100 epochs had 33% on LB. (Validation acc = 96%)</li>\n</ol>\n\n<p>I have no clue why there is a huge gap between validation and LB. :(</p>",
      "rawMarkdown": "Share some of my experiments here.\n\n 1. I implemented all the manipulations on the cropped images and used them for training.\n 2. Validation split 0.2, Simple CNN trained 100 epochs had 26% on LB. (Validation acc = 67%)\n 3. Transfer learning with ResNet50, trained 100 epochs had 33% on LB. (Validation acc = 96%)\n\nI have no clue why there is a huge gap between validation and LB. :(",
      "replies": [
        {
          "id": 263682,
          "postDate": "2017-12-31T11:16:44Z",
          "content": "<p>I implemented the manipulations on training images and still processing to see if this improves results. I am wondering how you're cropping because from what I see, it makes a big difference in LB score.</p>",
          "rawMarkdown": "I implemented the manipulations on training images and still processing to see if this improves results. I am wondering how you're cropping because from what I see, it makes a big difference in LB score.",
          "votes": 1
        },
        {
          "id": 263767,
          "postDate": "2017-12-31T20:12:42.847Z",
          "content": "<p>I cropped from the center of the image as described on the data. I tried cropping all patches from the image, but it didn't seem to be effective for LB score.</p>",
          "rawMarkdown": "I cropped from the center of the image as described on the data. I tried cropping all patches from the image, but it didn't seem to be effective for LB score."
        }
      ]
    },
    {
      "id": 263035,
      "postDate": "2017-12-28T18:55:15.053Z",
      "content": "<p>When you say huge mismatch between validation and LB, which one is higher/lower?\nI'm getting on LB about half of what I get on my validation...\n(and yes, I know the test set includes image manipulations)</p>",
      "rawMarkdown": "When you say huge mismatch between validation and LB, which one is higher/lower?\nI'm getting on LB about half of what I get on my validation...\n(and yes, I know the test set includes image manipulations)",
      "replies": [
        {
          "id": 263039,
          "postDate": "2017-12-28T19:03:25.867Z",
          "content": "<p>Validation 97% acc, LB 82% </p>",
          "rawMarkdown": "Validation 97% acc, LB 82% ",
          "votes": 1
        },
        {
          "id": 263040,
          "postDate": "2017-12-28T19:08:16.730Z",
          "content": "<p>That's not bad at all... hope to get there some day ;-)\nMy last submission was ~0.65 on validation, ~0.35 on LB.</p>",
          "rawMarkdown": "That's not bad at all... hope to get there some day ;-)\nMy last submission was ~0.65 on validation, ~0.35 on LB.",
          "votes": 2
        }
      ]
    },
    {
      "id": 263188,
      "postDate": "2017-12-29T07:38:57.107Z",
      "rawMarkdown": "",
      "isDeleted": true,
      "replies": [
        {
          "id": 263231,
          "postDate": "2017-12-29T11:03:24.617Z",
          "content": "<p>I assume this is to get chunks of images ? </p>\n\n<p>I cast the pil image object as a numpy array and then use array slicing to get chunk\nYou can use pil fromarray if you wanna save it afterwords</p>",
          "rawMarkdown": "I assume this is to get chunks of images ? \n\nI cast the pil image object as a numpy array and then use array slicing to get chunk\nYou can use pil fromarray if you wanna save it afterwords"
        }
      ]
    }
  ],
  "comments": [
    {
      "id": 263078,
      "author_name": "Bruner Consulting",
      "author_url": "",
      "post_date": "2017-12-28T21:37:47.893000",
      "content": "<p>I am seeing similar things. (validation 97, Test 80)  My theory is that the modified images in the test set is dragging down the total score.  I am using a variety of Xfr learning and averaging.  I found that center patches seem to work the best.</p>",
      "votes": 1,
      "replies": [
        {
          "id": 263093,
          "author_name": "CVxTz",
          "author_url": "",
          "post_date": "2017-12-28T22:04:40.120000",
          "content": "<p>What is Xfr learning ?</p>",
          "votes": 1,
          "replies": []
        },
        {
          "id": 263096,
          "author_name": "Bruner Consulting",
          "author_url": "",
          "post_date": "2017-12-28T22:12:20.993000",
          "content": "<p>Transfer learning.  You take a pretrained deep network (ResNet, Inception) and attach your own end layer.  <a href=\"https://machinelearningmastery.com/transfer-learning-for-deep-learning/\">https://machinelearningmastery.com/transfer-learning-for-deep-learning/</a>.  Useful when you don't have a lot of training data.</p>",
          "votes": -3,
          "replies": []
        },
        {
          "id": 263099,
          "author_name": "CVxTz",
          "author_url": "",
          "post_date": "2017-12-28T22:17:07.580000",
          "content": "<p>Oh Yeah I get it ! I am doing the same </p>",
          "votes": 0,
          "replies": []
        },
        {
          "id": 268023,
          "author_name": "newlifer",
          "author_url": "",
          "post_date": "2018-01-13T02:54:53.910000",
          "content": "<p>does it work in this task? i thought that it only works for similiar tasks. - -|</p>",
          "votes": -1,
          "replies": []
        }
      ]
    },
    {
      "id": 263495,
      "author_name": "Ali Sharaf",
      "author_url": "",
      "post_date": "2017-12-30T13:21:20.403000",
      "content": "<p>I split all training images into 512x512 then resized all to 256x256 (similar approach used to feed test into the model). Getting &gt; 90% validation but on test goes almost half. I am assuming it's due to altered images... I tried setting all altered images to one category and the score goes down just a little.</p>",
      "votes": 1,
      "replies": []
    },
    {
      "id": 263384,
      "author_name": "Abdul Muntakim Rafi",
      "author_url": "",
      "post_date": "2017-12-30T00:27:15.927000",
      "content": "<p>CVxTz in your approach How can you be sure that your model isn't just detecting objects that are same in training data and testing data... </p>",
      "votes": 1,
      "replies": [
        {
          "id": 263486,
          "author_name": "CVxTz",
          "author_url": "",
          "post_date": "2017-12-30T12:29:57.480000",
          "content": "<p>Images in the train are not in the validation set.</p>",
          "votes": 0,
          "replies": []
        },
        {
          "id": 263493,
          "author_name": "Craig Glastonbury",
          "author_url": "",
          "post_date": "2017-12-30T13:17:43.923000",
          "content": "<p>For this to be the case, there would have to be objects specific to photos taken on a single phone model. I.e. All Samsung Galaxy S6 photos having dogs in them.</p>",
          "votes": 0,
          "replies": []
        }
      ]
    },
    {
      "id": 262992,
      "author_name": "Craig Glastonbury",
      "author_url": "",
      "post_date": "2017-12-28T15:03:28.643000",
      "content": "<p>Similar approach but no ensembl model yet. </p>",
      "votes": 1,
      "replies": []
    },
    {
      "id": 263235,
      "author_name": "Uday Kamal",
      "author_url": "",
      "post_date": "2017-12-29T11:30:53.453000",
      "content": "<p>We have the same issue. There might be another case, which is, in the test dataset, all the images are captured from another devices (but the models are same). So there is a high possibility that deep cnns are learning the device specific PRNU noises.</p>",
      "votes": 2,
      "replies": [
        {
          "id": 263238,
          "author_name": "CVxTz",
          "author_url": "",
          "post_date": "2017-12-29T11:36:00",
          "content": "<p>I had the same doubts so I asked this question in the Presentation thread but the organizers did not answer </p>",
          "votes": 0,
          "replies": []
        },
        {
          "id": 265300,
          "author_name": "Xiangyi Yan",
          "author_url": "",
          "post_date": "2018-01-05T04:47:09.330000",
          "content": "<p>Have any thoughts about improving this situation?</p>",
          "votes": 0,
          "replies": []
        },
        {
          "id": 265336,
          "author_name": "",
          "author_url": "",
          "post_date": "2018-01-05T08:39:46.087000",
          "content": "",
          "votes": 0,
          "replies": []
        },
        {
          "id": 265354,
          "author_name": "Xiangyi Yan",
          "author_url": "",
          "post_date": "2018-01-05T09:57:29.353000",
          "content": "<p>I don't think purely ensembling might help a lot. The variance between test set and validation set is too large.</p>",
          "votes": 0,
          "replies": []
        }
      ]
    },
    {
      "id": 263789,
      "author_name": "Bruner Consulting",
      "author_url": "",
      "post_date": "2017-12-31T22:35:45.113000",
      "content": "<p>I've been running some tests on data \"out in the wild\" (images from the web).  Even though my current model has a 99% validation accuracy, these get correctly identified around 20-30% of the time.  </p>\n\n<p>As another test, I sent 10 images from the training set through \"google hangouts\" and none of the resulting images get correctly classified.  Looking at the jpeg headers for these failing images, I notice that the quality is reduced to 90%.  However, if I perform the same operation manually (Image.save), I still can identify the resulting images.</p>\n\n<p>I have an old Note 3 and about 90% of these images get correctly classified unless they are sent through google hangout.</p>\n\n<p>I suspect that we probably need to augment the training set with additional images from other sources or reprocessed training files.  too bad ImageDataGenerator doesn't have a \"Google Hangouts\" operator ;)</p>",
      "votes": -2,
      "replies": []
    },
    {
      "id": 263301,
      "author_name": "moonforsun",
      "author_url": "",
      "post_date": "2017-12-29T17:19:41.973000",
      "content": "<p>Does anyone have any advice for processing the JPGs in R to get them to a 'model ready' state?</p>",
      "votes": -1,
      "replies": []
    },
    {
      "id": 265695,
      "author_name": "SumitJha",
      "author_url": "",
      "post_date": "2018-01-06T10:10:50.987000",
      "content": "<p>Hi All,\nI am doing transfer learning for RESNET50. I have modified  FC layers-</p>\n\n<pre><code>x = resnet_model.output\nx = Flatten()(x)\nx = Dropout(0.3)(x)\nx = Dense(1024,name='FCL1_1024')(x)\n#x = BatchNormalization()(x)\nx = Dropout(0.3)(x)\nx = Dense(num_class,activation ='sigmoid',name='Class_out')(x)\n</code></pre>\n\n<p>I have my own patch generation code and  random_transform. But even after  20 epochs I am not seeing any improvement in  val_loss/val_acc  --see in the image-</p>\n\n<p>Plz suggest, what could be the reason for this.</p>",
      "votes": 0,
      "replies": [
        {
          "id": 265709,
          "author_name": "",
          "author_url": "",
          "post_date": "2018-01-06T11:42:46.963000",
          "content": "",
          "votes": 0,
          "replies": []
        },
        {
          "id": 265721,
          "author_name": "",
          "author_url": "",
          "post_date": "2018-01-06T12:23:58.950000",
          "content": "<p>Just guessing as your splitting code is not there.. Have you shuffled the data?</p>",
          "votes": 0,
          "replies": []
        },
        {
          "id": 265731,
          "author_name": "Craig Glastonbury",
          "author_url": "",
          "post_date": "2018-01-06T13:17:50.327000",
          "content": "<p>You're using sigmoid, which is good for binary classification, not multiclass. Change to:</p>\n\n<p><code>x = Dense(num_class,activation =\"softmax\",name=\"Class_out\")(x)</code></p>",
          "votes": 0,
          "replies": []
        }
      ]
    },
    {
      "id": 264299,
      "author_name": "Esther L.",
      "author_url": "",
      "post_date": "2018-01-02T18:51:02.353000",
      "content": "<p>I'm using a mix of features + a random forest classifier, which has the same mismatch between validation and LB, but at a much lower score. Just to get a better idea of approach preferences, I'm curious if anyone in the top 25 is not using a deep learning model?</p>",
      "votes": 0,
      "replies": [
        {
          "id": 264514,
          "author_name": "",
          "author_url": "",
          "post_date": "2018-01-03T09:22:59.630000",
          "content": "<blockquote>\n  <p>I'm curious if anyone in the top 25 is not using a deep learning model?</p>\n</blockquote>\n\n<p>Yes, almost all of them. </p>\n\n<blockquote>\n  <p>not </p>\n</blockquote>\n\n<p>Oh. :D</p>",
          "votes": -1,
          "replies": []
        }
      ]
    },
    {
      "id": 263864,
      "author_name": "SumitJha",
      "author_url": "",
      "post_date": "2018-01-01T11:55:20.510000",
      "content": "<p>Hi All,\nI am facing an issue, I have started training  RESNET18 from scratch. I have written my own data augmentation which randomly picks an image from given Camera model and randomly extract a patch (64x64x3,224x224x3).\nMy training details for resnet18:\npatch size- 64x64x3\nBatch_size = 32![enter image description here][1]\nbatch_per_epoch = 512\nOptimizer- sdg,lr= 0.01</p>\n\n<p>Even after 30 epochs, I am seeing  validation loss = 1.90 (started from 3.3) and accuracy- 30% ( started from 9%). After I am not seeing any improvement. Can you suggest what is the issue? With this model, my score is 0.209.</p>\n\n<p>Also, I am trying transfer learning with RESNET 50 which 2 change- Num class =10 and making 'Activation_43' to FC trainable and other layers untrainable.</p>\n\n<p>Details of training-\npatch size- 224x224x3\nBatch_size = 128\nbatch_per_epoch = 15\nOptimizer- adadelta,</p>\n\n<p>Even with this, I am seeing very poor validation accuracy even though traing accuracy is jumping up but in very oscilating manner. Plz see the graphs of tensorbaords.</p>\n\n<p>If you guys have any suggestion then plz suggest it.</p>",
      "votes": 0,
      "replies": [
        {
          "id": 263911,
          "author_name": "Bruner Consulting",
          "author_url": "",
          "post_date": "2018-01-01T15:30:00.887000",
          "content": "<p>What do your final layers look like?  Are you taking the output of the ResNet directly into the softmax layer?  Often I will put an intermediate layer between the output layer.   I then add dropout as needed to reduce overfitting. \n Here is some psudo Keras code:</p>\n\n<pre><code>x = ResNet.output \nx = GlobalAverage2D()(x)\nx = Dense(128) (x)\nx = BatchNormalization(x)\nx = Dropout(0.1)(x)\nx = Dense(10)(x)\nx = Dropout(0.1)(x)\npredictions = Activation('softmax')(x)\n</code></pre>\n\n<p>That's a pretty high learning rate.  When I do transfer learning, I first turn off all the training in the model I am using (In your case ResNet) and train at an LR of 1e-3 (sometimes I will do annealing).  Once I am happy with the results (I find val_acc at around 60%) I will open up the other layers and start training at LR of 1 e-4.</p>",
          "votes": -3,
          "replies": []
        },
        {
          "id": 263954,
          "author_name": "SumitJha",
          "author_url": "",
          "post_date": "2018-01-01T19:52:25.193000",
          "content": "<p>Hi, \nI am follwoing exactly same approch what you have suggested. However there is mis-match in model.\nThe very first time I have strated with adding 2 drop-out layers as follows-</p>\n\n<pre><code>   x = resnet_model.output #after Avg pooling layer\nx = Flatten()(x) #2048 vector-RESNET 50\nx = Dense(1024,name='FCL1_1024')(x)\nx = BatchNormalization()(x)\nx = Dropout(0.3)(x)\nx = Dense(num_class,activation ='sigmoid',name='Class_out')(x)\n</code></pre>\n\n<p>I was  training on this layers and all others were fixed. I have seen that even after 15 epochs error and accuracy for both -Training/Validation- was not improving much - Training Accuracy-12%, Valid Accu-10%. So, I have stopped training process.</p>\n\n<p>With the latest model, which is currently being trained I have used only-</p>\n\n<pre><code>    x = resnet_model.output #after Avg pooling layer\nx = Flatten()(x) #2048 vector-RESNET 50\nx = Dense(num_class,activation ='sigmoid',name='Class_out')(x)\n</code></pre>\n\n<p>Trained this for 15 epochs- Train_Acc=20-22%, Valid_Accu=10%, I have stopped this and loaded model with this step and made top-2 convolution block trainable. </p>\n\n<p>Current status aftre 18epochs-{128-batch size, 15_batch_per epoch} Training accuracy-40% but validation Accuarcy-10% (same).</p>\n\n<p>The pattern of training accuracy plot follows same as I have sent in the last image..it is periodic..not monotonically increasing/decreasing.</p>\n\n<p>Btw, why are you adding drop-out to the final output of 10 class-</p>\n\n<pre><code>x = Dense(10)(x)\n **x = Dropout(0.1)(x)**\n  predictions = Activation('softmax')(x)\n</code></pre>\n\n<p>Suggest if you have any clue on this. Btw are you training resnet18 or 50 ?</p>",
          "votes": 0,
          "replies": []
        },
        {
          "id": 263961,
          "author_name": "Bruner Consulting",
          "author_url": "",
          "post_date": "2018-01-01T20:22:16.650000",
          "content": "<p>I used ResNet 50.  My last run with ResNet (256x256) was:\nTraining loss 0.0366\nTraining accuracy: 0.991\nVal loss:  0.355\nVal acc:  0.909</p>\n\n<p>Leaderboard submission:  0.742 (Not one of my best models)</p>\n\n<p>I use multiple layers at the end to have better control overfitting.  ResNet has a tendency to overfit compared to other models. So I almost always use dropout, even at the softmax layer.\nGenerally, I train these models for quite a while (100 + epochs) with fine tuning LR as low as 1e-5.</p>\n\n<p>Are you normalizing your data?   </p>",
          "votes": -6,
          "replies": []
        },
        {
          "id": 263967,
          "author_name": "Craig Glastonbury",
          "author_url": "",
          "post_date": "2018-01-01T20:47:32.450000",
          "content": "<p>I wouldn't recommend using Dropout at the softmax layer. </p>",
          "votes": 7,
          "replies": []
        },
        {
          "id": 263970,
          "author_name": "Bruner Consulting",
          "author_url": "",
          "post_date": "2018-01-01T20:57:13.907000",
          "content": "<p>Thank you for your comment, but I know what I am doing. </p>",
          "votes": -22,
          "replies": []
        },
        {
          "id": 263973,
          "author_name": "Craig Glastonbury",
          "author_url": "",
          "post_date": "2018-01-01T21:08:40.180000",
          "content": "<p>Sure. Using dropout before the softmax layer will simply discard x% of the information used to predict the labels (where x is the dropout probability/rate).</p>\n\n<p>Multiple sources to attest this:</p>\n\n<p><a href=\"https://stats.stackexchange.com/questions/299292/dropout-makes-performance-worse\">https://stats.stackexchange.com/questions/299292/dropout-makes-performance-worse</a></p>\n\n<p><a href=\"https://stackoverflow.com/questions/40426737/where-to-add-dropout-in-neural-network\">https://stackoverflow.com/questions/40426737/where-to-add-dropout-in-neural-network</a></p>",
          "votes": 12,
          "replies": []
        },
        {
          "id": 263975,
          "author_name": "Bruner Consulting",
          "author_url": "",
          "post_date": "2018-01-01T21:29:56.747000",
          "content": "<p>Thanks again for your comments.  I generally don't like to be harassed in Kaggle, but when I do, I prefer to be harassed by someone out-performing me in the competition.</p>",
          "votes": -35,
          "replies": []
        },
        {
          "id": 263979,
          "author_name": "Craig Glastonbury",
          "author_url": "",
          "post_date": "2018-01-01T21:59:42.883000",
          "content": "<p>Ah :). The age when sharing advice and expertise is 'harassment'. We've reached peak Trump in 2018 already..</p>",
          "votes": 9,
          "replies": []
        },
        {
          "id": 263984,
          "author_name": "Bruner Consulting",
          "author_url": "",
          "post_date": "2018-01-01T22:36:36.510000",
          "content": "<p>Thank you for your reply.  Your comments are noted and will be given the appropriate amount of attention.  </p>",
          "votes": -28,
          "replies": []
        },
        {
          "id": 264057,
          "author_name": "SumitJha",
          "author_url": "",
          "post_date": "2018-01-02T05:30:30.023000",
          "content": "<ol>\n<li>My steps for dats pre processing-</li>\n<li>randomly pic an image for a given camear model and randomly pic patch size of 224x224</li>\n<li><p>random data augmentation/transformation- flip/gamma/rot</p></li>\n<li><p>Patch = patch - { avg of RGB across all the training data}  channel wise</p></li>\n<li>scale it , patch = patch/255 ( -1 to 1 - data range )</li>\n</ol>\n\n<p>This patch goes to model...so No normalization in term of bringing data between 0-1.</p>",
          "votes": 0,
          "replies": []
        },
        {
          "id": 268107,
          "author_name": "nkroher",
          "author_url": "",
          "post_date": "2018-01-13T11:04:38.183000",
          "content": "<p>Don't normalise/scale the images - I also fell into that trap... If you are using ResNet in Keras, it expects the images \"as they are\"</p>",
          "votes": 1,
          "replies": []
        },
        {
          "id": 268215,
          "author_name": "Max",
          "author_url": "",
          "post_date": "2018-01-13T19:44:53.860000",
          "content": "<p>Out of curiosity (not using ResNet), where did you find this information ?</p>",
          "votes": 0,
          "replies": []
        },
        {
          "id": 268216,
          "author_name": "nkroher",
          "author_url": "",
          "post_date": "2018-01-13T20:04:27.793000",
          "content": "<p>trial and error + a hint in this keras thread where someone said \"Probably uint8 rgb images unless specified otherwise.\"</p>\n\n<p><a href=\"https://github.com/keras-team/keras/issues/5154\">https://github.com/keras-team/keras/issues/5154</a></p>\n\n<p>but yes, mostly trial and error...</p>",
          "votes": 1,
          "replies": []
        },
        {
          "id": 275676,
          "author_name": "Maksym Pyrozhok",
          "author_url": "",
          "post_date": "2018-01-29T19:17:41.320000",
          "content": "<p>The source code for pretrained models is actually available on github. You can check it for yourself instead of making guesses. ResNet50 model in keras was converted from weights trained using caffee and its input has to be normalized. Every model in keras.applications supplies a <code>preprocess_input</code> function which adjusts your images according to the demands of a particular model.</p>",
          "votes": 0,
          "replies": []
        }
      ]
    },
    {
      "id": 263652,
      "author_name": "Shunjia Ding",
      "author_url": "",
      "post_date": "2017-12-31T07:01:59.257000",
      "content": "<p>Share some of my experiments here.</p>\n\n<ol>\n<li>I implemented all the manipulations on the cropped images and used them for training.</li>\n<li>Validation split 0.2, Simple CNN trained 100 epochs had 26% on LB. (Validation acc = 67%)</li>\n<li>Transfer learning with ResNet50, trained 100 epochs had 33% on LB. (Validation acc = 96%)</li>\n</ol>\n\n<p>I have no clue why there is a huge gap between validation and LB. :(</p>",
      "votes": 0,
      "replies": [
        {
          "id": 263682,
          "author_name": "Ali Sharaf",
          "author_url": "",
          "post_date": "2017-12-31T11:16:44",
          "content": "<p>I implemented the manipulations on training images and still processing to see if this improves results. I am wondering how you're cropping because from what I see, it makes a big difference in LB score.</p>",
          "votes": 1,
          "replies": []
        },
        {
          "id": 263767,
          "author_name": "Shunjia Ding",
          "author_url": "",
          "post_date": "2017-12-31T20:12:42.847000",
          "content": "<p>I cropped from the center of the image as described on the data. I tried cropping all patches from the image, but it didn't seem to be effective for LB score.</p>",
          "votes": 0,
          "replies": []
        }
      ]
    },
    {
      "id": 263035,
      "author_name": "Diogo R. Ferreira",
      "author_url": "",
      "post_date": "2017-12-28T18:55:15.053000",
      "content": "<p>When you say huge mismatch between validation and LB, which one is higher/lower?\nI'm getting on LB about half of what I get on my validation...\n(and yes, I know the test set includes image manipulations)</p>",
      "votes": 0,
      "replies": [
        {
          "id": 263039,
          "author_name": "CVxTz",
          "author_url": "",
          "post_date": "2017-12-28T19:03:25.867000",
          "content": "<p>Validation 97% acc, LB 82% </p>",
          "votes": 1,
          "replies": []
        },
        {
          "id": 263040,
          "author_name": "Diogo R. Ferreira",
          "author_url": "",
          "post_date": "2017-12-28T19:08:16.730000",
          "content": "<p>That's not bad at all... hope to get there some day ;-)\nMy last submission was ~0.65 on validation, ~0.35 on LB.</p>",
          "votes": 2,
          "replies": []
        }
      ]
    },
    {
      "id": 263188,
      "author_name": "",
      "author_url": "",
      "post_date": "2017-12-29T07:38:57.107000",
      "content": "",
      "votes": 0,
      "replies": [
        {
          "id": 263231,
          "author_name": "CVxTz",
          "author_url": "",
          "post_date": "2017-12-29T11:03:24.617000",
          "content": "<p>I assume this is to get chunks of images ? </p>\n\n<p>I cast the pil image object as a numpy array and then use array slicing to get chunk\nYou can use pil fromarray if you wanna save it afterwords</p>",
          "votes": 0,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "262984": "Hello ! \nSince this is definitely an odd problem I am very curious about what approaches are other kagglers using to solve it.\n\nI'll start with myself : I am using an average of multiple architectures of deep CNNs ( like the kernel I shared ) applied to small crops of the training images, though I am not really sure what the models are learning exactly and I have a huge score mismatch between Validation and LB that I can't explain.\n\nAre there people using other types of methods ? \n",
    "263078": "I am seeing similar things. (validation 97, Test 80)  My theory is that the modified images in the test set is dragging down the total score.  I am using a variety of Xfr learning and averaging.  I found that center patches seem to work the best.",
    "263495": "I split all training images into 512x512 then resized all to 256x256 (similar approach used to feed test into the model). Getting &gt; 90% validation but on test goes almost half. I am assuming it's due to altered images... I tried setting all altered images to one category and the score goes down just a little.",
    "263384": "CVxTz in your approach How can you be sure that your model isn't just detecting objects that are same in training data and testing data... ",
    "262992": "Similar approach but no ensembl model yet. ",
    "263235": "We have the same issue. There might be another case, which is, in the test dataset, all the images are captured from another devices (but the models are same). So there is a high possibility that deep cnns are learning the device specific PRNU noises.\n ",
    "263789": "I've been running some tests on data \"out in the wild\" (images from the web).  Even though my current model has a 99% validation accuracy, these get correctly identified around 20-30% of the time.  \n\nAs another test, I sent 10 images from the training set through \"google hangouts\" and none of the resulting images get correctly classified.  Looking at the jpeg headers for these failing images, I notice that the quality is reduced to 90%.  However, if I perform the same operation manually (Image.save), I still can identify the resulting images.\n\nI have an old Note 3 and about 90% of these images get correctly classified unless they are sent through google hangout.\n\nI suspect that we probably need to augment the training set with additional images from other sources or reprocessed training files.  too bad ImageDataGenerator doesn't have a \"Google Hangouts\" operator ;)",
    "263301": "Does anyone have any advice for processing the JPGs in R to get them to a 'model ready' state?",
    "265695": "Hi All,\nI am doing transfer learning for RESNET50. I have modified  FC layers-\n\n    x = resnet_model.output\n\tx = Flatten()(x)\n\tx = Dropout(0.3)(x)\n\tx = Dense(1024,name='FCL1_1024')(x)\n\t#x = BatchNormalization()(x)\n\tx = Dropout(0.3)(x)\n\tx = Dense(num_class,activation ='sigmoid',name='Class_out')(x)\n\nI have my own patch generation code and  random_transform. But even after  20 epochs I am not seeing any improvement in  val_loss/val_acc  --see in the image-\n\nPlz suggest, what could be the reason for this.\n",
    "264299": "I'm using a mix of features + a random forest classifier, which has the same mismatch between validation and LB, but at a much lower score. Just to get a better idea of approach preferences, I'm curious if anyone in the top 25 is not using a deep learning model?",
    "263864": "Hi All,\nI am facing an issue, I have started training  RESNET18 from scratch. I have written my own data augmentation which randomly picks an image from given Camera model and randomly extract a patch (64x64x3,224x224x3).\nMy training details for resnet18:\npatch size- 64x64x3\nBatch_size = 32![enter image description here][1]\nbatch_per_epoch = 512\nOptimizer- sdg,lr= 0.01\n\nEven after 30 epochs, I am seeing  validation loss = 1.90 (started from 3.3) and accuracy- 30% ( started from 9%). After I am not seeing any improvement. Can you suggest what is the issue? With this model, my score is 0.209.\n\nAlso, I am trying transfer learning with RESNET 50 which 2 change- Num class =10 and making 'Activation_43' to FC trainable and other layers untrainable.\n\nDetails of training-\npatch size- 224x224x3\nBatch_size = 128\nbatch_per_epoch = 15\nOptimizer- adadelta,\n\nEven with this, I am seeing very poor validation accuracy even though traing accuracy is jumping up but in very oscilating manner. Plz see the graphs of tensorbaords.\n\nIf you guys have any suggestion then plz suggest it.\n\n\n\n\n ",
    "263652": "Share some of my experiments here.\n\n 1. I implemented all the manipulations on the cropped images and used them for training.\n 2. Validation split 0.2, Simple CNN trained 100 epochs had 26% on LB. (Validation acc = 67%)\n 3. Transfer learning with ResNet50, trained 100 epochs had 33% on LB. (Validation acc = 96%)\n\nI have no clue why there is a huge gap between validation and LB. :(",
    "263035": "When you say huge mismatch between validation and LB, which one is higher/lower?\nI'm getting on LB about half of what I get on my validation...\n(and yes, I know the test set includes image manipulations)",
    "263188": ""
  }
}