-
Notifications
You must be signed in to change notification settings - Fork 239
[2.7] Add Brats to research #4026
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Greptile OverviewGreptile SummaryThis PR adds a reference implementation of the 2019 MLMI paper "Privacy-preserving Federated Brain Tumour Segmentation" to the research directory. The implementation uses NVFlare's Job Recipe API with MONAI for medical image segmentation on the BraTS18 dataset. Key additions:
Code quality:
Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant JobScript as job.py
participant Server as NVFlare Server
participant Client1 as Client (site-1)
participant Client2 as Client (site-2)
participant ClientN as Client (site-N)
User->>JobScript: python job.py --n_clients 4
JobScript->>JobScript: Create FedAvgRecipe with BratsSegResNet
JobScript->>JobScript: Configure SVTPrivacy filter (if --enable_dp)
JobScript->>JobScript: Setup SimEnv with GPU config
JobScript->>Server: Execute job with initial model
loop For each FL round (600 rounds)
Server->>Client1: Send global model weights
Server->>Client2: Send global model weights
Server->>ClientN: Send global model weights
Client1->>Client1: Load client-specific datalist (site-1.json)
Client1->>Client1: Validate global model on local data
Client1->>Client1: Train for aggregation_epochs
Client1->>Client1: Compute weight differences
Client1->>Server: Send weight diff + val_dice metric
Client2->>Client2: Load client-specific datalist (site-2.json)
Client2->>Client2: Validate global model on local data
Client2->>Client2: Train for aggregation_epochs
Client2->>Client2: Compute weight differences
Client2->>Server: Send weight diff + val_dice metric
ClientN->>ClientN: Load client-specific datalist (site-N.json)
ClientN->>ClientN: Validate global model on local data
ClientN->>ClientN: Train for aggregation_epochs
ClientN->>ClientN: Compute weight differences
ClientN->>Server: Send weight diff + val_dice metric
alt Differential Privacy enabled
Server->>Server: Apply SVTPrivacy filter to weight diffs
end
Server->>Server: Weighted average aggregation (FedAvg)
Server->>Server: Track best model by val_dice
Server->>Server: Log metrics to TensorBoard
end
Server->>JobScript: Return best_FL_global_model.pt
JobScript->>User: Display job status and result path
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 file reviewed, 1 comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds a complete BraTS18 3D brain tumor segmentation research example built on NVFlare’s Recipe API and MONAI, including job configuration, client training, dataset splits, and evaluation utilities.
Changes:
- Introduces a BratsSegResNet model wrapper, NVFlare FedAvg job configuration (with optional DP), and a client training script using MONAI for BraTS18.
- Adds BraTS18 dataset structure and per-site datalist JSON splits for federated vs. centralized training, plus a detailed README documenting setup and usage.
- Provides evaluation and visualization utilities (testing script, TensorBoard event plotting, and requirements files) for comparing centralized, FedAvg, and FedAvg+DP runs.
Reviewed changes
Copilot reviewed 15 out of 17 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
research/brats18/.gitignore |
Ignores large BraTS18 training data, model checkpoints, and Python cache files to keep the repo lightweight. |
research/brats18/README.md |
Documents the BraTS18 federated learning example, including installation, data layout, job configuration, run commands, and result interpretation. |
research/brats18/client.py |
Implements the NVFlare Client API-based training loop using MONAI (data loading, augmentation, Dice loss, optional FedProx, validation, and FL communication). |
research/brats18/job.py |
Configures and runs a FedAvgRecipe job for BraTS18, wiring in the client script, model factory, TensorBoard tracking, and optional SVT-based DP filter. |
research/brats18/model.py |
Defines BratsSegResNet and create_brats_model(), wrapping MONAI’s SegResNet and storing constructor args for NVFlare serialization. |
research/brats18/requirements.txt |
Lists core Python dependencies for training and evaluation (PyTorch, MONAI, tensorboard, etc.). |
research/brats18/plot-requirements.txt |
Lists plotting dependencies used by the TensorBoard event plotting utility (TensorFlow, seaborn, matplotlib). |
research/brats18/result_stat/brats_3d_test_only.py |
Loads a trained SegResNet checkpoint and computes per-class and overall Dice scores on the BraTS18 validation set using MONAI inferers and transforms. |
research/brats18/result_stat/plot_tensorboard_events.py |
Reads TensorBoard event files from simulation workspaces and generates comparison plots for validation metrics across centralized, FedAvg, and FedAvg+DP experiments. |
research/brats18/result_stat/testing_models_3d.sh |
Shell helper script to run brats_3d_test_only.py against the best global models from centralized, FedAvg, and FedAvg+DP jobs in the default simulation workspace. |
research/brats18/dataset_brats18/dataset/README.md |
Briefly instructs users where to place downloaded BraTS18 training data under the local dataset directory. |
research/brats18/dataset_brats18/datalist/site-1.json |
Defines BraTS18 train/validation splits assigned to federated client “site-1” plus shared validation set metadata. |
research/brats18/dataset_brats18/datalist/site-2.json |
Defines BraTS18 train/validation splits assigned to federated client “site-2” plus shared validation set metadata. |
research/brats18/dataset_brats18/datalist/site-3.json |
Defines BraTS18 train/validation splits assigned to federated client “site-3” plus shared validation set metadata. |
research/brats18/dataset_brats18/datalist/site-4.json |
Defines BraTS18 train/validation splits assigned to federated client “site-4” plus shared validation set metadata. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No files reviewed, no comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No files reviewed, no comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2 files reviewed, 2 comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No files reviewed, no comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No files reviewed, no comments
holgerroth
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No files reviewed, no comments
|
/build |
|
/build |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No files reviewed, no comments
Fixes # .
Description
A few sentences describing the changes proposed in this pull request.
Types of changes
./runtest.sh.