where can I get pretrained unet, pixelnet, segnet deconvnet matlab codes for CT lung cancer segmentation?
2 views (last 30 days)
Show older comments
This code fragment causes an error in the decoder and output layer. It provides a derror in the transponse layers of decoder and output layer, concatenation layers of the decoder, relu layerS of decoder and outputlayer and additional input missing and no input connection errors correspondigly.
% Define the UNet architecture
% Define input image size
inputSize = [120 150];
% Number of filters in the first layer
numFilters = 64;
% Number of segmentation classes
numClasses = 2;
% Define encoder layers
encoder_layers = [
imageInputLayer(inputSize)
convolution2dLayer(3, numFilters, 'Padding', 'same')
reluLayer()
convolution2dLayer(3, numFilters, 'Padding', 'same')
reluLayer()
maxPooling2dLayer(2, 'Stride', 2)
convolution2dLayer(3, 2*numFilters, 'Padding', 'same')
reluLayer()
convolution2dLayer(3, 2*numFilters, 'Padding', 'same')
reluLayer()
maxPooling2dLayer(2, 'Stride', 2)
convolution2dLayer(3, 4*numFilters, 'Padding', 'same')
reluLayer()
convolution2dLayer(3, 4*numFilters, 'Padding', 'same')
reluLayer()
maxPooling2dLayer(2, 'Stride', 2)
convolution2dLayer(1, numClasses, 'Name', 'output')
softmaxLayer('Name', 'softmax')
pixelClassificationLayer('Name', 'pixel_class')
];
% Define decoder layers
decoder_layers = [
transposedConv2dLayer(2, 2*numFilters, 'Stride', 2)
reluLayer()
concatenationLayer(3, 2, 'Name', 'concat_1'); % Connect to maxPooling2dLayer in encoder
convolution2dLayer(3, 2*numFilters, 'Padding', 'same')
reluLayer()
convolution2dLayer(3, 2*numFilters, 'Padding', 'same')
reluLayer()
transposedConv2dLayer(2, numFilters, 'Stride', 2)
reluLayer()
concatenationLayer(3, 2, 'Name', 'concat_2'); % Connect to maxPooling2dLayer in encoder
convolution2dLayer(3, numFilters, 'Padding', 'same')
reluLayer()
convolution2dLayer(3, numFilters, 'Padding', 'same')
reluLayer()
transposedConv2dLayer(2, numFilters/2, 'Stride', 2)
reluLayer()
concatenationLayer(3, 2, 'Name', 'concat_3'); % Connect to maxPooling2dLayer in encoder
convolution2dLayer(3, numFilters/2, 'Padding', 'same')
reluLayer()
convolution2dLayer(3, numFilters/2, 'Padding', 'same')
reluLayer()
];
outputLayer = [
concatenationLayer(3, 2, 'Name', 'concat_3') % Connect to maxPooling2dLayer in encoder
transposedConv2dLayer(2, numFilters/2, 'Stride', 2)
reluLayer()
convolution2dLayer(3, numFilters/2, 'Padding', 'same')
reluLayer()
convolution2dLayer(3, numFilters/2, 'Padding', 'same')
reluLayer()
concatenationLayer(3, 2, 'Name', 'concat_2') % Connect to maxPooling2dLayer in encoder
transposedConv2dLayer(2, numFilters, 'Stride', 2)
reluLayer()
convolution2dLayer(3, numFilters, 'Padding', 'same')
reluLayer()
convolution2dLayer(3, numFilters, 'Padding', 'same')
reluLayer()
concatenationLayer(3, 2, 'Name', 'concat_1') % Connect to maxPooling2dLayer in encoder
transposedConv2dLayer(2, 2*numFilters, 'Stride', 2)
reluLayer()
convolution2dLayer(3, 2*numFilters, 'Padding', 'same')
reluLayer()
convolution2dLayer(3, 2*numFilters, 'Padding', 'same')
reluLayer()
convolution2dLayer(1, numClasses, 'Name', 'output')
softmaxLayer('Name', 'softmax')
pixelClassificationLayer('Name', 'pixel_class')
];
output_network = layerGraph(outputLayer);
% Analyze the network to check output sizes
analyzeNetwork(output_network);
2 Comments
Walter Roberson
on 4 Mar 2024
You do not use encoder_layers or decoder_layers after you declare them.
It is correct that inside what you have labeled outputLayer that you do not have any output layer.
Answers (0)
See Also
Categories
Find more on Image Data Workflows in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!