# Advanced Examples of 3D Brain Tumor Segmentation and Experiment Manager
This repository uses code based on the product example for "3-D Brain Tumor Segmentation Using Deep Learning", see
https://www.mathworks.com/help/releases/R2021a/deeplearning/ug/segment-3d-brain-tumor-using-deep-learning.html?s_tid=doc_srchtitle. The 3-D Brain Segmentation uses the BRaTS dataset that is volumetric representations of the brain with 4 channels or modalities. The examples here were implemented based on my work with a University of Freiburg research team using a head&neck dataset with 7 modalities. See 1) Bielak, L., Wiedenmann, N., Berlin, A. et al. Convolutional neural networks for head and neck tumor segmentation on 7-channel multiparametric MRI: a leave-one-out analysis. Radiat Oncol 15, 181 (2020). https://doi.org/10.1186/s13014-020-01618-z
The paper was followed by a presentation I gave to the NVIDIA® GTC conference titled "Scale Your Deep Learning Research from Desk to Cloud with MATLAB: Implementing Multiple AI Experiments for Head and Neck Tumor Segmentation"
with emphasis on showing some advanced features implemented with the Experiment Manager. I am including in this repository the code I presented and a blog that goes into more detail of the work.
ParameterSweepingWithExpMgr: modified the Brain Segmentation code to demonstrate how the Experiment Manager App can be used to do a Leave-One-Out analysis, as well as, Bayesian Optimization for hyperparameter determination.
segment3DBrainTumorUsingExpMgr: incorporates a number of advanced features which were implemented with a custom training loop and parallel communication and constructs. The two major features are implementing a virtual minibatch size by aggregating losses over sub-iterations which emulate multi-gpu's and background tasks running in the background to facilitate validation and plotting. This code will also run independent of the experiment manager. See the presentation slides for more information on the included features.
## Setup
I recommend running the product based 3D Brain Example first from the link above. And change the conditions to allow for actual training so that you confirm that your computer configuration is correct for doing this. The full training will take a long time so you might want to make a plan to stop it early by either reducing the data size or number of epochs, etc. or hit the stop button. In doing this, it will download the BRaTS dataset and pre-process the dataset.
The example code in this repository will do the same thing if the dataset doesn't exist, but it is better to confirm with original example. Also when running from the experiment manager it does not allow the use of debugging code, so this is more easily done with the original. Also, it will be easier to seek help from technical support when first trying to get it correct using the product example.
Copy the repository to a folder.
The examples here are advanced, so I recommend becoming familiar with the basics of the experiment manager app by going throught the product documentation and examples.
ParameterSweepingWithExpMgr includes the experiment setups for Leave-One-Out (LOO) and Bayesian Optimization.
1. start experimentManager app, either from command line or Apps tab
2. open the experiment manager project ParameterSweepingWithExpMgr\ParameterSweepingWithExpMgr.prj
3. In the project there are experiments for either BayesOptimization or Leave-One-Out
4. If you have multiple gpu's you can
a) run the default parallel cluster or explicitly specify how many gpu's you want to use with parpool command
For example, parpool(4) to run 4 gpu's.
b) select <Use Parallel> button on the app ribbon.
5) select <Run> button on the app ribbon to begin experimentation
segment3DBrainTumorUsingExpMgr includes the setup for the corresponding experiment.
1. start experimentManager app, either from command line or Apps tab
2. open the experiment manager project segment3DBrainTumorUsingExpMgr\segment3DBrainTumorUsintExpMgr.prj
3. In the project there is a single experiment: Experiment1
4. The script internally uses multi-gpu's by default so you cannot select UseParallel.
5) select <Run> button on the app ribbon to begin experimentation
Note the first Hyperparameters, "trialParams", is an array of strings. This was done to directly associate two corresponding parameters that are converted to integers in the function. The first of the pair in each string represents the channel to be left out and the second is the trial number to associated with it for output reporting purposes. The remainder of hyperparameters are fixed. Also note that it can be run in single 'gpu' mode by changing the executionEnvironment parameter.
For either of experiment wrapper functions, they can be called directly to support debugging. Just call them with a params structure that matches the Hyperparameters list. For example:
params.initialLearnRate = 5e-3;
params.learnRate = .85e-3;
segment3DBrainTumor_LOOWrapper_single(params);
or
params.trialParams = "0 1";
params.maxEpochs = 3;
params.miniBatchSize = 4;
params.executionEnvironment = "multi-gpu"
params.miniBatchMultiplier = 4;
params.secondaryUI_HideRedundantInfo = 0;
segment3DBrainTumorUsingExpMgr(params,[]);
segment3DBrainTumorUsingExpMgr([],[]) will use default hyperparameters.
The custom training function does not facilitate debugging when in multi-gpu mode.
As noted previously, the experiment manager app doesn't allow debugging. However you can still run the function wrappers direcly
Additional information about set up
### MathWorks Products (https://www.mathworks.com)
Requires MATLAB release R#### or newer
- R2021a(https://www.mathworks.com/downloads/web_downloads/)
- Image Processing Toolbox(https://www.mathworks.com/products/image.html)
- Computer Vision Toolbox(https://www.mathworks.com/products/computer-vision.html)
- Parallel Computing Toolbox(https://www.mathworks.com/products/parallel-computing.html)
- Deep Learning Toolbox(https://www.mathworks.com/products/deep-learning.html)
## Installation
Installation instuctions
Before proceeding, ensure that the below products are installed:
* R2021a(https://www.mathworks.com/downloads/web_downloads/)
* Image Processing Toolbox(https://www.mathworks.com/products/image.html)
* Computer Vision Toolbox(https://www.mathworks.com/products/computer-vision.html)
* Parallel Computing Toolbox(https://www.mathworks.com/products/parallel-computing.html)
* Deep Learning Toolbox(https://www.mathworks.com/products/deep-learning.html)
## License
The license for https://github.com/mathworks/Advanced-Examples-Of-3D-Brain-Tumor-Segmentation-And-Exp-Mgr is available in the [LICENSE.TXT](LICENSE.TXT) file in this GitHub repository.
## Community Support
[MATLAB Central](https://www.mathworks.com/matlabcentral)
Copyright 2021 The MathWorks, Inc.
DavidWangYang
- 粉丝: 3564
- 资源: 371
最新资源
- Python_免费开源加密交易机器人.zip
- Python_免费是指《帝国时代2》引擎的自由开源克隆版.zip
- Python_面向科学家和工程师的深度学习和强化学习库.zip
- Python_免费在线教科书的Jupyter笔记本为快速计算线性代数课程.zip
- 移动机器人路径规划(人工势场法),本次路径规划的代码是基于matlab语言的,该方法的基本思想是机器人受到来自目的地的引力以及受到来自障碍物的斥力 这 些力形成合力后驱使机器人避开障碍物后移向目的地
- 机械设计堆垛机sw18可编辑全套设计资料100%好用.zip.zip
- 多编组列车仿真,车体加载fluent里导出的气动力进行仿真 利用脚本建立fluent里的导出的气动力数据和simpack力元的接口进行快速的数据更新
- 编译原理词法分析的实现
- 电压电流双闭环NPC三电平逆变器的仿真,采用载波层叠调制
- Wincc报表模板 1、数据库存储全局脚本 存储时间自由设置 2、报表查询VBS脚本,带下拉框,组合框,查询内容自由选择,时间自由选择 3、导出到本地EXECL 并打印 4、各类控件,语音报警
- 数据快速拷贝软件,拷贝速度为WINDOWS的2-7倍 具有不间断、挑选拷贝、快速删除、剪切等功能
- MATLAB基础应用精讲-【智能优化算法】黏菌算法(SMA)(附MATLAB和python代码实现)
- CS1.5★ALAN装逼脚本Ver.2025.03.弹道版【ALT开压枪】
- 有源电力滤波器APF MATLAB仿真 选阶补偿,matlab版本V2014,基于LCL滤波器的I型三电平拓扑仿真模型,三相四线制,软件锁相环,C语言编程提取谐波指令,直流电压和中点电位控制稳定
- 修复版早起打卡+完美细教程+修复支付接口问题已完美运营
- 光储一体机仿真模型,光伏与储能在直流侧耦合,采用boost电路加NPC电路,基于MATLAB Simulink建模仿真 闭环控制仿真模型,可以进行功率调度和充放电控制 仿真模型使用MATLAB 2
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈