{
  "id": 41075,
  "title": "Preprocess input mode for pretrain Keras model",
  "url": "/competitions/cdiscount-image-classification-challenge/discussion/41075",
  "author_name": "",
  "post_date": "2017-10-12T10:41:37.427793200Z",
  "votes": 2,
  "comment_count": 5,
  "views": 0,
  "content": "<p>When using pretrain models with Keras there is two preprocessing mode (caffe (0-center each color channel) al and tensorflow(scale pixels between -1 and 1)).  Reading the last source of Keras applications it seems that only the tensorflow mode is used and there is nothing about preprocessing for VGG16, VGG19 and Resnet50 models. Does anyone know how to preprocess the input for the VGG16 or Resnet50 keras imagenet models? </p>",
  "messages": [
    {
      "id": "230619",
      "postDate": "10/12/2017 10:41:37",
      "content": "<p>When using pretrain models with Keras there is two preprocessing mode (caffe (0-center each color channel) al and tensorflow(scale pixels between -1 and 1)).  Reading the last source of Keras applications it seems that only the tensorflow mode is used and there is nothing about preprocessing for VGG16, VGG19 and Resnet50 models. Does anyone know how to preprocess the input for the VGG16 or Resnet50 keras imagenet models? </p>",
      "rawMarkdown": "When using pretrain models with Keras there is two preprocessing mode (caffe (0-center each color channel) al and tensorflow(scale pixels between -1 and 1)).  Reading the last source of Keras applications it seems that only the tensorflow mode is used and there is nothing about preprocessing for VGG16, VGG19 and Resnet50 models. Does anyone know how to preprocess the input for the VGG16 or Resnet50 keras imagenet models?",
      "votes": null
    },
    {
      "id": "230634",
      "postDate": "10/12/2017 11:16:56",
      "content": "<p>When using Pre-trained models there then there must be some techniques mentioned for Pre-processing . But if it isn't then Pre-processing depends on the input you are trying to feed into the model. Like, if you are using images then you should first try to model the noise in the input images . Once the noise is modeled then you can apply a certain filter to remove that noise.</p>",
      "rawMarkdown": "When using Pre-trained models there then there must be some techniques mentioned for Pre-processing . But if it isn't then Pre-processing depends on the input you are trying to feed into the model. Like, if you are using images then you should first try to model the noise in the input images . Once the noise is modeled then you can apply a certain filter to remove that noise.",
      "votes": null
    },
    {
      "id": "230635",
      "postDate": "10/12/2017 11:17:41",
      "content": "<p>For VGG16, VGG19 and Resnet50 models Keras 2 provides a preprocess_input function (look at the import section of the modules: from .imagenet_utils import preprocess_input)</p>",
      "rawMarkdown": "For VGG16, VGG19 and Resnet50 models Keras 2 provides a preprocess_input function (look at the import section of the modules: from .imagenet_utils import preprocess_input)",
      "votes": null
    },
    {
      "id": "232847",
      "postDate": "10/18/2017 15:29:09",
      "content": "<p>I am also using pretrained Keras models\nFor ResNet50, I preprocessed the input as in the 'caffe' mode, and for Xception / InceptionV3 I used 'tf' mode.</p>\n\n<p>However, both training and validation accuracy are much lower in the Xception / Inception models when compared to ResNet50, and I still cannot figure out why. Both models were trained in a similar way.</p>",
      "rawMarkdown": "I am also using pretrained Keras models\nFor ResNet50, I preprocessed the input as in the 'caffe' mode, and for Xception / InceptionV3 I used 'tf' mode.\n\nHowever, both training and validation accuracy are much lower in the Xception / Inception models when compared to ResNet50, and I still cannot figure out why. Both models were trained in a similar way.",
      "votes": null
    },
    {
      "id": "233595",
      "postDate": "10/20/2017 16:27:50",
      "content": "<p>I did not try RestNet50 yet, but training (last block only) and validation acuracy are very low for me using   Xception with tf mode (0.41 after 3 epochs ). I wonder if Xception, InceptionV3 require more fine tuning  than ResNet50. Did you try fine tuning Xception or you just give up seeing the low acuracy?\nDid you use keras.applications.resnet50 for ResNet50?</p>",
      "rawMarkdown": "I did not try RestNet50 yet, but training (last block only) and validation acuracy are very low for me using   Xception with tf mode (0.41 after 3 epochs ). I wonder if Xception, InceptionV3 require more fine tuning  than ResNet50. Did you try fine tuning Xception or you just give up seeing the low acuracy?\nDid you use keras.applications.resnet50 for ResNet50?",
      "votes": null
    },
    {
      "id": "233684",
      "postDate": "10/20/2017 20:37:51",
      "content": "<p>I am using ResNet50 provided in keras.applications. I compared it with Xception and InceptionV3 by training on a small subset (4%) of the data, with all convolutional layers frozen. Since both performed worse, I just gave up and proceeded with ResNet. When training with 80% of data, I was able to achieve 0.47 accuracy with Resnet50 by training 3 epochs.\nIt is possible that the problem is that they require more finetuning, but I did not have time to investigate it further.</p>",
      "rawMarkdown": "I am using ResNet50 provided in keras.applications. I compared it with Xception and InceptionV3 by training on a small subset (4%) of the data, with all convolutional layers frozen. Since both performed worse, I just gave up and proceeded with ResNet. When training with 80% of data, I was able to achieve 0.47 accuracy with Resnet50 by training 3 epochs.\nIt is possible that the problem is that they require more finetuning, but I did not have time to investigate it further.",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 230634,
      "author_name": "nauyan",
      "author_url": "",
      "post_date": "10/12/2017 11:16:56",
      "content": "<p>When using Pre-trained models there then there must be some techniques mentioned for Pre-processing . But if it isn't then Pre-processing depends on the input you are trying to feed into the model. Like, if you are using images then you should first try to model the noise in the input images . Once the noise is modeled then you can apply a certain filter to remove that noise.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 230635,
      "author_name": "roebius",
      "author_url": "",
      "post_date": "10/12/2017 11:17:41",
      "content": "<p>For VGG16, VGG19 and Resnet50 models Keras 2 provides a preprocess_input function (look at the import section of the modules: from .imagenet_utils import preprocess_input)</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 232847,
      "author_name": "menegaz",
      "author_url": "",
      "post_date": "10/18/2017 15:29:09",
      "content": "<p>I am also using pretrained Keras models\nFor ResNet50, I preprocessed the input as in the 'caffe' mode, and for Xception / InceptionV3 I used 'tf' mode.</p>\n\n<p>However, both training and validation accuracy are much lower in the Xception / Inception models when compared to ResNet50, and I still cannot figure out why. Both models were trained in a similar way.</p>",
      "votes": null,
      "replies": [
        {
          "id": 233595,
          "author_name": "pierretisseur",
          "author_url": "",
          "post_date": "10/20/2017 16:27:50",
          "content": "<p>I did not try RestNet50 yet, but training (last block only) and validation acuracy are very low for me using   Xception with tf mode (0.41 after 3 epochs ). I wonder if Xception, InceptionV3 require more fine tuning  than ResNet50. Did you try fine tuning Xception or you just give up seeing the low acuracy?\nDid you use keras.applications.resnet50 for ResNet50?</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 233684,
          "author_name": "menegaz",
          "author_url": "",
          "post_date": "10/20/2017 20:37:51",
          "content": "<p>I am using ResNet50 provided in keras.applications. I compared it with Xception and InceptionV3 by training on a small subset (4%) of the data, with all convolutional layers frozen. Since both performed worse, I just gave up and proceeded with ResNet. When training with 80% of data, I was able to achieve 0.47 accuracy with Resnet50 by training 3 epochs.\nIt is possible that the problem is that they require more finetuning, but I did not have time to investigate it further.</p>",
          "votes": null,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "230619": "When using pretrain models with Keras there is two preprocessing mode (caffe (0-center each color channel) al and tensorflow(scale pixels between -1 and 1)).  Reading the last source of Keras applications it seems that only the tensorflow mode is used and there is nothing about preprocessing for VGG16, VGG19 and Resnet50 models. Does anyone know how to preprocess the input for the VGG16 or Resnet50 keras imagenet models?",
    "230634": "When using Pre-trained models there then there must be some techniques mentioned for Pre-processing . But if it isn't then Pre-processing depends on the input you are trying to feed into the model. Like, if you are using images then you should first try to model the noise in the input images . Once the noise is modeled then you can apply a certain filter to remove that noise.",
    "230635": "For VGG16, VGG19 and Resnet50 models Keras 2 provides a preprocess_input function (look at the import section of the modules: from .imagenet_utils import preprocess_input)",
    "232847": "I am also using pretrained Keras models\nFor ResNet50, I preprocessed the input as in the 'caffe' mode, and for Xception / InceptionV3 I used 'tf' mode.\n\nHowever, both training and validation accuracy are much lower in the Xception / Inception models when compared to ResNet50, and I still cannot figure out why. Both models were trained in a similar way.",
    "233595": "I did not try RestNet50 yet, but training (last block only) and validation acuracy are very low for me using   Xception with tf mode (0.41 after 3 epochs ). I wonder if Xception, InceptionV3 require more fine tuning  than ResNet50. Did you try fine tuning Xception or you just give up seeing the low acuracy?\nDid you use keras.applications.resnet50 for ResNet50?",
    "233684": "I am using ResNet50 provided in keras.applications. I compared it with Xception and InceptionV3 by training on a small subset (4%) of the data, with all convolutional layers frozen. Since both performed worse, I just gave up and proceeded with ResNet. When training with 80% of data, I was able to achieve 0.47 accuracy with Resnet50 by training 3 epochs.\nIt is possible that the problem is that they require more finetuning, but I did not have time to investigate it further."
  },
  "source": "meta"
}