Comparison of CNN training results using image datastore and image arrays

2 vues (au cours des 30 derniers jours)
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.

Réponse acceptée

Anmol Dhiman
Anmol Dhiman le 2 Fév 2021
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

Plus de réponses (0)

Catégories

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

Produits


Version

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by