Skip to content

Commit

Permalink
add readmes
Browse files Browse the repository at this point in the history
  • Loading branch information
holgerroth committed Apr 26, 2024
1 parent 5a552c6 commit 201ed3a
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 3 deletions.
4 changes: 4 additions & 0 deletions integration/monai/examples/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Examples of MONAI-NVFlare Integration

### [Converting MONAI Code to a Federated Learning Setting](./mednist/README.md)
A tutorial to show how simple it can be to run an end-to-end classification pipeline with MONAI
and deploy it in a federated learning setting using NVFlare.

### [Simulated Federated Learning for 3D spleen CT segmentation](./spleen_ct_segmentation_sim/README.md)
An example of using [NVIDIA FLARE](https://nvflare.readthedocs.io/en/main/index.html)
to train a medical image analysis model using federated averaging ([FedAvg](https://arxiv.org/abs/1602.05629))
Expand Down
18 changes: 18 additions & 0 deletions integration/monai/examples/mednist/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
## Converting MONAI Code to a Federated Learning Setting

In this tutorial, we will introduce how simple it can be to run an end-to-end classification pipeline with MONAI
and deploy it in a federated learning setting using NVFlare.

### 1. Standalone training with MONAI
[monai_101.ipynb](./monai_101.ipynb) is based on the [MONAI 101 classification tutorial](https://github.com/Project-MONAI/tutorials/blob/main/2d_classification/monai_101.ipynb) and shows each step required in only a few lines of code, including

- Dataset download
- Data pre-processing
- Define a DenseNet-121 and run training
- Check the results on test dataset

### 2. Federated learning with MONAI
[monai_101_fl.ipynb](./monai_101_fl.ipynb) shows how we can simply put the code introduced above into a Python script and convert it to running in an FL scenario using NVFlare.

To achieve this, we utilize the [`FedAvg`](https://arxiv.org/abs/1602.05629) algorithm and NVFlare's [Client
API](https://nvflare.readthedocs.io/en/main/programming_guide/execution_api_type.html#client-api).
6 changes: 3 additions & 3 deletions integration/monai/examples/mednist/monai_101_fl.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"\n",
"# MONAI 101 tutorial with Federated Learning\n",
"\n",
"In this example, the **server** uses the [`FedAvg`](https://github.com/NVIDIA/NVFlare/blob/main/nvflare/app_common/workflows/fedavg.py#L44) controller, which performs the following steps:\n",
"In this example, the **server** uses the [`FedAvg`](https://github.com/NVIDIA/NVFlare/blob/main/nvflare/app_common/workflows/fedavg.py) controller, which performs the following steps:\n",
"1. Initialize the global model. This is achieved through the method `load_model()`\n",
" from the base class\n",
" [`ModelController`](https://github.com/NVIDIA/NVFlare/blob/fa4d00f76848fe4eb356dcde417c136047eeab36/nvflare/app_common/workflows/model_controller.py#L292),\n",
Expand All @@ -56,8 +56,8 @@
"6. The last step is to save the updated global model, again through\n",
" the [`ModelPersistor`](https://nvflare.readthedocs.io/en/main/glossary.html#persistor).\n",
"\n",
"The **clients** implement the local training logic using NVFlare's [`Client\n",
"API`](https://nvflare.readthedocs.io/en/main/programming_guide/execution_api_type.html#client-api)\n",
"The **clients** implement the local training logic using NVFlare's [Client\n",
"API](https://nvflare.readthedocs.io/en/main/programming_guide/execution_api_type.html#client-api)\n",
"[here](./code/monai_mednist_train.py). The Client API\n",
"allows the user to add minimum `nvflare`-specific codes to turn a typical\n",
"centralized training script to a federated client-side local training\n",
Expand Down

0 comments on commit 201ed3a

Please sign in to comment.