Skip to content

Code implementation of "FUSC: Fetal Ultrasound Semantic Clustering of Second Trimester Scans Using Deep Self-supervised Learning" paper

License

Notifications You must be signed in to change notification settings

BioMedIA-MBZUAI/FUSC

Repository files navigation

FUSC: Fetal Ultrasound Semantic Clustering of Second Trimester Scans Using Deep Self-supervised Learning

This repo contains the Pytorch implementation of our paper:

FUSC: Fetal Ultrasound Semantic Clustering of Second Trimester Scans Using Deep Self-supervised Learning

Hussain Alasmawi, Leanne Bricker, and Mohammad Yaqub.

Installation

The code runs with recent Pytorch versions, e.g. 1.4. Assuming Anaconda, the most important packages can be installed as:

conda install pytorch torchvision cudatoolkit -c pytorch
conda install matplotlib scipy scikit-learn   # For evaluation and confusion matrix visualization
conda install faiss-gpu                       # For efficient nearest neighbors search 
conda install pyyaml easydict                 # For using config files
conda install termcolor                       # For colored print statements

We refer to the requirements.txt file for an overview of the packages in the environment we used to produce our results.

Dataset

We provide the code for clustering public fetal ultrasound plane found here

Use the images_resized.ipynb to preprocess the dataset.

Setup

The following files need to be adapted in order to run the code on your own machine:

  • Specify the output directory in configs/env.yml. All results will be stored under this directory.
  • Specify the csv_path and img_folder_path in 'configs//_US.yml'

Train model

The configuration files can be found in the configs/ directory. The training procedure consists of the following steps:

  • STEP 1: Solve the pretext task i.e. simclr.py
  • STEP 2: Perform the clustering step i.e. fusc.py
  • STEP 3: Perform the self-labeling step i.e. selflabel.py

For example, run the following commands sequentially to perform our method on fetal ultrasound dataset:

python simclr.py --config_env configs/your_env.yml --config_exp configs/pretext/simclr_USyml
python scan.py --config_env configs/your_env.yml --config_exp configs/fusc/fusc_US.yml
python selflabel.py --config_env configs/your_env.yml --config_exp configs/selflabel/selflabel_US.yml

Citation

If you find this repo useful for your research, please consider citing our paper:

@misc{alasmawi2023fusc,
      title={FUSC: Fetal Ultrasound Semantic Clustering of Second Trimester Scans Using Deep Self-supervised Learning}, 
      author={Hussain Alasmawi and Leanne Bricker and Mohammad Yaqub},
      year={2023},
      eprint={2310.12600},
      archivePrefix={arXiv},
      primaryClass={cs.CV}
}

For any enquiries, please contact the main authors.

License

This software is released under a creative commons license which allows for personal and research use only. For a commercial license please contact the authors. You can view a license summary here.

Acknowledgements

This code based on SCAN

About

Code implementation of "FUSC: Fetal Ultrasound Semantic Clustering of Second Trimester Scans Using Deep Self-supervised Learning" paper

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published