{
  "id": 99808,
  "title": "Shaping image",
  "url": "/competitions/aptos2019-blindness-detection/discussion/99808",
  "author_name": "",
  "post_date": "2019-07-14T10:52:38.729166400Z",
  "votes": null,
  "comment_count": 2,
  "views": 0,
  "content": "<p>can somebody help me with how to shape my images for my network. Would it be better for me to crop it into a particular size or keep entire image and squish it into a different aspect ratio or is there a better alternative?</p>",
  "messages": [
    {
      "id": "574702",
      "postDate": "07/14/2019 10:52:38",
      "content": "<p>can somebody help me with how to shape my images for my network. Would it be better for me to crop it into a particular size or keep entire image and squish it into a different aspect ratio or is there a better alternative?</p>",
      "rawMarkdown": "can somebody help me with how to shape my images for my network. Would it be better for me to crop it into a particular size or keep entire image and squish it into a different aspect ratio or is there a better alternative?",
      "votes": null
    },
    {
      "id": "574707",
      "postDate": "07/14/2019 11:04:38",
      "content": "<p>try this:</p>\n\n<p>train=[]\nX=[]\nY=[]\na=0\nIMG_SIZE=150\nfor i in tqdm(sorted(os.listdir(train_path))):\n    path=os.path.join(train_path,i)\n    i=cv2.imread(path,cv2.IMREAD_COLOR)\n    i = cv2.resize(i, (IMG_SIZE, IMG_SIZE))\n    X.append(i)\n    train.append([np.array(diagnosis),diagnosis[a]])\n    a=a+1</p>\n\n<p>train=np.array(train)\nY=train[:,1]\ntrain=train[:,0]\nX=np.array(X)</p>\n\n<p>X.shape</p>\n\n<p>X=X/255\ntrain=train/255</p>",
      "rawMarkdown": "try this:\n\ntrain=[]\nX=[]\nY=[]\na=0\nIMG_SIZE=150\nfor i in tqdm(sorted(os.listdir(train_path))):\n    path=os.path.join(train_path,i)\n    i=cv2.imread(path,cv2.IMREAD_COLOR)\n    i = cv2.resize(i, (IMG_SIZE, IMG_SIZE))\n    X.append(i)\n    train.append([np.array(diagnosis),diagnosis[a]])\n    a=a+1\n\ntrain=np.array(train)\nY=train[:,1]\ntrain=train[:,0]\nX=np.array(X)\n\nX.shape\n\nX=X/255\ntrain=train/255",
      "votes": null
    },
    {
      "id": "577645",
      "postDate": "07/16/2019 22:10:00",
      "content": "<p><a href=\"/ratthachat\">@ratthachat</a> has published a great kernel about image processing, updating work done in the previous competition. You can have a look here : \n<a href=\"https://www.kaggle.com/ratthachat/aptos-updated-preprocessing-ben-s-cropping\">https://www.kaggle.com/ratthachat/aptos-updated-preprocessing-ben-s-cropping</a>\nI've modified the \"crop\" function and had good results. You can have a look here on what I've done : \n<a href=\"https://www.kaggle.com/jtbontinck/cnn-xgb-end-to-end-0-11\">https://www.kaggle.com/jtbontinck/cnn-xgb-end-to-end-0-11</a>\nThe pre-processing has increased my CV and increased my score from 0.623 to 0.648</p>",
      "rawMarkdown": "ratthachat has published a great kernel about image processing, updating work done in the previous competition. You can have a look here : \nhttps://www.kaggle.com/ratthachat/aptos-updated-preprocessing-ben-s-cropping\nI've modified the \"crop\" function and had good results. You can have a look here on what I've done : \nhttps://www.kaggle.com/jtbontinck/cnn-xgb-end-to-end-0-11\nThe pre-processing has increased my CV and increased my score from 0.623 to 0.648",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 574707,
      "author_name": "iluvmahheart",
      "author_url": "",
      "post_date": "07/14/2019 11:04:38",
      "content": "<p>try this:</p>\n\n<p>train=[]\nX=[]\nY=[]\na=0\nIMG_SIZE=150\nfor i in tqdm(sorted(os.listdir(train_path))):\n    path=os.path.join(train_path,i)\n    i=cv2.imread(path,cv2.IMREAD_COLOR)\n    i = cv2.resize(i, (IMG_SIZE, IMG_SIZE))\n    X.append(i)\n    train.append([np.array(diagnosis),diagnosis[a]])\n    a=a+1</p>\n\n<p>train=np.array(train)\nY=train[:,1]\ntrain=train[:,0]\nX=np.array(X)</p>\n\n<p>X.shape</p>\n\n<p>X=X/255\ntrain=train/255</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 577645,
      "author_name": "jtbontinck",
      "author_url": "",
      "post_date": "07/16/2019 22:10:00",
      "content": "<p><a href=\"/ratthachat\">@ratthachat</a> has published a great kernel about image processing, updating work done in the previous competition. You can have a look here : \n<a href=\"https://www.kaggle.com/ratthachat/aptos-updated-preprocessing-ben-s-cropping\">https://www.kaggle.com/ratthachat/aptos-updated-preprocessing-ben-s-cropping</a>\nI've modified the \"crop\" function and had good results. You can have a look here on what I've done : \n<a href=\"https://www.kaggle.com/jtbontinck/cnn-xgb-end-to-end-0-11\">https://www.kaggle.com/jtbontinck/cnn-xgb-end-to-end-0-11</a>\nThe pre-processing has increased my CV and increased my score from 0.623 to 0.648</p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "574702": "can somebody help me with how to shape my images for my network. Would it be better for me to crop it into a particular size or keep entire image and squish it into a different aspect ratio or is there a better alternative?",
    "574707": "try this:\n\ntrain=[]\nX=[]\nY=[]\na=0\nIMG_SIZE=150\nfor i in tqdm(sorted(os.listdir(train_path))):\n    path=os.path.join(train_path,i)\n    i=cv2.imread(path,cv2.IMREAD_COLOR)\n    i = cv2.resize(i, (IMG_SIZE, IMG_SIZE))\n    X.append(i)\n    train.append([np.array(diagnosis),diagnosis[a]])\n    a=a+1\n\ntrain=np.array(train)\nY=train[:,1]\ntrain=train[:,0]\nX=np.array(X)\n\nX.shape\n\nX=X/255\ntrain=train/255",
    "577645": "ratthachat has published a great kernel about image processing, updating work done in the previous competition. You can have a look here : \nhttps://www.kaggle.com/ratthachat/aptos-updated-preprocessing-ben-s-cropping\nI've modified the \"crop\" function and had good results. You can have a look here on what I've done : \nhttps://www.kaggle.com/jtbontinck/cnn-xgb-end-to-end-0-11\nThe pre-processing has increased my CV and increased my score from 0.623 to 0.648"
  },
  "source": "meta"
}