Skip to content

HySonLab/LightMed

Repository files navigation

FFTMed:
A PyTorch Implementation

Tested PyTorch Versions License


Yes, I am FFTMed!

🎉 This is a PyTorch/GPU implementation of the paper FFTMed, which learning on frequecy domain.

FFTMed

📝[[Paper]] </>[code]

FFTMed: Leveraging Fast-Fourier Transform for a Lightweight and Adversarial-Resilient Medical Image Segmentation Framework

An efficient FFT-based model for medical image segmentation. The algorithm is elaborated on our paper [FFTMed: Leveraging Fast-Fourier Transform for a Lightweight and Adversarial-Resilient Medical Image Segmentation Framework]

Requirement

pip install -r requirement.txt

Example Cases

Melanoma Segmentation from Skin Images (2018)

  1. Download ISIC_2018 dataset we processing from (https://zenodo.org/records/15310397). You must download and your dataset folder under "data" should be like:
ISIC_2018
---- image_train.npy  
---- mask_train.npy 
----dataset
|   ----test_0
|   |   |images_test.npy
|   |   |masks_test.npy
|   ----test_1
|   |   |images_test.npy
|   |   |masks_test.npy
|   ----test_2
|   |   |images_test.npy
|   |   |masks_test.npy
|   ----test_3
|   |   |images_test.npy
|   |   |masks_test.npy       
|   ----test_4
|   |   |images_test.npy
|   |   |masks_test.npy 
 
  1. For training, example run: python train.py --num_epochs 300 --batch_size 16 -- image_size 256 -- work_dir *folder save weight*

  2. For evaluation noise, example run: python test.py --model_paths *folder you save checkpoint* --test_dataset_paths *folder test_ dataset* --image_size 256

  3. For evaluation attack, example run: python test_fgsm_attack.py --model_path *folder you save checkpoint* --test_dataset_path *folder test dataset* --attack

Other datasets we used

Run on your own dataset

We suggest you following this notebook to set up your own dataset Link repair Dataset. Welcome to open issues if you meet any problem. It would be appreciated if you could contribute your dataset extensions. Unlike natural images, medical images vary a lot depending on different tasks. Expanding the generalization of a method requires everyone's efforts.

Thanks

Code copied a lot from soleilssss/ FFCNet, soleilssss/ AFACNet, JCruan519/EGE-UNet, and adam-dziedzic/bandlimited-cnns