{
  "id": 48680,
  "title": "Wrong orientation of images in test set",
  "url": "/competitions/sp-society-camera-model-identification/discussion/48680",
  "author_name": "",
  "post_date": "2018-01-31T12:39:18.558291100Z",
  "votes": 3,
  "comment_count": 2,
  "views": 0,
  "content": "<p>I've been visually exploring images in the test set and there's some of them whose orientation is clearly off, a non-exhaustive list:</p>\n\n<pre><code>img_020ef15_manip.tif\nimg_7eade12_unalt.tif\nimg_eadeeaf_manip.tif\nimg_2939ad8_manip.tif\nimg_d83300a_manip.tif\nimg_d52a9ca_manip.tif\nimg_d992917_unalt.tif\nimg_cdf07d5_unalt.tif\nimg_a277a40_manip.tif\nimg_acac997_manip.tif\nimg_4d7be4c_unalt.tif\nimg_4df3673_manip.tif\nimg_7331609_unalt.tif\nimg_626da37_unalt.tif\nimg_fe767fe_manip.tif\nimg_22132f6_unalt.tif\nimg_55112b6_manip.tif\nimg_bb1ff2b_manip.tif\nimg_640ca38_unalt.tif\nimg_f3667f9_unalt.tif\nimg_65d4e62_unalt.tif\nimg_cb670fb_unalt.tif\nimg_a1e79e3_unalt.tif\nimg_9fb1b20_unalt.tif\nimg_ef82596_manip.tif\nimg_176e031_unalt.tif\nimg_9a69164_unalt.tif\n</code></pre>\n\n<p>Running this command <code>parallel 'echo {};identify -verbose train/{}/* | grep \" Orientation\" | sort | uniq -c' ::: 'HTC-1-M7' 'LG-Nexus-5x' 'Motorola-Droid-Maxx' 'iPhone-4s' 'iPhone-6' 'Motorola-Nexus-6' 'Motorola-X' 'Samsung-Galaxy-Note3' 'Samsung-Galaxy-S4' 'Sony-NEX-7'</code> will report the orientation metadata in the JPEGs. </p>\n\n<pre><code>HTC-1-M7\n    275   Orientation: TopLeft\niPhone-6\n    273   Orientation: RightTop\n      2   Orientation: TopLeft\niPhone-4s\n    275   Orientation: RightTop\nSamsung-Galaxy-Note3\n    196   Orientation: RightTop\n     79   Orientation: TopLeft\nSamsung-Galaxy-S4\n    275   Orientation: RightTop\nMotorola-Droid-Maxx\n    275   Orientation: Undefined\nLG-Nexus-5x\n    275   Orientation: Undefined\nMotorola-Nexus-6\n      1   Orientation: LeftBottom\n    274   Orientation: TopLeft\nMotorola-X\n    275   Orientation: Undefined\nSony-NEX-7\n     35   Orientation: LeftBottom\n      3   Orientation: RightTop\n    237   Orientation: TopLeft\n</code></pre>\n\n<p>I believe the JPG -&gt; TIF converter or the RAW -&gt; TIF converter uses this or similar metadata to do its job and this could be the reason why some TIF images have the wrong orientation.</p>\n\n<p>Running an equivalente command to see resolutions: <code>parallel 'echo {};identify train/{}/* |egrep -o \"[0-9]+x[0-9]+ \" | sort | uniq -c' ::: 'HTC-1-M7' 'LG-Nexus-5x' 'Motorola-Droid-Maxx' 'iPhone-4s' 'iPhone-6' 'Motorola-Nexus-6' 'Motorola-X' 'Samsung-Galaxy-Note3' 'Samsung-Galaxy-S4' 'Sony-NEX-7</code> yields:</p>\n\n<pre><code>LG-Nexus-5x\n    272 3024x4032\n      3 4032x3024\nMotorola-Nexus-6\n      1 1040x780\n      1 3088x4130\n     15 3088x4160\n    128 3120x4160\n      9 4160x3088\n    121 4160x3120\niPhone-4s\n    275 3264x2448\nHTC-1-M7\n    254 1520x2688\n     21 2688x1520\niPhone-6\n    275 3264x2448\nSamsung-Galaxy-Note3\n    275 4128x2322\nSamsung-Galaxy-S4\n    275 4128x2322\nMotorola-Droid-Maxx\n     39 2432x4320\n    236 4320x2432\nMotorola-X\n     41 3120x4160\n    234 4160x3120\nSony-NEX-7\n    275 6000x4000\n</code></pre>\n\n<p>Any ideas?</p>",
  "messages": [
    {
      "id": "276407",
      "postDate": "01/31/2018 12:39:18",
      "content": "<p>I've been visually exploring images in the test set and there's some of them whose orientation is clearly off, a non-exhaustive list:</p>\n\n<pre><code>img_020ef15_manip.tif\nimg_7eade12_unalt.tif\nimg_eadeeaf_manip.tif\nimg_2939ad8_manip.tif\nimg_d83300a_manip.tif\nimg_d52a9ca_manip.tif\nimg_d992917_unalt.tif\nimg_cdf07d5_unalt.tif\nimg_a277a40_manip.tif\nimg_acac997_manip.tif\nimg_4d7be4c_unalt.tif\nimg_4df3673_manip.tif\nimg_7331609_unalt.tif\nimg_626da37_unalt.tif\nimg_fe767fe_manip.tif\nimg_22132f6_unalt.tif\nimg_55112b6_manip.tif\nimg_bb1ff2b_manip.tif\nimg_640ca38_unalt.tif\nimg_f3667f9_unalt.tif\nimg_65d4e62_unalt.tif\nimg_cb670fb_unalt.tif\nimg_a1e79e3_unalt.tif\nimg_9fb1b20_unalt.tif\nimg_ef82596_manip.tif\nimg_176e031_unalt.tif\nimg_9a69164_unalt.tif\n</code></pre>\n\n<p>Running this command <code>parallel 'echo {};identify -verbose train/{}/* | grep \" Orientation\" | sort | uniq -c' ::: 'HTC-1-M7' 'LG-Nexus-5x' 'Motorola-Droid-Maxx' 'iPhone-4s' 'iPhone-6' 'Motorola-Nexus-6' 'Motorola-X' 'Samsung-Galaxy-Note3' 'Samsung-Galaxy-S4' 'Sony-NEX-7'</code> will report the orientation metadata in the JPEGs. </p>\n\n<pre><code>HTC-1-M7\n    275   Orientation: TopLeft\niPhone-6\n    273   Orientation: RightTop\n      2   Orientation: TopLeft\niPhone-4s\n    275   Orientation: RightTop\nSamsung-Galaxy-Note3\n    196   Orientation: RightTop\n     79   Orientation: TopLeft\nSamsung-Galaxy-S4\n    275   Orientation: RightTop\nMotorola-Droid-Maxx\n    275   Orientation: Undefined\nLG-Nexus-5x\n    275   Orientation: Undefined\nMotorola-Nexus-6\n      1   Orientation: LeftBottom\n    274   Orientation: TopLeft\nMotorola-X\n    275   Orientation: Undefined\nSony-NEX-7\n     35   Orientation: LeftBottom\n      3   Orientation: RightTop\n    237   Orientation: TopLeft\n</code></pre>\n\n<p>I believe the JPG -&gt; TIF converter or the RAW -&gt; TIF converter uses this or similar metadata to do its job and this could be the reason why some TIF images have the wrong orientation.</p>\n\n<p>Running an equivalente command to see resolutions: <code>parallel 'echo {};identify train/{}/* |egrep -o \"[0-9]+x[0-9]+ \" | sort | uniq -c' ::: 'HTC-1-M7' 'LG-Nexus-5x' 'Motorola-Droid-Maxx' 'iPhone-4s' 'iPhone-6' 'Motorola-Nexus-6' 'Motorola-X' 'Samsung-Galaxy-Note3' 'Samsung-Galaxy-S4' 'Sony-NEX-7</code> yields:</p>\n\n<pre><code>LG-Nexus-5x\n    272 3024x4032\n      3 4032x3024\nMotorola-Nexus-6\n      1 1040x780\n      1 3088x4130\n     15 3088x4160\n    128 3120x4160\n      9 4160x3088\n    121 4160x3120\niPhone-4s\n    275 3264x2448\nHTC-1-M7\n    254 1520x2688\n     21 2688x1520\niPhone-6\n    275 3264x2448\nSamsung-Galaxy-Note3\n    275 4128x2322\nSamsung-Galaxy-S4\n    275 4128x2322\nMotorola-Droid-Maxx\n     39 2432x4320\n    236 4320x2432\nMotorola-X\n     41 3120x4160\n    234 4160x3120\nSony-NEX-7\n    275 6000x4000\n</code></pre>\n\n<p>Any ideas?</p>",
      "rawMarkdown": "I've been visually exploring images in the test set and there's some of them whose orientation is clearly off, a non-exhaustive list:\n\n    img_020ef15_manip.tif\n    img_7eade12_unalt.tif\n    img_eadeeaf_manip.tif\n    img_2939ad8_manip.tif\n    img_d83300a_manip.tif\n    img_d52a9ca_manip.tif\n    img_d992917_unalt.tif\n    img_cdf07d5_unalt.tif\n    img_a277a40_manip.tif\n    img_acac997_manip.tif\n    img_4d7be4c_unalt.tif\n    img_4df3673_manip.tif\n    img_7331609_unalt.tif\n    img_626da37_unalt.tif\n    img_fe767fe_manip.tif\n    img_22132f6_unalt.tif\n    img_55112b6_manip.tif\n    img_bb1ff2b_manip.tif\n    img_640ca38_unalt.tif\n    img_f3667f9_unalt.tif\n    img_65d4e62_unalt.tif\n    img_cb670fb_unalt.tif\n    img_a1e79e3_unalt.tif\n    img_9fb1b20_unalt.tif\n    img_ef82596_manip.tif\n    img_176e031_unalt.tif\n    img_9a69164_unalt.tif\n\nRunning this command `parallel 'echo {};identify -verbose train/{}/* | grep \" Orientation\" | sort | uniq -c' ::: 'HTC-1-M7' 'LG-Nexus-5x' 'Motorola-Droid-Maxx' 'iPhone-4s' 'iPhone-6' 'Motorola-Nexus-6' 'Motorola-X' 'Samsung-Galaxy-Note3' 'Samsung-Galaxy-S4' 'Sony-NEX-7'` will report the orientation metadata in the JPEGs. \n\n    HTC-1-M7\n        275   Orientation: TopLeft\n    iPhone-6\n        273   Orientation: RightTop\n          2   Orientation: TopLeft\n    iPhone-4s\n        275   Orientation: RightTop\n    Samsung-Galaxy-Note3\n        196   Orientation: RightTop\n         79   Orientation: TopLeft\n    Samsung-Galaxy-S4\n        275   Orientation: RightTop\n    Motorola-Droid-Maxx\n        275   Orientation: Undefined\n    LG-Nexus-5x\n        275   Orientation: Undefined\n    Motorola-Nexus-6\n          1   Orientation: LeftBottom\n        274   Orientation: TopLeft\n    Motorola-X\n        275   Orientation: Undefined\n    Sony-NEX-7\n         35   Orientation: LeftBottom\n          3   Orientation: RightTop\n        237   Orientation: TopLeft\n\nI believe the JPG -&gt; TIF converter or the RAW -&gt; TIF converter uses this or similar metadata to do its job and this could be the reason why some TIF images have the wrong orientation.\n\nRunning an equivalente command to see resolutions: `parallel 'echo {};identify train/{}/* |egrep -o \"[0-9]+x[0-9]+ \" | sort | uniq -c' ::: 'HTC-1-M7' 'LG-Nexus-5x' 'Motorola-Droid-Maxx' 'iPhone-4s' 'iPhone-6' 'Motorola-Nexus-6' 'Motorola-X' 'Samsung-Galaxy-Note3' 'Samsung-Galaxy-S4' 'Sony-NEX-7` yields:\n\n    LG-Nexus-5x\n        272 3024x4032\n          3 4032x3024\n    Motorola-Nexus-6\n          1 1040x780\n          1 3088x4130\n         15 3088x4160\n        128 3120x4160\n          9 4160x3088\n        121 4160x3120\n    iPhone-4s\n        275 3264x2448\n    HTC-1-M7\n        254 1520x2688\n         21 2688x1520\n    iPhone-6\n        275 3264x2448\n    Samsung-Galaxy-Note3\n        275 4128x2322\n    Samsung-Galaxy-S4\n        275 4128x2322\n    Motorola-Droid-Maxx\n         39 2432x4320\n        236 4320x2432\n    Motorola-X\n         41 3120x4160\n        234 4160x3120\n    Sony-NEX-7\n        275 6000x4000\n\nAny ideas?",
      "votes": null
    },
    {
      "id": "276410",
      "postDate": "01/31/2018 12:48:57",
      "content": "<p>Is orientation really such a big deal? Maybe it will be better to train network invariant to camera orientation?</p>",
      "rawMarkdown": "Is orientation really such a big deal? Maybe it will be better to train network invariant to camera orientation?",
      "votes": null
    },
    {
      "id": "276419",
      "postDate": "01/31/2018 12:58:59",
      "content": "<p>If you don't do orientation augmentation during training when a test sample comes in with the wrong orientation the net will attempt to classify with patterns learned with a nominal orientation (train set all have right orientation).</p>\n\n<p>Doing orientation augmentation is expensive (2x training time, I've tried and also it doesn't increase my LB score maybe the it exhausts network capacity although I really doubt it).</p>\n\n<p>The issue is only a few test images are affected, I haven't counted but probably less than 5%; but still...</p>",
      "rawMarkdown": "If you don't do orientation augmentation during training when a test sample comes in with the wrong orientation the net will attempt to classify with patterns learned with a nominal orientation (train set all have right orientation).\n\nDoing orientation augmentation is expensive (2x training time, I've tried and also it doesn't increase my LB score maybe the it exhausts network capacity although I really doubt it).\n\nThe issue is only a few test images are affected, I haven't counted but probably less than 5%; but still...",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 276410,
      "author_name": "ceperaang",
      "author_url": "",
      "post_date": "01/31/2018 12:48:57",
      "content": "<p>Is orientation really such a big deal? Maybe it will be better to train network invariant to camera orientation?</p>",
      "votes": null,
      "replies": [
        {
          "id": 276419,
          "author_name": "antorsae",
          "author_url": "",
          "post_date": "01/31/2018 12:58:59",
          "content": "<p>If you don't do orientation augmentation during training when a test sample comes in with the wrong orientation the net will attempt to classify with patterns learned with a nominal orientation (train set all have right orientation).</p>\n\n<p>Doing orientation augmentation is expensive (2x training time, I've tried and also it doesn't increase my LB score maybe the it exhausts network capacity although I really doubt it).</p>\n\n<p>The issue is only a few test images are affected, I haven't counted but probably less than 5%; but still...</p>",
          "votes": null,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "276407": "I've been visually exploring images in the test set and there's some of them whose orientation is clearly off, a non-exhaustive list:\n\n    img_020ef15_manip.tif\n    img_7eade12_unalt.tif\n    img_eadeeaf_manip.tif\n    img_2939ad8_manip.tif\n    img_d83300a_manip.tif\n    img_d52a9ca_manip.tif\n    img_d992917_unalt.tif\n    img_cdf07d5_unalt.tif\n    img_a277a40_manip.tif\n    img_acac997_manip.tif\n    img_4d7be4c_unalt.tif\n    img_4df3673_manip.tif\n    img_7331609_unalt.tif\n    img_626da37_unalt.tif\n    img_fe767fe_manip.tif\n    img_22132f6_unalt.tif\n    img_55112b6_manip.tif\n    img_bb1ff2b_manip.tif\n    img_640ca38_unalt.tif\n    img_f3667f9_unalt.tif\n    img_65d4e62_unalt.tif\n    img_cb670fb_unalt.tif\n    img_a1e79e3_unalt.tif\n    img_9fb1b20_unalt.tif\n    img_ef82596_manip.tif\n    img_176e031_unalt.tif\n    img_9a69164_unalt.tif\n\nRunning this command `parallel 'echo {};identify -verbose train/{}/* | grep \" Orientation\" | sort | uniq -c' ::: 'HTC-1-M7' 'LG-Nexus-5x' 'Motorola-Droid-Maxx' 'iPhone-4s' 'iPhone-6' 'Motorola-Nexus-6' 'Motorola-X' 'Samsung-Galaxy-Note3' 'Samsung-Galaxy-S4' 'Sony-NEX-7'` will report the orientation metadata in the JPEGs. \n\n    HTC-1-M7\n        275   Orientation: TopLeft\n    iPhone-6\n        273   Orientation: RightTop\n          2   Orientation: TopLeft\n    iPhone-4s\n        275   Orientation: RightTop\n    Samsung-Galaxy-Note3\n        196   Orientation: RightTop\n         79   Orientation: TopLeft\n    Samsung-Galaxy-S4\n        275   Orientation: RightTop\n    Motorola-Droid-Maxx\n        275   Orientation: Undefined\n    LG-Nexus-5x\n        275   Orientation: Undefined\n    Motorola-Nexus-6\n          1   Orientation: LeftBottom\n        274   Orientation: TopLeft\n    Motorola-X\n        275   Orientation: Undefined\n    Sony-NEX-7\n         35   Orientation: LeftBottom\n          3   Orientation: RightTop\n        237   Orientation: TopLeft\n\nI believe the JPG -&gt; TIF converter or the RAW -&gt; TIF converter uses this or similar metadata to do its job and this could be the reason why some TIF images have the wrong orientation.\n\nRunning an equivalente command to see resolutions: `parallel 'echo {};identify train/{}/* |egrep -o \"[0-9]+x[0-9]+ \" | sort | uniq -c' ::: 'HTC-1-M7' 'LG-Nexus-5x' 'Motorola-Droid-Maxx' 'iPhone-4s' 'iPhone-6' 'Motorola-Nexus-6' 'Motorola-X' 'Samsung-Galaxy-Note3' 'Samsung-Galaxy-S4' 'Sony-NEX-7` yields:\n\n    LG-Nexus-5x\n        272 3024x4032\n          3 4032x3024\n    Motorola-Nexus-6\n          1 1040x780\n          1 3088x4130\n         15 3088x4160\n        128 3120x4160\n          9 4160x3088\n        121 4160x3120\n    iPhone-4s\n        275 3264x2448\n    HTC-1-M7\n        254 1520x2688\n         21 2688x1520\n    iPhone-6\n        275 3264x2448\n    Samsung-Galaxy-Note3\n        275 4128x2322\n    Samsung-Galaxy-S4\n        275 4128x2322\n    Motorola-Droid-Maxx\n         39 2432x4320\n        236 4320x2432\n    Motorola-X\n         41 3120x4160\n        234 4160x3120\n    Sony-NEX-7\n        275 6000x4000\n\nAny ideas?",
    "276410": "Is orientation really such a big deal? Maybe it will be better to train network invariant to camera orientation?",
    "276419": "If you don't do orientation augmentation during training when a test sample comes in with the wrong orientation the net will attempt to classify with patterns learned with a nominal orientation (train set all have right orientation).\n\nDoing orientation augmentation is expensive (2x training time, I've tried and also it doesn't increase my LB score maybe the it exhausts network capacity although I really doubt it).\n\nThe issue is only a few test images are affected, I haven't counted but probably less than 5%; but still..."
  },
  "source": "meta"
}