Output size of GAN Example

4 vues (au cours des 30 derniers jours)
Alvaro Huerta
Alvaro Huerta le 4 Mai 2020
Commenté : Abdullah alsuhail le 27 Août 2020
Hello,
I am using the example of GAN to generate images, and I would like the output generated to be of a different size than 64x64x3, I've tried to change several parameters but I can't get it.
Any ideas?
Thanks in advance.
  3 commentaires
Sai Bhargav Avula
Sai Bhargav Avula le 11 Mai 2020
Can you give the link which example you referred to? Also attach the code that you tried.
Alvaro Huerta
Alvaro Huerta le 11 Mai 2020
Hello,
thanks for your reply.
I have tested the code, the output are images with 64x64 pixels. The example is in the link below.
Thanks for all.

Connectez-vous pour commenter.

Réponses (1)

Sai Bhargav Avula
Sai Bhargav Avula le 11 Mai 2020
Modifié(e) : Sai Bhargav Avula le 11 Mai 2020
Hi,
The final size depends on the generator network architecture.
One way to achieve it is to change the filtersize of the generator may not be the ideal case for this example.
The ideal way is, based on your required output size you have to add transposedConv2dLayer to the architecture with proper filter size.
For example if you want the size to be 128*128 then simply add one more transposedConv2dLayer to the architecture
Remember you need to adjust the filtersize and channels accordingly
Hope this helps!
  3 commentaires
sara almheiri
sara almheiri le 15 Juil 2020
I keep getting a dlfeval error when I do the following adjustments. I would like to generate a 640x640 output size image but first I want to workout your solution. Would love to here back from you.
%Augment data
augmenter = imageDataAugmenter( ...
'RandXReflection',true, ...
'RandScale',[1 2]);
augimds = augmentedImageDatastore([128 128],imds,'DataAugmentation',augmenter);
%Define Generator Netwrok
filterSize = 5;
numFilters = 128;
numLatentInputs = 100;
projectionSize = [4 4 512];
layersGenerator = [
imageInputLayer([1 1 numLatentInputs],'Normalization','none','Name','in')
projectAndReshapeLayer(projectionSize,numLatentInputs,'proj');
transposedConv2dLayer(filterSize,8*numFilters,'Name','tconv1')
batchNormalizationLayer('Name','bnorm1')
reluLayer('Name','relu1')
transposedConv2dLayer(filterSize,4*numFilters,'Stride',2,'Cropping','same','Name','tconv2')
batchNormalizationLayer('Name','bnorm2')
reluLayer('Name','relu2')
transposedConv2dLayer(filterSize,2*numFilters,'Stride',2,'Cropping','same','Name','tconv3')
batchNormalizationLayer('Name','bnorm3')
reluLayer('Name','relu3')
transposedConv2dLayer(filterSize,3,'Stride',2,'Cropping','same','Name','tconv4')
tanhLayer('Name','tanh')];
lgraphGenerator = layerGraph(layersGenerator);
dlnetGenerator = dlnetwork(lgraphGenerator);
Abdullah alsuhail
Abdullah alsuhail le 27 Août 2020
Hi Sara,
Did you find the solution? I stuck with the same problem.
I will appreciate if you can share the code here.
Thank you so much

Connectez-vous pour commenter.

Catégories

En savoir plus sur Image Data Workflows dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by