Train Generative Adversarial Network (GAN)
조회 수: 3 (최근 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!