How to get nonempty layer in GAN deep learning?

조회 수: 3 (최근 30일)
SREERAJ WARRIER
SREERAJ WARRIER 2022년 2월 15일
답변: Avadhoot 2023년 11월 8일
I have a code. However it is not giver me layers in my deep learning GAN code:
imds = imageDatastore("C:\Users\Sreeraj\Desktop\Me\PhD\Mahindra\DL",'IncludeSubfolders',true,'FileExtensions',(".png"),"LabelSource","foldernames");
augmenter = imageDataAugmenter(RandXReflection=true);
augimds = augmentedImageDatastore([64 64],imds,DataAugmentation=augmenter);
filterSize = 5;
numFilters = 32;
numLatentInputs = 10;
projectionSize = [4 4 512];
layersGenerator = [
featureInputLayer(numLatentInputs)
fullyConnectedLayer(prod(projectionSize))
transposedConv2dLayer(filterSize,4*numFilters)
batchNormalizationLayer
reluLayer
transposedConv2dLayer(filterSize,2*numFilters,Stride=2,Cropping="same")
batchNormalizationLayer
reluLayer
transposedConv2dLayer(filterSize,numFilters,Stride=2,Cropping="same")
batchNormalizationLayer
reluLayer
transposedConv2dLayer(filterSize,3,Stride=2,Cropping="same")
sigmoidLayer];
lgraphGenerator = layerGraph(layersGenerator);
Do I need to add some layer in this structure? I have only 20 images classified equally 10+10.

답변 (1개)

Avadhoot
Avadhoot 2023년 11월 8일
Hi Sreeraj,
I understand that you have built a neural network using the “layerGraph” function. But you are not able to see the layers in your GAN network. This means that there is some issue in the layer construction itself.
Usually the first step after constructing the layers is to run the “analyzeNetwork” function on the layer graph. You can follow the below syntax to do the same:
analyzeGraph(lgraphGenerator);
For your code the output of this command comes out to be the following:
The analysis has come up with 3 errors. The errors are as follows:
  1. The first error occurs in the “transposedConv2dLayer”. The function requires input data which is in the form of [height, width, numChannels]. To resolve this please check the input data for the “transposedConv2dLayer
  2. The missing output layer error occurs because there is an error on the last layer i.esigmoid. You must use a classification layer after the sigmoid layer.
  3. The error on the sigmoid layer states that there is an unconnected output. For this you need to check the dimensions of the input data for sigmoid layer and also check if the sequence of layer is correct.
After resolving the above errors you should see the layers of your network without any problem
Refer to the below documentation to know more about transposedConv2dLayer” and sigmoid layer:
  1. https://www.mathworks.com/help/deeplearning/ref/classificationlayer.html
  2. https://www.mathworks.com/help/deeplearning/ref/nnet.cnn.layer.sigmoidlayer.html
  3. https://www.mathworks.com/help/deeplearning/ref/transposedconv2dlayer.html
For more information about “analyzeNetwork” refer to the below documentation:
I hope this helps.

카테고리

Help CenterFile Exchange에서 Deep Learning Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by