Specify Output Class For GAN Image Generator

조회 수: 2 (최근 30일)
james flynn
james flynn 2021년 4월 17일
댓글: Mahesh Taparia 2021년 9월 15일
In MATLAB's 'Train Generative Adversarial Network' example, the final step is to generate new images using the predict function and the following code.
%% Generate New Images
numObservations = 25;
ZNew = randn(numLatentInputs,numObservations,'single');
dlZNew = dlarray(ZNew,'CB');
if (executionEnvironment == "auto" && canUseGPU) || executionEnvironment == "gpu"
dlZNew = gpuArray(dlZNew);
end
dlXGeneratedNew = predict(dlnetGenerator,dlZNew);
I = imtile(extractdata(dlXGeneratedNew));
I = rescale(I);
figure
image(I)
axis off
title("Generated Images")
The example produces a random sample of 25 images from 5 classes. I want to modify this to request one image from a specific class. For example, generate 5 images for the 'Dandilion' class. Can someone help me understand if it's possible to request specific generator outputs like this? Thanks in advance.

채택된 답변

Mahesh Taparia
Mahesh Taparia 2021년 4월 21일
Hi
You can possibly try with conditional GAN to generate images of a particular class. For more information, you can refer this documentation of conditional GAN. You can refer here for image generation.
  댓글 수: 2
Nagwa megahed
Nagwa megahed 2021년 9월 13일
Thanxs for your comment , can i ask you aquestion according to GAN ?
I hope to find the answer with you
how can i save the synthetic images( the generated images by GAN) in the disk space,
in other words, how can i save these images in a folder to use it in training a deep network ?
the example here , doesn't show the way

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by