{
  "id": 344283,
  "title": "yolov5 cervical spine cropper",
  "url": "/competitions/rsna-2022-cervical-spine-fracture-detection/discussion/344283",
  "author_name": "patriot",
  "post_date": "2022-08-14T17:41:24.916000",
  "votes": 19,
  "comment_count": 1,
  "views": 0,
  "content": "<p>Based on the segmentation results given in the \"nii\" file, I trained yolov5-small to cut through the spine only.<br>\n<a href=\"https://www.kaggle.com/datasets/abebe9849/rsna2022yolospinecrop\" target=\"_blank\">yolov5-small_cropper</a></p>\n<pre><code>train_df = pd.read_csv(\"rsna2022/train.csv\")\nall_study = train_df[\"StudyInstanceUID\"].unique()\nfor study in all_study:\n   test_dir = f\"rsna2022/data/{study}\"#jpg or png img\n\n   name = study+\"__\"\n   dir = f\"rsna2022/yolov5/runs/detect/{name}\"\n   if os.path.isdir(f\"{dir}/labels\"):continue\n   inf_cmd = f\"python rsna2022/yolov5/detect.py --weights {weights_dir} --img 512 --conf 0.6 --iou 0.4 --source {test_dir} --save-txt --save-conf --save-crop --name {name} --device 0\"\n   os.system(inf_cmd)\n</code></pre>\n<p>There is a study where the shooting posture is bad and cropping is not possible (e.g: 1.2.826.0.1.3680043.6200)</p>",
  "messages": [
    {
      "id": 1898643,
      "postDate": "2022-08-14T17:41:24.917Z",
      "content": "<p>Based on the segmentation results given in the \"nii\" file, I trained yolov5-small to cut through the spine only.<br>\n<a href=\"https://www.kaggle.com/datasets/abebe9849/rsna2022yolospinecrop\" target=\"_blank\">yolov5-small_cropper</a></p>\n<pre><code>train_df = pd.read_csv(\"rsna2022/train.csv\")\nall_study = train_df[\"StudyInstanceUID\"].unique()\nfor study in all_study:\n   test_dir = f\"rsna2022/data/{study}\"#jpg or png img\n\n   name = study+\"__\"\n   dir = f\"rsna2022/yolov5/runs/detect/{name}\"\n   if os.path.isdir(f\"{dir}/labels\"):continue\n   inf_cmd = f\"python rsna2022/yolov5/detect.py --weights {weights_dir} --img 512 --conf 0.6 --iou 0.4 --source {test_dir} --save-txt --save-conf --save-crop --name {name} --device 0\"\n   os.system(inf_cmd)\n</code></pre>\n<p>There is a study where the shooting posture is bad and cropping is not possible (e.g: 1.2.826.0.1.3680043.6200)</p>",
      "rawMarkdown": "\nBased on the segmentation results given in the \"nii\" file, I trained yolov5-small to cut through the spine only.\n\n[yolov5-small_cropper](https://www.kaggle.com/datasets/abebe9849/rsna2022yolospinecrop)\n\n```\ntrain_df = pd.read_csv(\"rsna2022/train.csv\")\nall_study = train_df[\"StudyInstanceUID\"].unique()\nfor study in all_study:\n\n    test_dir = f\"rsna2022/data/{study}\"#jpg or png img\n    \n    name = study+\"__\"\n    dir = f\"rsna2022/yolov5/runs/detect/{name}\"\n    if os.path.isdir(f\"{dir}/labels\"):continue\n\n    inf_cmd = f\"python rsna2022/yolov5/detect.py --weights {weights_dir} --img 512 --conf 0.6 --iou 0.4 --source {test_dir} --save-txt --save-conf --save-crop --name {name} --device 0\"\n    os.system(inf_cmd)\n```\n\nThere is a study where the shooting posture is bad and cropping is not possible (e.g: 1.2.826.0.1.3680043.6200)",
      "votes": 19
    },
    {
      "id": 1954987,
      "postDate": "2022-09-25T15:45:52.233Z",
      "content": "<p>Thank you for your sharing? May I ask you about your dataset that you use for yolov5 training? I saw in the result end of training your images are different from competition images (Read by pydicom)? Thanks</p>",
      "rawMarkdown": "Thank you for your sharing? May I ask you about your dataset that you use for yolov5 training? I saw in the result end of training your images are different from competition images (Read by pydicom)? Thanks"
    }
  ],
  "comments": [
    {
      "id": 1954987,
      "author_name": "Mad_Neil",
      "author_url": "",
      "post_date": "2022-09-25T15:45:52.233000",
      "content": "<p>Thank you for your sharing? May I ask you about your dataset that you use for yolov5 training? I saw in the result end of training your images are different from competition images (Read by pydicom)? Thanks</p>",
      "votes": 0,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "1898643": "\nBased on the segmentation results given in the \"nii\" file, I trained yolov5-small to cut through the spine only.\n\n[yolov5-small_cropper](https://www.kaggle.com/datasets/abebe9849/rsna2022yolospinecrop)\n\n```\ntrain_df = pd.read_csv(\"rsna2022/train.csv\")\nall_study = train_df[\"StudyInstanceUID\"].unique()\nfor study in all_study:\n\n    test_dir = f\"rsna2022/data/{study}\"#jpg or png img\n    \n    name = study+\"__\"\n    dir = f\"rsna2022/yolov5/runs/detect/{name}\"\n    if os.path.isdir(f\"{dir}/labels\"):continue\n\n    inf_cmd = f\"python rsna2022/yolov5/detect.py --weights {weights_dir} --img 512 --conf 0.6 --iou 0.4 --source {test_dir} --save-txt --save-conf --save-crop --name {name} --device 0\"\n    os.system(inf_cmd)\n```\n\nThere is a study where the shooting posture is bad and cropping is not possible (e.g: 1.2.826.0.1.3680043.6200)",
    "1954987": "Thank you for your sharing? May I ask you about your dataset that you use for yolov5 training? I saw in the result end of training your images are different from competition images (Read by pydicom)? Thanks"
  }
}