{
  "id": 336255,
  "title": "Moving images to separate folders based on labels",
  "url": "/competitions/mayo-clinic-strip-ai/discussion/336255",
  "author_name": "Collide_Conquer_19",
  "post_date": "2022-07-10T07:25:44.034000",
  "votes": 2,
  "comment_count": 1,
  "views": 0,
  "content": "<p>Hello all<br>\nIn this challenge, we have train and test image folders and train &amp; test CSV files and I want to separate the train and test images into separate folders based on labels. how can I achieve that?  </p>\n<p>Thanks in advance !</p>",
  "messages": [
    {
      "id": 1851982,
      "postDate": "2022-07-11T17:25:09.653Z",
      "content": "<p>You can make two folders (one for each label) using unix commands:</p>\n<pre><code>!mkdir label_1\n!mkdir label_2\n</code></pre>\n<p>This will create two folders, one for each label (you could name them LAA and CE if you want). Then you can split your dataframe into two:</p>\n<pre><code>ce = df[df[\"label\"]==\"CE\"]\nlaa = df[df[\"label\"]==\"LAA\"]\n</code></pre>\n<p>Now that you have this new datasets you can iterate over the image ids and copy the images from the original folder to the new folder:</p>\n<pre><code>!cp path_to_original_image path_to_new_folder\n</code></pre>",
      "rawMarkdown": "You can make two folders (one for each label) using unix commands:\n```\n!mkdir label_1\n!mkdir label_2\n```\nThis will create two folders, one for each label (you could name them LAA and CE if you want). Then you can split your dataframe into two:\n```\nce = df[df[\"label\"]==\"CE\"]\nlaa = df[df[\"label\"]==\"LAA\"]\n```\nNow that you have this new datasets you can iterate over the image ids and copy the images from the original folder to the new folder:\n```\n!cp path_to_original_image path_to_new_folder\n```",
      "votes": 1
    },
    {
      "id": 1850192,
      "postDate": "2022-07-10T07:25:44.033Z",
      "content": "<p>Hello all<br>\nIn this challenge, we have train and test image folders and train &amp; test CSV files and I want to separate the train and test images into separate folders based on labels. how can I achieve that?  </p>\n<p>Thanks in advance !</p>",
      "rawMarkdown": "Hello all\nIn this challenge, we have train and test image folders and train & test CSV files and I want to separate the train and test images into separate folders based on labels. how can I achieve that?  \n\nThanks in advance !",
      "votes": 2
    }
  ],
  "comments": [
    {
      "id": 1851982,
      "author_name": "moth",
      "author_url": "",
      "post_date": "2022-07-11T17:25:09.653000",
      "content": "<p>You can make two folders (one for each label) using unix commands:</p>\n<pre><code>!mkdir label_1\n!mkdir label_2\n</code></pre>\n<p>This will create two folders, one for each label (you could name them LAA and CE if you want). Then you can split your dataframe into two:</p>\n<pre><code>ce = df[df[\"label\"]==\"CE\"]\nlaa = df[df[\"label\"]==\"LAA\"]\n</code></pre>\n<p>Now that you have this new datasets you can iterate over the image ids and copy the images from the original folder to the new folder:</p>\n<pre><code>!cp path_to_original_image path_to_new_folder\n</code></pre>",
      "votes": 1,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "1851982": "You can make two folders (one for each label) using unix commands:\n```\n!mkdir label_1\n!mkdir label_2\n```\nThis will create two folders, one for each label (you could name them LAA and CE if you want). Then you can split your dataframe into two:\n```\nce = df[df[\"label\"]==\"CE\"]\nlaa = df[df[\"label\"]==\"LAA\"]\n```\nNow that you have this new datasets you can iterate over the image ids and copy the images from the original folder to the new folder:\n```\n!cp path_to_original_image path_to_new_folder\n```",
    "1850192": "Hello all\nIn this challenge, we have train and test image folders and train & test CSV files and I want to separate the train and test images into separate folders based on labels. how can I achieve that?  \n\nThanks in advance !"
  }
}