Train Generative Adversarial Network (GAN)
4 ビュー (過去 30 日間)
古いコメントを表示
I played around with the GAN-Example at
and it works without any problems when just running the software.
I now modified the layersGenerator with an additional fullyConnectedLayer just after the imageInputLayer
imageInputLayer([1 1 numLatentInputs],'Normalization','none','Name','in')
fullyConnectedLayer(numLatentInputs,'Name','fc'); % <- this line is new, nothing special
transposedConv2dLayer(filterSize,8*numFilters,'Name','tconv1')
...
even though analyzeNework seems to be fine with it (the outcome also provides a [1 1 100] dimensional array
learning fails with the comment
"Invalid input data. Convolution operation is supported only for 1, 2, or 3 spatial dimensions."
Do you have any ideas or workarounds how to handle this?
0 件のコメント
採用された回答
Raunak Gupta
2019 年 12 月 2 日
Hi,
The fullyConnectedLayer is generally used at the end of Network for generating single dimension output useful in Classification/Regression problem. As I understand the need of using fullyConnectedLayer in above scenario is to get a mapping from random input to a more complex linear transformation of input. Here, the fullyConnectedLayer will not return a 3-D output needed as input for transposedConv2dLayer that is why invalid input data error is coming.
I suggest defining the custom layer with the following template or using a convolution2dLayer which can return same output as mentioned ([1,1,100]) for this purpose.
0 件のコメント
その他の回答 (3 件)
Bodo Rosenhahn
2019 年 12 月 2 日
1 件のコメント
Raunak Gupta
2019 年 12 月 2 日
Hi,
The FC layer will only generate a single dimension output, you may check by
outputSize = lgraphGenerator.Layers(2).OutputSize
Here Layers(2) represents FC layer. analyzeNetwork will say that its dimension as 1x1x100 but its actually 100. At the end part of Network these single dimension output doesn't cause any error. The FC layer is designed in such way that it is usable only at the end part because its usability. As for the bottleneck layers of Autoencoder, currently we have segnetLayers and unetLayers which does not contain FC Layers in bottleneck part.
That is why I suggested moving to convolution2dLayer to acheive the same functionality.
For dlnetwork it is used so that writing custom loops won't create problems related to dlarrays.
Hope this clarifies some queries.
Bodo Rosenhahn
2019 年 12 月 4 日
1 件のコメント
Raunak Gupta
2019 年 12 月 5 日
Hi,
You have accepted your Answer, It will mislead any user coming to this question as your answer didn't provide any solution. It would be helpful if you unaccept above answer and accept the actual answer if that one worked for you.
MEP
2020 年 1 月 23 日
Hi, i need to use the GAN but my input data is a matrix of acceleration signals where each row contain the samples of the signal. So in each row i have different signals, how can i put it in input? I can put it as a matrix or i need to separate the matrix in array and put single array? Thanks...
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Custom Training Loops についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!