{
  "id": 99846,
  "title": "image shape dataset of previous competition",
  "url": "/competitions/aptos2019-blindness-detection/discussion/99846",
  "author_name": "",
  "post_date": "2019-07-14T17:59:31.711674400Z",
  "votes": 37,
  "comment_count": 27,
  "views": 0,
  "content": "<p>Unlike the <a href=\"https://www.kaggle.com/c/diabetic-retinopathy-detection\">previous competition</a>, in this competition, there is a bias of the class for each image shape. Therefore, it is necessary to pay attention to the shape of the image, but the image of the previous competition can not be read from the kernel.</p>\n\n<p>So I ran the code locally and published the image shape dataset.</p>\n\n<p>Here is the dataset\n<a href=\"https://www.kaggle.com/currypurin/diabetic-retinopathy-detection-image-size/\">https://www.kaggle.com/currypurin/diabetic-retinopathy-detection-image-size/</a></p>\n\n<p>For example, for the next image, in this competition many feature seems to be correlated with the target, but not previous competition. \n<img src=\"https://cdn.discordapp.com/attachments/597613765432705035/600020777550610453/25.png\" alt=\"corr\">\nI also have a <a href=\"https://www.kaggle.com/currypurin/image-shape-distribution-previous-and-present\">kernel</a>. </p>\n\n<p>I think this target bias may cause a large shake up.</p>\n\n<p>Any comments are welcome.</p>",
  "messages": [
    {
      "id": "574928",
      "postDate": "07/14/2019 17:59:31",
      "content": "<p>Unlike the <a href=\"https://www.kaggle.com/c/diabetic-retinopathy-detection\">previous competition</a>, in this competition, there is a bias of the class for each image shape. Therefore, it is necessary to pay attention to the shape of the image, but the image of the previous competition can not be read from the kernel.</p>\n\n<p>So I ran the code locally and published the image shape dataset.</p>\n\n<p>Here is the dataset\n<a href=\"https://www.kaggle.com/currypurin/diabetic-retinopathy-detection-image-size/\">https://www.kaggle.com/currypurin/diabetic-retinopathy-detection-image-size/</a></p>\n\n<p>For example, for the next image, in this competition many feature seems to be correlated with the target, but not previous competition. \n<img src=\"https://cdn.discordapp.com/attachments/597613765432705035/600020777550610453/25.png\" alt=\"corr\">\nI also have a <a href=\"https://www.kaggle.com/currypurin/image-shape-distribution-previous-and-present\">kernel</a>. </p>\n\n<p>I think this target bias may cause a large shake up.</p>\n\n<p>Any comments are welcome.</p>",
      "rawMarkdown": "Unlike the [previous competition](https://www.kaggle.com/c/diabetic-retinopathy-detection), in this competition, there is a bias of the class for each image shape. Therefore, it is necessary to pay attention to the shape of the image, but the image of the previous competition can not be read from the kernel.\n\nSo I ran the code locally and published the image shape dataset.\n\nHere is the dataset\nhttps://www.kaggle.com/currypurin/diabetic-retinopathy-detection-image-size/\n\nFor example, for the next image, in this competition many feature seems to be correlated with the target, but not previous competition. \n![corr](https://cdn.discordapp.com/attachments/597613765432705035/600020777550610453/25.png)\nI also have a [kernel](https://www.kaggle.com/currypurin/image-shape-distribution-previous-and-present). \n\nI think this target bias may cause a large shake up.\n\nAny comments are welcome.",
      "votes": null
    },
    {
      "id": "575081",
      "postDate": "07/15/2019 03:11:13",
      "content": "<p>Nice observation. \nBut anyway, we need to resize image to 256x256 or 512x512.\nSo, if I'm not mistaken, that target bias will no longer will play its role right?</p>",
      "rawMarkdown": "Nice observation. \nBut anyway, we need to resize image to 256x256 or 512x512.\nSo, if I'm not mistaken, that target bias will no longer will play its role right?",
      "votes": null
    },
    {
      "id": "575147",
      "postDate": "07/15/2019 05:35:56",
      "content": "<p>Thank you.\nI think there may be a bad effect. For example Let's look at the image after resizing.\n<img src=\"https://cdn.discordapp.com/attachments/597613765432705035/600196738984181782/28.png\" alt=\"image\"></p>\n\n<ul>\n<li>images(480, 640) :  It seems that there are many images with few black areas.</li>\n<li>images(614, 819) :  It seems that some black areas are included.</li>\n<li>Due to the shape of the image before resizing, the shape of the black area after resizing tend to be similar.</li>\n<li>DNN will learn the trend in this brack areas, And there may be other characteristics of each shape.</li>\n<li>Therefore, the 1st solution of previous competition <a href=\"https://www.kaggle.com/ratthachat/aptos-updated-preprocessing-ben-s-cropping#3.-Further-improve-by-auto-cropping\">auto-cropping</a> may be more important and \nWe may need to make further improvements.</li>\n</ul>",
      "rawMarkdown": "Thank you.\nI think there may be a bad effect. For example Let's look at the image after resizing.\n![image](https://cdn.discordapp.com/attachments/597613765432705035/600196738984181782/28.png)\n\n* images(480, 640) :  It seems that there are many images with few black areas.\n* images(614, 819) :  It seems that some black areas are included.\n* Due to the shape of the image before resizing, the shape of the black area after resizing tend to be similar.\n* DNN will learn the trend in this brack areas, And there may be other characteristics of each shape.\n* Therefore, the 1st solution of previous competition [auto-cropping](https://www.kaggle.com/ratthachat/aptos-updated-preprocessing-ben-s-cropping#3.-Further-improve-by-auto-cropping) may be more important and \nWe may need to make further improvements.",
      "votes": null
    },
    {
      "id": "575370",
      "postDate": "07/15/2019 10:45:26",
      "content": "<p>Yes. You're right.\nWe need to crop picture before we resize it.</p>",
      "rawMarkdown": "Yes. You're right.\nWe need to crop picture before we resize it.",
      "votes": null
    },
    {
      "id": "575397",
      "postDate": "07/15/2019 11:30:05",
      "content": "<p>I see. I have little experience in image competition and I am studying very much.</p>",
      "rawMarkdown": "I see. I have little experience in image competition and I am studying very much.",
      "votes": null
    },
    {
      "id": "575434",
      "postDate": "07/15/2019 11:57:46",
      "content": "<p>Same here. \nI've very little experience in tabular &amp; audio too! 😄 \nWe're here to learn!</p>",
      "rawMarkdown": "Same here. \nI've very little experience in tabular &amp; audio too! 😄 \nWe're here to learn!",
      "votes": null
    },
    {
      "id": "575443",
      "postDate": "07/15/2019 12:24:53",
      "content": "<p>Hey guys, nice findings! For cropping and other preprocessing: here's an awesome <a href=\"https://www.kaggle.com/ratthachat/aptos-updated-preprocessing-ben-s-cropping\">kernel</a> from <a href=\"/ratthachat\">@ratthachat</a>/ </p>",
      "rawMarkdown": "Hey guys, nice findings! For cropping and other preprocessing: here's an awesome [kernel](https://www.kaggle.com/ratthachat/aptos-updated-preprocessing-ben-s-cropping) from @ratthachat/",
      "votes": null
    },
    {
      "id": "575706",
      "postDate": "07/15/2019 21:57:13",
      "content": "<p>Thank you very much...Well this is the first topic I read for this competition, and it seems I will again have very short nights</p>",
      "rawMarkdown": "Thank you very much...Well this is the first topic I read for this competition, and it seems I will again have very short nights",
      "votes": null
    },
    {
      "id": "576970",
      "postDate": "07/16/2019 08:05:09",
      "content": "<p>One question about data from previous competitions, anyone gotten permission to use its?\n&gt; INTELLECTUAL PROPERTY\nDATA\n'Data' means the Data or Datasets linked from the Competition Website for the purpose of use by Participants in the Competition. For the avoidance of doubt, Data is deemed for the purpose of these Competition Rules to include any prototype or executable code provided to Participants by Kaggle or Competition Sponsor via the Website. Participants must use the Data only as permitted by these Competition Rules and any associated data use rules specified on the Competition Website.</p>",
      "rawMarkdown": "One question about data from previous competitions, anyone gotten permission to use its?\n&gt; INTELLECTUAL PROPERTY\nDATA\n'Data' means the Data or Datasets linked from the Competition Website for the purpose of use by Participants in the Competition. For the avoidance of doubt, Data is deemed for the purpose of these Competition Rules to include any prototype or executable code provided to Participants by Kaggle or Competition Sponsor via the Website. Participants must use the Data only as permitted by these Competition Rules and any associated data use rules specified on the Competition Website.",
      "votes": null
    },
    {
      "id": "577149",
      "postDate": "07/16/2019 12:15:34",
      "content": "<p>Weird. Width of image correlate .57 and width_height ratio -.53 with the label? So you can get a result far better than random guessing without looking at the contents of image?</p>",
      "rawMarkdown": "Weird. Width of image correlate .57 and width_height ratio -.53 with the label? So you can get a result far better than random guessing without looking at the contents of image?",
      "votes": null
    },
    {
      "id": "577161",
      "postDate": "07/16/2019 12:28:52",
      "content": "<p>For academic used answer is \"yes\":\n<a href=\"https://www.kaggle.com/c/diabetic-retinopathy-detection/discussion/91590\">https://www.kaggle.com/c/diabetic-retinopathy-detection/discussion/91590</a></p>",
      "rawMarkdown": "For academic used answer is \"yes\":\nhttps://www.kaggle.com/c/diabetic-retinopathy-detection/discussion/91590",
      "votes": null
    },
    {
      "id": "577362",
      "postDate": "07/16/2019 16:21:10",
      "content": "<p>It has been posted Official external data thread.\n<a href=\"https://www.kaggle.com/c/aptos2019-blindness-detection/discussion/97605#563188\">https://www.kaggle.com/c/aptos2019-blindness-detection/discussion/97605#563188</a></p>",
      "rawMarkdown": "It has been posted Official external data thread.\nhttps://www.kaggle.com/c/aptos2019-blindness-detection/discussion/97605#563188",
      "votes": null
    },
    {
      "id": "577384",
      "postDate": "07/16/2019 16:39:02",
      "content": "<p>As written in <a href=\"https://www.kaggle.com/currypurin/image-shape-distribution-previous-and-present\">this Kernel</a>, the distribution of targets in train is like this, so this correlation occurs.\nTherefore, it is possible to predict target with high accuracy from image shape if it is limited to train set.</p>\n\n<p><img src=\"https://cdn.discordapp.com/attachments/597613765432705035/600725831139983372/AwesomeScreenshot-Image-shape-distribution-previous-and-present-Kaggle-2019-07-17-01-07-71.png\" alt=\"image\"></p>",
      "rawMarkdown": "As written in [this Kernel](https://www.kaggle.com/currypurin/image-shape-distribution-previous-and-present), the distribution of targets in train is like this, so this correlation occurs.\nTherefore, it is possible to predict target with high accuracy from image shape if it is limited to train set.\n\n![image](https://cdn.discordapp.com/attachments/597613765432705035/600725831139983372/AwesomeScreenshot-Image-shape-distribution-previous-and-present-Kaggle-2019-07-17-01-07-71.png)",
      "votes": null
    },
    {
      "id": "577408",
      "postDate": "07/16/2019 16:54:15",
      "content": "<p>The data owner is  <a href=\"http://www.eyepacs.com/\">EyePACS</a> (not current competition host)</p>\n\n<p>&gt; Contact us to discuss how you can access and use our database.</p>\n\n<p>I mailing them, answer:</p>\n\n<blockquote>\n  <p>You` are welcome to use our dataset found here: <a href=\"https://www.kaggle.com/c/diabetic-retinopathy-detection\">https://www.kaggle.com/c/diabetic-retinopathy-detection</a>.  This is our only public dataset available at this time.  Please credit EyePACS, LLC in any report or publication and reference our article:  Cuadros J, Bresnick G. EyePACS: An Adaptable Telemedicine System for Diabetic Retinopathy Screening. Journal of diabetes science and technology (Online). 2009;3(3):509-516 [attached].  </p>\n</blockquote>",
      "rawMarkdown": "The data owner is  [EyePACS](http://www.eyepacs.com/) (not current competition host)\n\n&gt; Contact us to discuss how you can access and use our database.\n\nI mailing them, answer:\n\n&gt; You` are welcome to use our dataset found here: https://www.kaggle.com/c/diabetic-retinopathy-detection.  This is our only public dataset available at this time.  Please credit EyePACS, LLC in any report or publication and reference our article:  Cuadros J, Bresnick G. EyePACS: An Adaptable Telemedicine System for Diabetic Retinopathy Screening. Journal of diabetes science and technology (Online). 2009;3(3):509-516 [attached].",
      "votes": null
    },
    {
      "id": "578181",
      "postDate": "07/17/2019 12:48:52",
      "content": "<p>I tried to crop background of picture before resize it. <br>\nCV= 0.92226 -&gt;0.92291 <br>\nLB=0.774-&gt;0.759 <br>\n5folds resnet50, image size=320.  </p>",
      "rawMarkdown": "I tried to crop background of picture before resize it.  \nCV= 0.92226 -&gt;0.92291  \nLB=0.774-&gt;0.759  \n5folds resnet50, image size=320.",
      "votes": null
    },
    {
      "id": "578319",
      "postDate": "07/17/2019 15:50:05",
      "content": "<p><a href=\"/takuok\">@takuok</a>  thanks. I also tried to crop, but CV and LB score was down. I'm very interested in this topic, so I'm going to continue experimenting a bit more</p>",
      "rawMarkdown": "takuok  thanks. I also tried to crop, but CV and LB score was down. I'm very interested in this topic, so I'm going to continue experimenting a bit more",
      "votes": null
    },
    {
      "id": "578328",
      "postDate": "07/17/2019 16:00:48",
      "content": "<p><a href=\"/currypurin\">@currypurin</a> <a href=\"/prashantkikani\">@prashantkikani</a> I have already resized to 256x256 before and below is a sample excerpt for training dataset </p>\n\n<p><code>\nif (i+1)%100==0: \n    print(\"{}/{}\".format(i+1, len(train_set)))\n    idx = train_set['id_code'][i]\n    img_path = \"train/{}.png\".format(idx)\n    img = cv2.imread(img_path)[:,:,::-1]\n    h, w, _ = img.shape\n    if h&amp;gt;=w:\n        w_new = IMG_SIZE\n        h_new = int(h/w*IMG_SIZE)\n        img = cv2.resize(img,(w_new,h_new), cv2.INTER_LANCZOS4)\n    else:\n        w_new = int(w/h*IMG_SIZE)\n        h_new = IMG_SIZE\n        img = cv2.resize(img,(w_new,h_new), cv2.INTER_LANCZOS4)\n    cv2.imwrite(\"train{}/{}.png\".format(IMG_SIZE, idx), img[:,:,::-1])\n</code></p>\n\n<p>Hope this may be of your help.</p>",
      "rawMarkdown": "currypurin @prashantkikani I have already resized to 256x256 before and below is a sample excerpt for training dataset \n\n```\nif (i+1)%100==0: \n    print(\"{}/{}\".format(i+1, len(train_set)))\n    idx = train_set['id_code'][i]\n    img_path = \"train/{}.png\".format(idx)\n    img = cv2.imread(img_path)[:,:,::-1]\n    h, w, _ = img.shape\n    if h&gt;=w:\n        w_new = IMG_SIZE\n        h_new = int(h/w*IMG_SIZE)\n        img = cv2.resize(img,(w_new,h_new), cv2.INTER_LANCZOS4)\n    else:\n        w_new = int(w/h*IMG_SIZE)\n        h_new = IMG_SIZE\n        img = cv2.resize(img,(w_new,h_new), cv2.INTER_LANCZOS4)\n    cv2.imwrite(\"train{}/{}.png\".format(IMG_SIZE, idx), img[:,:,::-1])\n```\n\nHope this may be of your help.",
      "votes": null
    },
    {
      "id": "578360",
      "postDate": "07/17/2019 16:32:57",
      "content": "<p>crop black -&gt; pad to square &gt; resize 512x512:\n<a href=\"https://www.kaggle.com/leighplt/diabetic-artos-resized\">https://www.kaggle.com/leighplt/diabetic-artos-resized</a></p>",
      "rawMarkdown": "crop black -&gt; pad to square &gt; resize 512x512:\nhttps://www.kaggle.com/leighplt/diabetic-artos-resized",
      "votes": null
    },
    {
      "id": "578362",
      "postDate": "07/17/2019 16:33:30",
      "content": "<p><a href=\"/amitkumarjaiswal\">@amitkumarjaiswal</a> Thanks!  I will use this code to EDA and to update my kernel.</p>",
      "rawMarkdown": "amitkumarjaiswal Thanks!  I will use this code to EDA and to update my kernel.",
      "votes": null
    },
    {
      "id": "578707",
      "postDate": "07/18/2019 03:53:33",
      "content": "<p><a href=\"/amitkumarjaiswal\">@amitkumarjaiswal</a> thanks for sharing.\nBut can you please tell us, you're doing <code>cv2.resize(img,(w_new,h_new), cv2.INTER_LANCZOS4)</code> after cropping grey part or before?  </p>",
      "rawMarkdown": "amitkumarjaiswal thanks for sharing.\nBut can you please tell us, you're doing `cv2.resize(img,(w_new,h_new), cv2.INTER_LANCZOS4)` after cropping grey part or before?",
      "votes": null
    },
    {
      "id": "578754",
      "postDate": "07/18/2019 05:34:35",
      "content": "<p>He is downsizing the images maintaining the aspect ratio intact, with minimum side (either width or height whichever is smaller) being <code>IMG_SIZE</code></p>",
      "rawMarkdown": "He is downsizing the images maintaining the aspect ratio intact, with minimum side (either width or height whichever is smaller) being `IMG_SIZE`",
      "votes": null
    },
    {
      "id": "578931",
      "postDate": "07/18/2019 09:57:25",
      "content": "<p>When cropping an image always keep the aspect ratio right. Otherwise cropped images will get skewed.</p>",
      "rawMarkdown": "When cropping an image always keep the aspect ratio right. Otherwise cropped images will get skewed.",
      "votes": null
    },
    {
      "id": "578994",
      "postDate": "07/18/2019 11:48:18",
      "content": "<p>Thank you for sharing a nice kernel. BTW, how do you think about mechanism generating the correlation between image sizes and target variable? I guess that cameras with low resolutions are used when screening and those with high resolutions are used after screening, so as a result, larger sizes of images mean danger cases..</p>",
      "rawMarkdown": "Thank you for sharing a nice kernel. BTW, how do you think about mechanism generating the correlation between image sizes and target variable? I guess that cameras with low resolutions are used when screening and those with high resolutions are used after screening, so as a result, larger sizes of images mean danger cases..",
      "votes": null
    },
    {
      "id": "579031",
      "postDate": "07/18/2019 12:15:11",
      "content": "<p>I even thought I intentionally created data with such correlations, but your idea is very interesting and realistic.\nI would like to find out the relevant information.</p>",
      "rawMarkdown": "I even thought I intentionally created data with such correlations, but your idea is very interesting and realistic.\nI would like to find out the relevant information.",
      "votes": null
    },
    {
      "id": "579052",
      "postDate": "07/18/2019 12:35:41",
      "content": "<p>You're right. We need more materials to discuss on this point..</p>",
      "rawMarkdown": "You're right. We need more materials to discuss on this point..",
      "votes": null
    },
    {
      "id": "586722",
      "postDate": "07/29/2019 15:26:46",
      "content": "<p>I hope the test set doesn't have that image shape bias... Did anyone run some tests?</p>",
      "rawMarkdown": "I hope the test set doesn't have that image shape bias... Did anyone run some tests?",
      "votes": null
    },
    {
      "id": "586937",
      "postDate": "07/29/2019 23:03:55",
      "content": "<p>I have not tested yet, but I think testing may have some success. For example, as with public test, it is possible to check if the 480x640 image exceeds a certain percentage.</p>\n\n<p>What other tests can we do?</p>",
      "rawMarkdown": "I have not tested yet, but I think testing may have some success. For example, as with public test, it is possible to check if the 480x640 image exceeds a certain percentage.\n\nWhat other tests can we do?",
      "votes": null
    },
    {
      "id": "590729",
      "postDate": "08/02/2019 14:19:07",
      "content": "<p>I think this kernel gives some answers... <a href=\"https://www.kaggle.com/taindow/be-careful-what-you-train-on\">https://www.kaggle.com/taindow/be-careful-what-you-train-on</a></p>",
      "rawMarkdown": "I think this kernel gives some answers... https://www.kaggle.com/taindow/be-careful-what-you-train-on",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 575081,
      "author_name": "prashantkikani",
      "author_url": "",
      "post_date": "07/15/2019 03:11:13",
      "content": "<p>Nice observation. \nBut anyway, we need to resize image to 256x256 or 512x512.\nSo, if I'm not mistaken, that target bias will no longer will play its role right?</p>",
      "votes": null,
      "replies": [
        {
          "id": 575147,
          "author_name": "currypurin",
          "author_url": "",
          "post_date": "07/15/2019 05:35:56",
          "content": "<p>Thank you.\nI think there may be a bad effect. For example Let's look at the image after resizing.\n<img src=\"https://cdn.discordapp.com/attachments/597613765432705035/600196738984181782/28.png\" alt=\"image\"></p>\n\n<ul>\n<li>images(480, 640) :  It seems that there are many images with few black areas.</li>\n<li>images(614, 819) :  It seems that some black areas are included.</li>\n<li>Due to the shape of the image before resizing, the shape of the black area after resizing tend to be similar.</li>\n<li>DNN will learn the trend in this brack areas, And there may be other characteristics of each shape.</li>\n<li>Therefore, the 1st solution of previous competition <a href=\"https://www.kaggle.com/ratthachat/aptos-updated-preprocessing-ben-s-cropping#3.-Further-improve-by-auto-cropping\">auto-cropping</a> may be more important and \nWe may need to make further improvements.</li>\n</ul>",
          "votes": null,
          "replies": []
        },
        {
          "id": 575370,
          "author_name": "prashantkikani",
          "author_url": "",
          "post_date": "07/15/2019 10:45:26",
          "content": "<p>Yes. You're right.\nWe need to crop picture before we resize it.</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 575397,
          "author_name": "currypurin",
          "author_url": "",
          "post_date": "07/15/2019 11:30:05",
          "content": "<p>I see. I have little experience in image competition and I am studying very much.</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 575434,
          "author_name": "prashantkikani",
          "author_url": "",
          "post_date": "07/15/2019 11:57:46",
          "content": "<p>Same here. \nI've very little experience in tabular &amp; audio too! 😄 \nWe're here to learn!</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 575443,
          "author_name": "rishabhiitbhu",
          "author_url": "",
          "post_date": "07/15/2019 12:24:53",
          "content": "<p>Hey guys, nice findings! For cropping and other preprocessing: here's an awesome <a href=\"https://www.kaggle.com/ratthachat/aptos-updated-preprocessing-ben-s-cropping\">kernel</a> from <a href=\"/ratthachat\">@ratthachat</a>/ </p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 578181,
          "author_name": "takuok",
          "author_url": "",
          "post_date": "07/17/2019 12:48:52",
          "content": "<p>I tried to crop background of picture before resize it. <br>\nCV= 0.92226 -&gt;0.92291 <br>\nLB=0.774-&gt;0.759 <br>\n5folds resnet50, image size=320.  </p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 578319,
          "author_name": "currypurin",
          "author_url": "",
          "post_date": "07/17/2019 15:50:05",
          "content": "<p><a href=\"/takuok\">@takuok</a>  thanks. I also tried to crop, but CV and LB score was down. I'm very interested in this topic, so I'm going to continue experimenting a bit more</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 578328,
          "author_name": "amitkumarjaiswal",
          "author_url": "",
          "post_date": "07/17/2019 16:00:48",
          "content": "<p><a href=\"/currypurin\">@currypurin</a> <a href=\"/prashantkikani\">@prashantkikani</a> I have already resized to 256x256 before and below is a sample excerpt for training dataset </p>\n\n<p><code>\nif (i+1)%100==0: \n    print(\"{}/{}\".format(i+1, len(train_set)))\n    idx = train_set['id_code'][i]\n    img_path = \"train/{}.png\".format(idx)\n    img = cv2.imread(img_path)[:,:,::-1]\n    h, w, _ = img.shape\n    if h&amp;gt;=w:\n        w_new = IMG_SIZE\n        h_new = int(h/w*IMG_SIZE)\n        img = cv2.resize(img,(w_new,h_new), cv2.INTER_LANCZOS4)\n    else:\n        w_new = int(w/h*IMG_SIZE)\n        h_new = IMG_SIZE\n        img = cv2.resize(img,(w_new,h_new), cv2.INTER_LANCZOS4)\n    cv2.imwrite(\"train{}/{}.png\".format(IMG_SIZE, idx), img[:,:,::-1])\n</code></p>\n\n<p>Hope this may be of your help.</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 578362,
          "author_name": "currypurin",
          "author_url": "",
          "post_date": "07/17/2019 16:33:30",
          "content": "<p><a href=\"/amitkumarjaiswal\">@amitkumarjaiswal</a> Thanks!  I will use this code to EDA and to update my kernel.</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 578707,
          "author_name": "prashantkikani",
          "author_url": "",
          "post_date": "07/18/2019 03:53:33",
          "content": "<p><a href=\"/amitkumarjaiswal\">@amitkumarjaiswal</a> thanks for sharing.\nBut can you please tell us, you're doing <code>cv2.resize(img,(w_new,h_new), cv2.INTER_LANCZOS4)</code> after cropping grey part or before?  </p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 578754,
          "author_name": "rishabhiitbhu",
          "author_url": "",
          "post_date": "07/18/2019 05:34:35",
          "content": "<p>He is downsizing the images maintaining the aspect ratio intact, with minimum side (either width or height whichever is smaller) being <code>IMG_SIZE</code></p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 575706,
      "author_name": "kamstats",
      "author_url": "",
      "post_date": "07/15/2019 21:57:13",
      "content": "<p>Thank you very much...Well this is the first topic I read for this competition, and it seems I will again have very short nights</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 576970,
      "author_name": "leighplt",
      "author_url": "",
      "post_date": "07/16/2019 08:05:09",
      "content": "<p>One question about data from previous competitions, anyone gotten permission to use its?\n&gt; INTELLECTUAL PROPERTY\nDATA\n'Data' means the Data or Datasets linked from the Competition Website for the purpose of use by Participants in the Competition. For the avoidance of doubt, Data is deemed for the purpose of these Competition Rules to include any prototype or executable code provided to Participants by Kaggle or Competition Sponsor via the Website. Participants must use the Data only as permitted by these Competition Rules and any associated data use rules specified on the Competition Website.</p>",
      "votes": null,
      "replies": [
        {
          "id": 577161,
          "author_name": "leighplt",
          "author_url": "",
          "post_date": "07/16/2019 12:28:52",
          "content": "<p>For academic used answer is \"yes\":\n<a href=\"https://www.kaggle.com/c/diabetic-retinopathy-detection/discussion/91590\">https://www.kaggle.com/c/diabetic-retinopathy-detection/discussion/91590</a></p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 577362,
          "author_name": "currypurin",
          "author_url": "",
          "post_date": "07/16/2019 16:21:10",
          "content": "<p>It has been posted Official external data thread.\n<a href=\"https://www.kaggle.com/c/aptos2019-blindness-detection/discussion/97605#563188\">https://www.kaggle.com/c/aptos2019-blindness-detection/discussion/97605#563188</a></p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 577408,
          "author_name": "leighplt",
          "author_url": "",
          "post_date": "07/16/2019 16:54:15",
          "content": "<p>The data owner is  <a href=\"http://www.eyepacs.com/\">EyePACS</a> (not current competition host)</p>\n\n<p>&gt; Contact us to discuss how you can access and use our database.</p>\n\n<p>I mailing them, answer:</p>\n\n<blockquote>\n  <p>You` are welcome to use our dataset found here: <a href=\"https://www.kaggle.com/c/diabetic-retinopathy-detection\">https://www.kaggle.com/c/diabetic-retinopathy-detection</a>.  This is our only public dataset available at this time.  Please credit EyePACS, LLC in any report or publication and reference our article:  Cuadros J, Bresnick G. EyePACS: An Adaptable Telemedicine System for Diabetic Retinopathy Screening. Journal of diabetes science and technology (Online). 2009;3(3):509-516 [attached].  </p>\n</blockquote>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 577149,
      "author_name": "homoalways",
      "author_url": "",
      "post_date": "07/16/2019 12:15:34",
      "content": "<p>Weird. Width of image correlate .57 and width_height ratio -.53 with the label? So you can get a result far better than random guessing without looking at the contents of image?</p>",
      "votes": null,
      "replies": [
        {
          "id": 577384,
          "author_name": "currypurin",
          "author_url": "",
          "post_date": "07/16/2019 16:39:02",
          "content": "<p>As written in <a href=\"https://www.kaggle.com/currypurin/image-shape-distribution-previous-and-present\">this Kernel</a>, the distribution of targets in train is like this, so this correlation occurs.\nTherefore, it is possible to predict target with high accuracy from image shape if it is limited to train set.</p>\n\n<p><img src=\"https://cdn.discordapp.com/attachments/597613765432705035/600725831139983372/AwesomeScreenshot-Image-shape-distribution-previous-and-present-Kaggle-2019-07-17-01-07-71.png\" alt=\"image\"></p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 586722,
          "author_name": "sdoria",
          "author_url": "",
          "post_date": "07/29/2019 15:26:46",
          "content": "<p>I hope the test set doesn't have that image shape bias... Did anyone run some tests?</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 586937,
          "author_name": "currypurin",
          "author_url": "",
          "post_date": "07/29/2019 23:03:55",
          "content": "<p>I have not tested yet, but I think testing may have some success. For example, as with public test, it is possible to check if the 480x640 image exceeds a certain percentage.</p>\n\n<p>What other tests can we do?</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 590729,
          "author_name": "sdoria",
          "author_url": "",
          "post_date": "08/02/2019 14:19:07",
          "content": "<p>I think this kernel gives some answers... <a href=\"https://www.kaggle.com/taindow/be-careful-what-you-train-on\">https://www.kaggle.com/taindow/be-careful-what-you-train-on</a></p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 578360,
      "author_name": "leighplt",
      "author_url": "",
      "post_date": "07/17/2019 16:32:57",
      "content": "<p>crop black -&gt; pad to square &gt; resize 512x512:\n<a href=\"https://www.kaggle.com/leighplt/diabetic-artos-resized\">https://www.kaggle.com/leighplt/diabetic-artos-resized</a></p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 578931,
      "author_name": "sreejiths0",
      "author_url": "",
      "post_date": "07/18/2019 09:57:25",
      "content": "<p>When cropping an image always keep the aspect ratio right. Otherwise cropped images will get skewed.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 578994,
      "author_name": "kkondo",
      "author_url": "",
      "post_date": "07/18/2019 11:48:18",
      "content": "<p>Thank you for sharing a nice kernel. BTW, how do you think about mechanism generating the correlation between image sizes and target variable? I guess that cameras with low resolutions are used when screening and those with high resolutions are used after screening, so as a result, larger sizes of images mean danger cases..</p>",
      "votes": null,
      "replies": [
        {
          "id": 579031,
          "author_name": "currypurin",
          "author_url": "",
          "post_date": "07/18/2019 12:15:11",
          "content": "<p>I even thought I intentionally created data with such correlations, but your idea is very interesting and realistic.\nI would like to find out the relevant information.</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 579052,
          "author_name": "kkondo",
          "author_url": "",
          "post_date": "07/18/2019 12:35:41",
          "content": "<p>You're right. We need more materials to discuss on this point..</p>",
          "votes": null,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "574928": "Unlike the [previous competition](https://www.kaggle.com/c/diabetic-retinopathy-detection), in this competition, there is a bias of the class for each image shape. Therefore, it is necessary to pay attention to the shape of the image, but the image of the previous competition can not be read from the kernel.\n\nSo I ran the code locally and published the image shape dataset.\n\nHere is the dataset\nhttps://www.kaggle.com/currypurin/diabetic-retinopathy-detection-image-size/\n\nFor example, for the next image, in this competition many feature seems to be correlated with the target, but not previous competition. \n![corr](https://cdn.discordapp.com/attachments/597613765432705035/600020777550610453/25.png)\nI also have a [kernel](https://www.kaggle.com/currypurin/image-shape-distribution-previous-and-present). \n\nI think this target bias may cause a large shake up.\n\nAny comments are welcome.",
    "575081": "Nice observation. \nBut anyway, we need to resize image to 256x256 or 512x512.\nSo, if I'm not mistaken, that target bias will no longer will play its role right?",
    "575147": "Thank you.\nI think there may be a bad effect. For example Let's look at the image after resizing.\n![image](https://cdn.discordapp.com/attachments/597613765432705035/600196738984181782/28.png)\n\n* images(480, 640) :  It seems that there are many images with few black areas.\n* images(614, 819) :  It seems that some black areas are included.\n* Due to the shape of the image before resizing, the shape of the black area after resizing tend to be similar.\n* DNN will learn the trend in this brack areas, And there may be other characteristics of each shape.\n* Therefore, the 1st solution of previous competition [auto-cropping](https://www.kaggle.com/ratthachat/aptos-updated-preprocessing-ben-s-cropping#3.-Further-improve-by-auto-cropping) may be more important and \nWe may need to make further improvements.",
    "575370": "Yes. You're right.\nWe need to crop picture before we resize it.",
    "575397": "I see. I have little experience in image competition and I am studying very much.",
    "575434": "Same here. \nI've very little experience in tabular &amp; audio too! 😄 \nWe're here to learn!",
    "575443": "Hey guys, nice findings! For cropping and other preprocessing: here's an awesome [kernel](https://www.kaggle.com/ratthachat/aptos-updated-preprocessing-ben-s-cropping) from @ratthachat/",
    "575706": "Thank you very much...Well this is the first topic I read for this competition, and it seems I will again have very short nights",
    "576970": "One question about data from previous competitions, anyone gotten permission to use its?\n&gt; INTELLECTUAL PROPERTY\nDATA\n'Data' means the Data or Datasets linked from the Competition Website for the purpose of use by Participants in the Competition. For the avoidance of doubt, Data is deemed for the purpose of these Competition Rules to include any prototype or executable code provided to Participants by Kaggle or Competition Sponsor via the Website. Participants must use the Data only as permitted by these Competition Rules and any associated data use rules specified on the Competition Website.",
    "577149": "Weird. Width of image correlate .57 and width_height ratio -.53 with the label? So you can get a result far better than random guessing without looking at the contents of image?",
    "577161": "For academic used answer is \"yes\":\nhttps://www.kaggle.com/c/diabetic-retinopathy-detection/discussion/91590",
    "577362": "It has been posted Official external data thread.\nhttps://www.kaggle.com/c/aptos2019-blindness-detection/discussion/97605#563188",
    "577384": "As written in [this Kernel](https://www.kaggle.com/currypurin/image-shape-distribution-previous-and-present), the distribution of targets in train is like this, so this correlation occurs.\nTherefore, it is possible to predict target with high accuracy from image shape if it is limited to train set.\n\n![image](https://cdn.discordapp.com/attachments/597613765432705035/600725831139983372/AwesomeScreenshot-Image-shape-distribution-previous-and-present-Kaggle-2019-07-17-01-07-71.png)",
    "577408": "The data owner is  [EyePACS](http://www.eyepacs.com/) (not current competition host)\n\n&gt; Contact us to discuss how you can access and use our database.\n\nI mailing them, answer:\n\n&gt; You` are welcome to use our dataset found here: https://www.kaggle.com/c/diabetic-retinopathy-detection.  This is our only public dataset available at this time.  Please credit EyePACS, LLC in any report or publication and reference our article:  Cuadros J, Bresnick G. EyePACS: An Adaptable Telemedicine System for Diabetic Retinopathy Screening. Journal of diabetes science and technology (Online). 2009;3(3):509-516 [attached].",
    "578181": "I tried to crop background of picture before resize it.  \nCV= 0.92226 -&gt;0.92291  \nLB=0.774-&gt;0.759  \n5folds resnet50, image size=320.",
    "578319": "takuok  thanks. I also tried to crop, but CV and LB score was down. I'm very interested in this topic, so I'm going to continue experimenting a bit more",
    "578328": "currypurin @prashantkikani I have already resized to 256x256 before and below is a sample excerpt for training dataset \n\n```\nif (i+1)%100==0: \n    print(\"{}/{}\".format(i+1, len(train_set)))\n    idx = train_set['id_code'][i]\n    img_path = \"train/{}.png\".format(idx)\n    img = cv2.imread(img_path)[:,:,::-1]\n    h, w, _ = img.shape\n    if h&gt;=w:\n        w_new = IMG_SIZE\n        h_new = int(h/w*IMG_SIZE)\n        img = cv2.resize(img,(w_new,h_new), cv2.INTER_LANCZOS4)\n    else:\n        w_new = int(w/h*IMG_SIZE)\n        h_new = IMG_SIZE\n        img = cv2.resize(img,(w_new,h_new), cv2.INTER_LANCZOS4)\n    cv2.imwrite(\"train{}/{}.png\".format(IMG_SIZE, idx), img[:,:,::-1])\n```\n\nHope this may be of your help.",
    "578360": "crop black -&gt; pad to square &gt; resize 512x512:\nhttps://www.kaggle.com/leighplt/diabetic-artos-resized",
    "578362": "amitkumarjaiswal Thanks!  I will use this code to EDA and to update my kernel.",
    "578707": "amitkumarjaiswal thanks for sharing.\nBut can you please tell us, you're doing `cv2.resize(img,(w_new,h_new), cv2.INTER_LANCZOS4)` after cropping grey part or before?",
    "578754": "He is downsizing the images maintaining the aspect ratio intact, with minimum side (either width or height whichever is smaller) being `IMG_SIZE`",
    "578931": "When cropping an image always keep the aspect ratio right. Otherwise cropped images will get skewed.",
    "578994": "Thank you for sharing a nice kernel. BTW, how do you think about mechanism generating the correlation between image sizes and target variable? I guess that cameras with low resolutions are used when screening and those with high resolutions are used after screening, so as a result, larger sizes of images mean danger cases..",
    "579031": "I even thought I intentionally created data with such correlations, but your idea is very interesting and realistic.\nI would like to find out the relevant information.",
    "579052": "You're right. We need more materials to discuss on this point..",
    "586722": "I hope the test set doesn't have that image shape bias... Did anyone run some tests?",
    "586937": "I have not tested yet, but I think testing may have some success. For example, as with public test, it is possible to check if the 480x640 image exceeds a certain percentage.\n\nWhat other tests can we do?",
    "590729": "I think this kernel gives some answers... https://www.kaggle.com/taindow/be-careful-what-you-train-on"
  },
  "source": "meta"
}