{
  "id": 348422,
  "title": "3D data augmentations library",
  "url": "/competitions/rsna-2022-cervical-spine-fracture-detection/discussion/348422",
  "author_name": "Samuel Cortinhas",
  "post_date": "2022-08-28T10:51:23.724000",
  "votes": 4,
  "comment_count": 5,
  "views": 0,
  "content": "<p>Is anyone aware of a library that performs data augmentations on 3d volumes, compatible with PyTorch and ideally works on GPU? </p>\n<p>During training, I'm loading (B,C,D,H,W)=(batch_size,1,224,224,224) tensors and I'd like to apply rotations/flips in the x-y plane that are constant throughout the z dimension. </p>\n<p>I guess one way is to apply the same 2d transformation to every slice but would this be slow? Another approach could be to use <a href=\"https://docs.scipy.org/doc/scipy/reference/generated/scipy.ndimage.rotate.html\" target=\"_blank\">scipy.ndimage.rotate</a> but I'm worried about memory/speed since I think this requires numpy arrays as input. </p>",
  "messages": [
    {
      "id": 1917176,
      "postDate": "2022-08-28T13:37:36.677Z",
      "content": "<p>Here is my recommendation: <a href=\"https://github.com/ZFTurbo/volumentations\" target=\"_blank\">https://github.com/ZFTurbo/volumentations</a></p>",
      "rawMarkdown": "Here is my recommendation: https://github.com/ZFTurbo/volumentations",
      "votes": 3
    },
    {
      "id": 1917012,
      "postDate": "2022-08-28T10:51:23.723Z",
      "content": "<p>Is anyone aware of a library that performs data augmentations on 3d volumes, compatible with PyTorch and ideally works on GPU? </p>\n<p>During training, I'm loading (B,C,D,H,W)=(batch_size,1,224,224,224) tensors and I'd like to apply rotations/flips in the x-y plane that are constant throughout the z dimension. </p>\n<p>I guess one way is to apply the same 2d transformation to every slice but would this be slow? Another approach could be to use <a href=\"https://docs.scipy.org/doc/scipy/reference/generated/scipy.ndimage.rotate.html\" target=\"_blank\">scipy.ndimage.rotate</a> but I'm worried about memory/speed since I think this requires numpy arrays as input. </p>",
      "rawMarkdown": "Is anyone aware of a library that performs data augmentations on 3d volumes, compatible with PyTorch and ideally works on GPU? \n\nDuring training, I'm loading (B,C,D,H,W)=(batch_size,1,224,224,224) tensors and I'd like to apply rotations/flips in the x-y plane that are constant throughout the z dimension. \n\nI guess one way is to apply the same 2d transformation to every slice but would this be slow? Another approach could be to use [scipy.ndimage.rotate](https://docs.scipy.org/doc/scipy/reference/generated/scipy.ndimage.rotate.html) but I'm worried about memory/speed since I think this requires numpy arrays as input. ",
      "votes": 4
    },
    {
      "id": 1918506,
      "postDate": "2022-08-29T16:12:15.377Z",
      "content": "<p>I would suggest MONAI (<a href=\"https://monai.io\" target=\"_blank\">https://monai.io</a>) which is developed from medical DL projects, it has plenty of augmentation strategies, not limited to flip/rotate. </p>",
      "rawMarkdown": "I would suggest MONAI (https://monai.io) which is developed from medical DL projects, it has plenty of augmentation strategies, not limited to flip/rotate. ",
      "votes": 1
    },
    {
      "id": 1917077,
      "postDate": "2022-08-28T12:06:22.900Z",
      "content": "<p>You could check out Kornia: <a href=\"https://kornia.readthedocs.io/en/latest/augmentation.module.html#transforms3d\" target=\"_blank\">https://kornia.readthedocs.io/en/latest/augmentation.module.html#transforms3d</a></p>",
      "rawMarkdown": "You could check out Kornia: https://kornia.readthedocs.io/en/latest/augmentation.module.html#transforms3d",
      "votes": 1,
      "replies": [
        {
          "id": 1917107,
          "postDate": "2022-08-28T12:36:04.607Z",
          "content": "<p>Just what I was looking for, thank you! </p>",
          "rawMarkdown": "Just what I was looking for, thank you! "
        }
      ]
    },
    {
      "id": 1922184,
      "postDate": "2022-09-01T10:22:23.170Z",
      "content": "<p>(B,C,D,H,W)=(batch_size,1,224,224,224)<br>\nWhat's your train batch size? And What's your GPU type and how many GPUs you have?</p>",
      "rawMarkdown": "(B,C,D,H,W)=(batch_size,1,224,224,224)\nWhat's your train batch size? And What's your GPU type and how many GPUs you have?"
    }
  ],
  "comments": [
    {
      "id": 1917176,
      "author_name": "RabotniKuma",
      "author_url": "",
      "post_date": "2022-08-28T13:37:36.677000",
      "content": "<p>Here is my recommendation: <a href=\"https://github.com/ZFTurbo/volumentations\" target=\"_blank\">https://github.com/ZFTurbo/volumentations</a></p>",
      "votes": 3,
      "replies": []
    },
    {
      "id": 1918506,
      "author_name": "Bardia Khosravi",
      "author_url": "",
      "post_date": "2022-08-29T16:12:15.377000",
      "content": "<p>I would suggest MONAI (<a href=\"https://monai.io\" target=\"_blank\">https://monai.io</a>) which is developed from medical DL projects, it has plenty of augmentation strategies, not limited to flip/rotate. </p>",
      "votes": 1,
      "replies": []
    },
    {
      "id": 1917077,
      "author_name": "Suraj Ghuwalewala",
      "author_url": "",
      "post_date": "2022-08-28T12:06:22.900000",
      "content": "<p>You could check out Kornia: <a href=\"https://kornia.readthedocs.io/en/latest/augmentation.module.html#transforms3d\" target=\"_blank\">https://kornia.readthedocs.io/en/latest/augmentation.module.html#transforms3d</a></p>",
      "votes": 1,
      "replies": [
        {
          "id": 1917107,
          "author_name": "Samuel Cortinhas",
          "author_url": "",
          "post_date": "2022-08-28T12:36:04.607000",
          "content": "<p>Just what I was looking for, thank you! </p>",
          "votes": 0,
          "replies": []
        }
      ]
    },
    {
      "id": 1922184,
      "author_name": "hanjin",
      "author_url": "",
      "post_date": "2022-09-01T10:22:23.170000",
      "content": "<p>(B,C,D,H,W)=(batch_size,1,224,224,224)<br>\nWhat's your train batch size? And What's your GPU type and how many GPUs you have?</p>",
      "votes": 0,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "1917176": "Here is my recommendation: https://github.com/ZFTurbo/volumentations",
    "1917012": "Is anyone aware of a library that performs data augmentations on 3d volumes, compatible with PyTorch and ideally works on GPU? \n\nDuring training, I'm loading (B,C,D,H,W)=(batch_size,1,224,224,224) tensors and I'd like to apply rotations/flips in the x-y plane that are constant throughout the z dimension. \n\nI guess one way is to apply the same 2d transformation to every slice but would this be slow? Another approach could be to use [scipy.ndimage.rotate](https://docs.scipy.org/doc/scipy/reference/generated/scipy.ndimage.rotate.html) but I'm worried about memory/speed since I think this requires numpy arrays as input. ",
    "1918506": "I would suggest MONAI (https://monai.io) which is developed from medical DL projects, it has plenty of augmentation strategies, not limited to flip/rotate. ",
    "1917077": "You could check out Kornia: https://kornia.readthedocs.io/en/latest/augmentation.module.html#transforms3d",
    "1922184": "(B,C,D,H,W)=(batch_size,1,224,224,224)\nWhat's your train batch size? And What's your GPU type and how many GPUs you have?"
  }
}