{"id":13410075,"url":"https://github.com/albarqounilab/FedDis-NMI","last_synced_at":"2025-03-14T15:31:47.833Z","repository":{"id":210740866,"uuid":"498852910","full_name":"albarqounilab/FedDis-NMI","owner":"albarqounilab","description":"The source code of FedDis","archived":false,"fork":false,"pushed_at":"2022-06-03T06:40:39.000Z","size":460,"stargazers_count":17,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-07-31T20:40:24.508Z","etag":null,"topics":["deep-learning","federated-learning","medical-imaging"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/albarqounilab.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2022-06-01T18:24:55.000Z","updated_at":"2024-03-15T07:11:01.000Z","dependencies_parsed_at":"2023-12-04T18:50:39.473Z","dependency_job_id":null,"html_url":"https://github.com/albarqounilab/FedDis-NMI","commit_stats":null,"previous_names":["albarqounilab/feddis-nmi"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/albarqounilab%2FFedDis-NMI","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/albarqounilab%2FFedDis-NMI/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/albarqounilab%2FFedDis-NMI/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/albarqounilab%2FFedDis-NMI/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/albarqounilab","download_url":"https://codeload.github.com/albarqounilab/FedDis-NMI/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221481984,"owners_count":16829979,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["deep-learning","federated-learning","medical-imaging"],"created_at":"2024-07-30T20:01:04.829Z","updated_at":"2024-10-26T01:30:29.630Z","avatar_url":"https://github.com/albarqounilab.png","language":"Python","funding_links":[],"categories":["Papers"],"sub_categories":["Reconstruction based"],"readme":"[![License: CC BY-NC-ND 4.0](https://img.shields.io/badge/License-CC_BY--NC--ND_4.0-lightgrey.svg)](https://creativecommons.org/licenses/by-nc-nd/4.0/) [![DOI](https://zenodo.org/badge/498852910.svg)](https://zenodo.org/badge/latestdoi/498852910)\n\n\n# FedDis: Disentangled Federated Learning for Unsupervised Brain Pathology Segmentation\n### Cosmin I Bercea, Benedikt Wiestler, Daniel Rueckert, and [Shadi Albarqouni](https://albarqouni.github.io/)\n\n![FedDis overview](./Fig_1.png)\nThis repository contains the code for our paper on [FedDis: Federated Disentangled Representation Learning for Unsupervised Brain Anomaly Detection](https://assets.researchsquare.com/files/rs-722389/v1_covered.pdf?c=1631875543). \nIf you use any of our code, please cite:\n```\n@article{bercea2021feddis,\n  title={FedDis: Disentangled Federated Learning for Unsupervised Brain Pathology Segmentation},\n  author={Bercea, Cosmin I and Wiestler, Benedikt and Rueckert, Daniel and Albarqouni, Shadi},\n  journal={arXiv preprint arXiv:2103.03705},\n  year={2021}\n}\n\n```\n\n* [FedDis: Disentangled Federated Learning for Unsupervised Brain Pathology Segmentation](#fedis:-disentangled-federated-learning-for-unsupervised-brain-pathology-segmentation)\n  * [Requirements](#requirements)\n  * [Folder Structure](#folder-structure)\n  * [Usage](#usage)\n      * [Data](#data)\n      * [Config file format](#config-file-format)\n      * [Usage](#cli-usage)\n  * [Disclaimer](#disclaimer)\n  * [License](#license)\n    \n\n\u003c!-- /code_chunk_output --\u003e\n\n## Requirements\n* Python \u003e= 3.6\n* This project is based on the federated framework [ILIA](https://github.com/albarqounilab/ILIA) and \n  the [MONAI](https://monai.io) framework\n\nAll additional packages used in this repository are listed in [requirements.txt](https://github.com/albarqounilab/FedDis/blob/main/requirements.txt).\nTo install those, run `pip3 install -r requirements.txt`\n\n## Folder Structure\n  ```\n  FedDis/\n  │\n  ├── feddis_main.py - execute to run in commandline\n  ├── FedAnalytics.py - Stats and evaluations at the end of epochs/training (not implemented)\n  ├── FedDownstreamTask.py - Downstream evaluations for anomaly segmentation and reconstruction fidelity\n  ├── FedPlanner.py - Plans and starts the experimens\n  ├── FedVizu.py - Visuailzations at the end of epochs/training (not implemented)\n  \n  MONAI/monai/ \n  ├── ILIA/- Federated framework based on PyTorch\n  │   ├── core/ - Configuration of the project and experiment\n  │   ├──   ├── FedAggregator/ - Moderates federated traing / Aggregates local updates\n  │   ├──   ├── FedAnalytics/ - Stats and evaluations at the end of epochs/training\n  │   ├──   ├── FedCollaborator/ - Client-side training and testing\n  │   ├──   ├── FedDownstreamTask/ - Downstream evaluations, e.g., Anomaly Detection\n  │   ├──   ├── FedPlanner/ - Plans and starts the experimens\n  │   ├──   ├── FedVizu/ - Visuailzations at the end of epochs/training\n  │   ├── data/ - dataloaders\n  │   ├── models/ - Configuration of different federated methods, e.g., FedAvg, FedDis, SiloBN, etc..\n  │\n  ├── losses/ - Definition of losses \n  ├── metrics/ - Definition of metrics\n  ├── networks/ - Definition of networks (e.g., autoencoder.py)\n  ├── optimizers/ - Definition of optimizers\n  ├── transforms/ - Definition of transforms\n  ├── utils/ - Definition of utils \n\n  ```\n\n## Usage\n\n### Data\nThe publicly available healthy training data used can be downloaded here:\n\n[OASIS-SI](https://www.oasis-brains.org)\n\n[ADNI-SI and ADNI-Ph](http://adni.loni.usc.edu/data-samples/access-data/)\n\nThe publicly available datasets containing anomaly can be downloaded here:\n\n[MSLUB](http://lit.fe.uni-lj.si/tools.php?lang=eng)\n\n[MSISBI](https://smart-stats-tools.org/lesion-challenge-2015)\n\n[WMH](https://wmh.isi.uu.nl)\n\n[BRATS](https://www.med.upenn.edu/sbia/brats2018/data.html)\n\n\n\n### Config file format\nDefine the config file including the desired network, datasets and training hyper-parameters, see the example provided\nconfig/feddis_config.yaml.\n\nIf you want to use your own dataset, check how the dataloaders in `MONAI/monai/ILIA/data/BrainMR/anomaly_detection.py` \nare defined and implement your own to work with our code.\n  ```\n  ## YAML CONFIG FILE\n\nname: FedDis\nexperiment:\n  name: ILIA-test\n  task: test\n  models:\n    client_OASIS: '/path_to_checkpoint/checkpoints/client_OASIS_best_global_model.pt'\n    client_ADNI-S: '/path_to_checkpoint/checkpoints/client_ADNI-S_best_global_model.pt'\n    client_ADNI-P: '/path_to_checkpoint/checkpoints/client_ADNI-P_best_global_model.pt'\n    client_KRI: '/path_to_checkpoint/checkpoints/client_KRI_best_global_model.pt'\nlogging: 1\ndevice: gpu\nmodel:\n  module_name: monai.networks.nets.disentangled_autoencoder\n  class_name: DisAutoEncoder\n  params:\n    intermediate_res: !!python/tuple [16,16]\n    filters_start_shape: 64\n    filters_max_shape: 128\n    filters_start_app: 16\n    filters_max_app: 32\n    use_batchnorm: True\ncollaborator:\n  module_name: monai.ILIA.models.FedDis.FedCollaborator\n  class_name: FedDisCollaborator\n  names:\n    - OASIS\n    - ADNI-S\n    - ADNI-P\n    - KRI\n  params:\n    nr_epochs: 5\n    max_iterations: 1000 # FedVC\n    checkpoint_path: '/path_to_checkpoint/Ilia-test/'\n    data_loader:\n      module_name: monai.ILIA.data.BrainMR.anomaly_detection\n      class_name: NatureHealthyDataLoader\n      params:\n        image_size: !!python/tuple [256, 256]\n        target_size: !!python/tuple  [128, 128]\n        slice_range: !!python/tuple [70, 100]\n        batch_size: 8\n    self_supervision:\n      use: True\n      params:\n        start_x_range: !!python/tuple [30, 90]\n        start_y_range: !!python/tuple [20, 90]\n        width_range: !!python/tuple [3, 20]\n        max_rectangles: 3\n        cval: -1 # -1 = random hyper-intensity\n    optimizer_params:\n      lambda_R: 0.2\n      lambda_S: 1\n      lambda_L: 1\n      round_scl_injection: 25\n      decay_rate: 0.97\n      learning_rate: 0.0001\n      gamma_shift: !!python/tuple [0.5, 2]\n      use_shape_pair: False\naggregator:\n  module_name: monai.ILIA.models.FedDis.FedAggregator\n  class_name: FedDisAggregator\n  params:\n    nr_rounds: 50\n    client_num_in_total: 4\n    client_num_per_round: 4\n    test_frequency: 3\n    checkpoint_path: '/path_to_checkpoint/Ilia-test/'\ntest_data:\n  data_loader_healthy:\n    dataset_names:\n      - OASIS\n      - ADNI-S\n      - ADNI-P\n      - KRI\n    module_name: monai.ILIA.data.BrainMR.anomaly_detection\n    class_name: NatureHealthyDataLoader\n    params:\n      image_size: !!python/tuple [256, 256]\n      target_size: !!python/tuple  [128, 128]\n      slice_range: !!python/tuple [70, 100]\n      batch_size: 8\n  data_loader_anomaly:\n    dataset_names:\n      - MSLUB\n      - MSISBI\n      - MSKRI\n      - GBKRI\n      - BRATS\n    module_name: monai.ILIA.data.BrainMR.anomaly_detection\n    class_name: NatureAnomalyDataLoader\n    params:\n      image_size: !!python/tuple [256, 256]\n      target_size: !!python/tuple  [128, 128]\n      slice_range: !!python/tuple [15, 125]\n      batch_size: 1\ndownstream_tasks:\n  module_name: monai.ILIA.projects.nature_mi_21.FedDownstreamTask\n  class_name: FedDisDownstreamTask\n  params:\nanalytics:\n  module_name: monai.ILIA.projects.nature_mi_21.FedAnalytics\n  class_name: FedDisAnalytics\n  params:\nvizu:\n  module_name:  monai.ILIA.projects.nature_mi_21.FedVizu\n  class_name: FedDisVizu\n  params:\n  \n  ```\n\n### Usage\nFor the results of our paper we used `feddis_main.py`. \nIf you wish just to evaluate an already trained model, set the experiment/task in the config file to test and link to \nthe saved model parameters. \n\n## Disclaimer\nThe code has been cleaned up and polished for clarity and reproducibility. While the code has been thoroughly reviewed, it may contain bugs or errors. Please contact shadi.albarqouni@ukbonn.de if you encounter any problem in this repository.\n\n## License\nThis project is licensed under the Attribution-NonCommercial-NoDerivatives 4.0 International (CC BY-NC-ND 4.0). See [LICENSE](https://github.com/albarqounilab/FedDis-NMI/blob/main/LICENSE.md) for more details\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falbarqounilab%2FFedDis-NMI","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falbarqounilab%2FFedDis-NMI","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falbarqounilab%2FFedDis-NMI/lists"}