{
  "id": 319291,
  "title": "Getting error 'Label was not included in training dataset'.",
  "url": "/competitions/happy-whale-and-dolphin/discussion/319291",
  "author_name": "",
  "post_date": "2022-04-16T11:58:24.209499400Z",
  "votes": 2,
  "comment_count": 2,
  "views": 0,
  "content": "<p>I am getting following error while creating fast ai dataloaders from dataframe.<br>\n<strong><em>KeyError: \"Label '718a40b59a18' was not included in the training dataset\"</em></strong></p>\n<p><code>dls = ImageDataLoaders.from_df(train_df, path/'train_images', valid_pct = 0.2, seed = 15, \n                               fn_col = 0, label_col = 2, item_tfms = Resize(225))</code></p>\n<p>Can anyone please help me to solve this error?</p>",
  "messages": [
    {
      "id": "1757219",
      "postDate": "04/16/2022 11:58:24",
      "content": "<p>I am getting following error while creating fast ai dataloaders from dataframe.<br>\n<strong><em>KeyError: \"Label '718a40b59a18' was not included in the training dataset\"</em></strong></p>\n<p><code>dls = ImageDataLoaders.from_df(train_df, path/'train_images', valid_pct = 0.2, seed = 15, \n                               fn_col = 0, label_col = 2, item_tfms = Resize(225))</code></p>\n<p>Can anyone please help me to solve this error?</p>",
      "rawMarkdown": "I am getting following error while creating fast ai dataloaders from dataframe.\n***KeyError: \"Label '718a40b59a18' was not included in the training dataset\"***\n\n`dls = ImageDataLoaders.from_df(train_df, path/'train_images', valid_pct = 0.2, seed = 15, \n                               fn_col = 0, label_col = 2, item_tfms = Resize(225))`\n\nCan anyone please help me to solve this error?",
      "votes": null
    },
    {
      "id": "1757964",
      "postDate": "04/17/2022 07:08:13",
      "content": "<p>as the error message says.</p>",
      "rawMarkdown": "as the error message says.",
      "votes": null
    },
    {
      "id": "1759510",
      "postDate": "04/18/2022 17:30:01",
      "content": "<p>I was able to solve this problem using StratifiedKFold Split.</p>",
      "rawMarkdown": "I was able to solve this problem using StratifiedKFold Split.",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 1757964,
      "author_name": "dragonzhang",
      "author_url": "",
      "post_date": "04/17/2022 07:08:13",
      "content": "<p>as the error message says.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 1759510,
      "author_name": "pksx01",
      "author_url": "",
      "post_date": "04/18/2022 17:30:01",
      "content": "<p>I was able to solve this problem using StratifiedKFold Split.</p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "1757219": "I am getting following error while creating fast ai dataloaders from dataframe.\n***KeyError: \"Label '718a40b59a18' was not included in the training dataset\"***\n\n`dls = ImageDataLoaders.from_df(train_df, path/'train_images', valid_pct = 0.2, seed = 15, \n                               fn_col = 0, label_col = 2, item_tfms = Resize(225))`\n\nCan anyone please help me to solve this error?",
    "1757964": "as the error message says.",
    "1759510": "I was able to solve this problem using StratifiedKFold Split."
  },
  "source": "meta"
}