{
  "id": 180783,
  "title": "How to use ImageDataGenerator",
  "url": "/competitions/landmark-recognition-2020/discussion/180783",
  "author_name": "",
  "post_date": "2020-09-06T13:10:31.792712200Z",
  "votes": 2,
  "comment_count": 6,
  "views": 0,
  "content": "<p>I want to use keras.ImageDatagenerator.flow_from_directory, but to use this our directory should contain as many folders as many classes. And each image should be inside the folder which name is it's class. but the data is arranged in a different manner in the trian directory. How to deal with this?<br>\nPlease help.</p>",
  "messages": [
    {
      "id": "1000315",
      "postDate": "09/06/2020 13:10:31",
      "content": "<p>I want to use keras.ImageDatagenerator.flow_from_directory, but to use this our directory should contain as many folders as many classes. And each image should be inside the folder which name is it's class. but the data is arranged in a different manner in the trian directory. How to deal with this?<br>\nPlease help.</p>",
      "rawMarkdown": "I want to use keras.ImageDatagenerator.flow_from_directory, but to use this our directory should contain as many folders as many classes. And each image should be inside the folder which name is it's class. but the data is arranged in a different manner in the trian directory. How to deal with this?\nPlease help.",
      "votes": null
    },
    {
      "id": "1000469",
      "postDate": "09/06/2020 14:45:51",
      "content": "<p>I think <a href=\"https://www.tensorflow.org/api_docs/python/tf/keras/preprocessing/image/ImageDataGenerator#flow_from_dataframe\" target=\"_blank\">flow_from_dataframe</a> is more suitable for this kind of subfolders structure</p>",
      "rawMarkdown": "I think [flow_from_dataframe](https://www.tensorflow.org/api_docs/python/tf/keras/preprocessing/image/ImageDataGenerator#flow_from_dataframe) is more suitable for this kind of subfolders structure",
      "votes": null
    },
    {
      "id": "1000565",
      "postDate": "09/06/2020 16:11:10",
      "content": "<p>Hello sir<br>\nCan you please explain me with code, how can I use it for this dataset. I have not dealt much with image datas so far, so I just need a basic idea how can I make train data generator to use for mode.fit_generator.<br>\nIt would be very helpful. </p>",
      "rawMarkdown": "Hello sir\nCan you please explain me with code, how can I use it for this dataset. I have not dealt much with image datas so far, so I just need a basic idea how can I make train data generator to use for mode.fit_generator.\nIt would be very helpful.",
      "votes": null
    },
    {
      "id": "1000605",
      "postDate": "09/06/2020 16:44:39",
      "content": "<p>You can find a tutorial here <a href=\"https://medium.com/@vijayabhaskar96/tutorial-on-keras-imagedatagenerator-with-flow-from-dataframe-8bd5776e45c1\" target=\"_blank\">Tutorial on Keras ImageDataGenerator with flow_from_dataframe</a></p>\n<p>The main point is to create a pandas dataframe that reflect the subfolders structures setting </p>\n<ul>\n<li>absolute path of the image on column x_col </li>\n<li>target class on column y_col </li>\n</ul>",
      "rawMarkdown": "You can find a tutorial here [Tutorial on Keras ImageDataGenerator with flow_from_dataframe](https://medium.com/@vijayabhaskar96/tutorial-on-keras-imagedatagenerator-with-flow-from-dataframe-8bd5776e45c1)\n\nThe main point is to create a pandas dataframe that reflect the subfolders structures setting \n- absolute path of the image on column x_col \n- target class on column y_col",
      "votes": null
    },
    {
      "id": "1000656",
      "postDate": "09/06/2020 17:21:38",
      "content": "<p>Agree with <a href=\"https://www.kaggle.com/steubk\" target=\"_blank\">@steubk</a>. flow_from_dataframe is the appropriate choice. View here for the arguments: <br>\n<a href=\"https://www.tensorflow.org/api_docs/python/tf/keras/preprocessing/image/ImageDataGenerator#flow_from_dataframe\" target=\"_blank\">https://www.tensorflow.org/api_docs/python/tf/keras/preprocessing/image/ImageDataGenerator#flow_from_dataframe</a></p>",
      "rawMarkdown": "Agree with @steubk. flow_from_dataframe is the appropriate choice. View here for the arguments: \nhttps://www.tensorflow.org/api_docs/python/tf/keras/preprocessing/image/ImageDataGenerator#flow_from_dataframe",
      "votes": null
    },
    {
      "id": "1001047",
      "postDate": "09/07/2020 03:17:48",
      "content": "<p>Thank you so much</p>",
      "rawMarkdown": "Thank you so much",
      "votes": null
    },
    {
      "id": "1005360",
      "postDate": "09/10/2020 12:48:31",
      "content": "<p><a href=\"https://www.kaggle.com/steubk\" target=\"_blank\">@steubk</a> but ImageGenerator is not working with TPUs. How to deal with this?</p>",
      "rawMarkdown": "steubk but ImageGenerator is not working with TPUs. How to deal with this?",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 1000469,
      "author_name": "steubk",
      "author_url": "",
      "post_date": "09/06/2020 14:45:51",
      "content": "<p>I think <a href=\"https://www.tensorflow.org/api_docs/python/tf/keras/preprocessing/image/ImageDataGenerator#flow_from_dataframe\" target=\"_blank\">flow_from_dataframe</a> is more suitable for this kind of subfolders structure</p>",
      "votes": null,
      "replies": [
        {
          "id": 1000565,
          "author_name": "karan23258",
          "author_url": "",
          "post_date": "09/06/2020 16:11:10",
          "content": "<p>Hello sir<br>\nCan you please explain me with code, how can I use it for this dataset. I have not dealt much with image datas so far, so I just need a basic idea how can I make train data generator to use for mode.fit_generator.<br>\nIt would be very helpful. </p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1000605,
          "author_name": "steubk",
          "author_url": "",
          "post_date": "09/06/2020 16:44:39",
          "content": "<p>You can find a tutorial here <a href=\"https://medium.com/@vijayabhaskar96/tutorial-on-keras-imagedatagenerator-with-flow-from-dataframe-8bd5776e45c1\" target=\"_blank\">Tutorial on Keras ImageDataGenerator with flow_from_dataframe</a></p>\n<p>The main point is to create a pandas dataframe that reflect the subfolders structures setting </p>\n<ul>\n<li>absolute path of the image on column x_col </li>\n<li>target class on column y_col </li>\n</ul>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1001047,
          "author_name": "karan23258",
          "author_url": "",
          "post_date": "09/07/2020 03:17:48",
          "content": "<p>Thank you so much</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1005360,
          "author_name": "rohitdeepu17",
          "author_url": "",
          "post_date": "09/10/2020 12:48:31",
          "content": "<p><a href=\"https://www.kaggle.com/steubk\" target=\"_blank\">@steubk</a> but ImageGenerator is not working with TPUs. How to deal with this?</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 1000656,
      "author_name": "djbacad",
      "author_url": "",
      "post_date": "09/06/2020 17:21:38",
      "content": "<p>Agree with <a href=\"https://www.kaggle.com/steubk\" target=\"_blank\">@steubk</a>. flow_from_dataframe is the appropriate choice. View here for the arguments: <br>\n<a href=\"https://www.tensorflow.org/api_docs/python/tf/keras/preprocessing/image/ImageDataGenerator#flow_from_dataframe\" target=\"_blank\">https://www.tensorflow.org/api_docs/python/tf/keras/preprocessing/image/ImageDataGenerator#flow_from_dataframe</a></p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "1000315": "I want to use keras.ImageDatagenerator.flow_from_directory, but to use this our directory should contain as many folders as many classes. And each image should be inside the folder which name is it's class. but the data is arranged in a different manner in the trian directory. How to deal with this?\nPlease help.",
    "1000469": "I think [flow_from_dataframe](https://www.tensorflow.org/api_docs/python/tf/keras/preprocessing/image/ImageDataGenerator#flow_from_dataframe) is more suitable for this kind of subfolders structure",
    "1000565": "Hello sir\nCan you please explain me with code, how can I use it for this dataset. I have not dealt much with image datas so far, so I just need a basic idea how can I make train data generator to use for mode.fit_generator.\nIt would be very helpful.",
    "1000605": "You can find a tutorial here [Tutorial on Keras ImageDataGenerator with flow_from_dataframe](https://medium.com/@vijayabhaskar96/tutorial-on-keras-imagedatagenerator-with-flow-from-dataframe-8bd5776e45c1)\n\nThe main point is to create a pandas dataframe that reflect the subfolders structures setting \n- absolute path of the image on column x_col \n- target class on column y_col",
    "1000656": "Agree with @steubk. flow_from_dataframe is the appropriate choice. View here for the arguments: \nhttps://www.tensorflow.org/api_docs/python/tf/keras/preprocessing/image/ImageDataGenerator#flow_from_dataframe",
    "1001047": "Thank you so much",
    "1005360": "steubk but ImageGenerator is not working with TPUs. How to deal with this?"
  },
  "source": "meta"
}