Training Generative Adversarial Networks (GANs)

5 views (last 30 days)
Here I have a GAN example
Here is the source of the case:
The structure of the generator is
filterSize = 5;
numFilters = 64;
numLatentInputs = 100;
projectionSize = [4 4 512];
layersGenerator = [
featureInputLayer(numLatentInputs)
projectAndReshapeLayer(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")
tanhLayer];
The following error appears in the command line window:
'projectAndReshapeLayer' is used in the following examples:
Generate Synthetic Signals Using Conditional Generative Adversarial Network
Include Custom Layer in Network
Train Conditional Generative Adversarial Network (CGAN)
Train Generative Adversarial Network (GAN)
Train Wasserstein GAN with Gradient Penalty (WGAN-GP)
Error in s3 (line 39)
projectAndReshapeLayer(projectionSize,numLatentInputs,'Name','proj');
I don't know why the error occurred? Hopes they can be informed

Answers (1)

Amey Waghmare
Amey Waghmare on 4 Jan 2023
Hi,
As per my understanding, you are facing an error for ‘projectAndReshapeLayer' while following the example Train Generative Adversarial Network (GAN).
‘projectAndReshapeLayer’ is a custom layer, and is provided as a part of this example, as mentioned in ‘Define Generative Adversarial Network’ section. In order to use this custom layer, you can open this example in MATLAB as a live script by typing the following in the Command Window,
openExample('nnet/TrainGenerativeAdversarialNetworkGANExample')
This will add the ‘projectAndReshapeLayer’ in the MATLAB path.

Community Treasure Hunt

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

Start Hunting!