In the example, 25 images are generated. How do I generate one image
조회 수: 3 (최근 30일)
이전 댓글 표시
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1594836/image.png)
In this GAN example, 25 images were generated, I wanted to generate 1 image, and I changed the code
‘numValidationImages = 25’ to ‘numValidationImages = 1’
This is the image I generated after training. What went wrong
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1594841/image.png)
댓글 수: 0
채택된 답변
Mike Croucher
2024년 1월 19일
The imtile command should be removed when you only have one image:
Go down to the Generate New Images section and change numObservations
numObservations = 1;
ZNew = randn(numLatentInputs,numObservations,"single");
ZNew = dlarray(ZNew,"CB");
if canUseGPU
ZNew = gpuArray(ZNew);
end
XGeneratedNew = predict(netG,ZNew);
% I = imtile(extractdata(XGeneratedNew)); % Use this if numObservations is > 1
I = extractdata(XGeneratedNew); % Use this if numObservations == 1
I = rescale(I);
figure
image(I)
axis off
title("Generated Images")
추가 답변 (1개)
Aradhy
2024년 11월 19일
numObservations = 1;
ZNew = randn(numLatentInputs,numObservations,"single");
ZNew = dlarray(ZNew,"CB");
if canUseGPU
ZNew = gpuArray(ZNew);
end
XGeneratedNew = predict(netG,ZNew);
% I = imtile(extractdata(XGeneratedNew)); % Use this if numObservations is > 1
I = extractdata(XGeneratedNew); % Use this if numObservations == 1
I = rescale(I);
figure
image(I)
axis off
title("Generated Images")
댓글 수: 1
Image Analyst
2024년 11월 19일
참고 항목
카테고리
Help Center 및 File Exchange에서 Electrical Block Libraries에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!