Different network architectures between downloaded and script-created networks - Tutorial: 3-D Brain Tumor Segmentation Using Deep Learning
1 view (last 30 days)
Show older comments
Hi,
In the tutorial 3-D Brain Tumor Segmentation Using Deep Learning, the network dowloaded directly from the MATLAB repository using the command
trained3DUnetURL = "https://www.mathworks.com/supportfiles/"+ ...
"vision/data/brainTumor3DUNetValid.mat";
downloadTrainedNetwork(trained3DUnetURL,dataDir);
is different than the network created following the tutorial instructions, in particular the commands
numChannels = 4;
inputPatchSize = [patchSize numChannels];
numClasses = 2;
[lgraph,outPatchSize] = unet3dLayers(inputPatchSize, ...
numClasses,ConvolutionPadding="valid");
outputLayer = dicePixelClassificationLayer(Name="Output");
lgraph = replaceLayer(lgraph,"Segmentation-Layer",outputLayer);
inputLayer = image3dInputLayer(inputPatchSize, ...
Normalization="none",Name="ImageInputLayer");
lgraph = replaceLayer(lgraph,"ImageInputLayer",inputLayer);
In the first case - downloaded network - the classification layer is at the end, while in the case of the created network this layer is before the cropping layers.
Does anybody have an explanation for this discrepancy?
Best,
Jacopo
0 Comments
Accepted Answer
Ben
on 20 Sep 2023
Do you mean the order as described by lgraph.Layers? I can see that.
The order of lgraph.Layers is independent of the order the graph is executed in a network object. For example you can do the following:
lgraph = layerGraph();
lgraph = addLayers(lgraph,reluLayer(Name="addedFirst"));
lgraph = addLayers(lgraph,featureInputLayer(1,Name="addedSecond"));
lgraph = connectLayers(lgraph,"addedSecond","addedFirst");
This will have lgraph.Layers in the order that layers were added, but due to the input layer and connections data actually flows as "input -> addedSecond (input layer) -> addedFirst -> output". You can see this by calling analyzeNetwork(lgraph).
I suspect the reason is just that unet3dLayers constructs the graph in a different order than the saved .mat version of the network was created.
0 Comments
More Answers (0)
See Also
Categories
Find more on Image Data Workflows in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!