Comparison of CNN training results using image datastore and image arrays

2 ビュー (過去 30 日間)
Radians
Radians 2021 年 1 月 24 日
回答済み: Anmol Dhiman 2021 年 2 月 2 日
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 Center および File ExchangeImage Data Workflows についてさらに検索

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by