필터 지우기
필터 지우기

Comparison of CNN training results using image datastore and image arrays

조회 수: 1 (최근 30일)
Hello,
The question pertains to the following example:
You can see the loss results when the image datastore object is used (as it is in the original example) below with the following function call:
net = trainNetwork(dsTrain,layers,options);
However, if you extract the same datastore (dsTrain) into 4d array of images and split the input and target images into XTrain and YTrain as follows:
dsTrainNoisy_transformed_combined_augmented_temp=readall(dsTrain);
dsTrainNoisy_transformed_combined_augmented=dsTrainNoisy_transformed_combined_augmented_temp(:,1);
dsTrainNoisy_transformed_combined_augmented_2=zeros(32,32,1,9500);
for i=1:9500
dsTrainNoisy_transformed_combined_augmented_2(:,:,:,i)=dsTrainNoisy_transformed_combined_augmented{i,1};
end
dsTrainNoiseless_transformed_combined_augmented_temp=readall(dsTrain);
dsTrainNoiseless_transformed_combined_augmented=dsTrainNoiseless_transformed_combined_augmented_temp(:,2);
dsTrainNoiseless_transformed_combined_augmented_2=zeros(32,32,1,9500);
for i=1:9500
dsTrainNoiseless_transformed_combined_augmented_2(:,:,:,i)=dsTrainNoiseless_transformed_combined_augmented{i,1};
end
XTrain=dsTrainNoisy_transformed_combined_augmented_2;
YTrain=dsTrainNoiseless_transformed_combined_augmented_2;
net = trainNetwork(XTrain,YTrain,layers,options);
The following Loss curve is obtained:
I don't understand why this is the case, since XTrain and YTrain represent the same images as in the data store itself, and nothing else is changed, so why are the results different this time around?
Any help would be highly appreciated.

채택된 답변

Anmol Dhiman
Anmol Dhiman 2021년 2월 2일
Hi Radians,
I got similar results for the case you explained. Follow the attached example for the same.
The error is caused as you have called readall() twice. On verfication I found that the data present after multple readall() commands is not same .
Hope it helps

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Image Data Workflows에 대해 자세히 알아보기

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by