A fast tool to do image augmentation by CUDA on GPU(especially elastic deformation), can be helpful to research on Medical Image Analysis. https://github.com/qsyao/cuda_spatial_deform
Authors:Qingsong Yao worked as an intern in system group of Microsoft research Asia for one year, practicing CUDA programming.
Motivation
- When the size of image is too large, it takes a lot of time(much more than forward and backward computation say in U_Net), especially for 3D image(like CT).
- Elastic deformation on CPU is too slow.
- Doing Sptial_Deform by muti-processing consumes of too much CPU resources, to which most GPU servers(like 32 cores with 4 gpus) can not afford.
Implementation Overview
- Doing Spation_Deform on GPU instead of CPU, greatly saving CPU resources.
- Very Fast, speed up 25x for rotation, 45x for elastic_deformation.
- Support many types of spatial deform: flip, rotate, scale, translate, elastic_deformation.
- Support many rules of map_coordinates: mirror, constant, reflect, wrap, nearest.
- Doing Spatial_Deform by doing calculations of coordinates, all transformations get combined before they are applied to the image
- Implement map_coordinates by linear interpolation(for image) and the nearest interpolation(for labels).
- Users can fetch coordinates from CUDA and do cubic interpolation at CPU by scipy.map_coordinates(order = 3)
Citation
If you use our code, please cite our paper:
Chao Huang, Hu Han, Qingsong Yao, Shankuan Zhu, S. Kevin Zhou. , 3D U2-Net: A 3D Universal U-Net for Multi-Domain Medical Image Segmentation, MICCAI 2019.