Training nework: Combined network is not partitionable but each datastore is partitionable

2 次查看(过去 30 天)
I was training an regression network which basically maps noisy image to noise. The input and output are both 384x384x8x2.
The input data is in folder "Train_Noisy", the target data is in folder "Train_Noise", each file is in a mat file.
addpath('Train_Noisy')
addpath('Train_Noise')
Input_Data=fileDatastore(fullfile('Train_Noisy'),'ReadFcn',@Load_Noisy,'FileExtensions','.mat');
Target_Data=fileDatastore(fullfile('Train_Noise'),'ReadFcn',@Load_Noise,'FileExtensions','.mat');
Train_Data=combine(Input_Data,Target_Data);
function Noisy = Load_Noisy(file)
File = load(file);
Noisy = File.Noisy;
end
function Noise = Load_Noise(file)
File = load(file);
Noise = File.Noise;
end
I have two different GPU installed, RTX 2080Ti and RTX 2080.
The training options is
options = trainingOptions('adam', ...
'ExecutionEnvironment','multi-gpu',...
'LearnRateSchedule','piecewise', ...
'InitialLearnRate',1e-3,...
'LearnRateDropFactor',0.9, ...
'LearnRateDropPeriod',1, ...
'MaxEpochs',100, ...
'MiniBatchSize',1, ...
'VerboseFrequency',10,...
'Plots','training-progress')
However, Matlab gives me the error
The input datastore is not Partitionable and does not support parallel operations.
Then I go back and check the inputData, targetData and the combined datastore trainData
>> isPartitionable(Target_Data)
isPartitionable(Input_Data)
isPartitionable(Train_Data)
ans =
logical
1
ans =
logical
1
ans =
logical
0
Thus each datastore is partitionable but the combined is not.
From the isPartitionable, CombinedDatastore is partitionable if all underlying datastores have a subset method or are transformations/combinations of datastores that have subset methods.
I do not know how to add the subset method for each datastore and for the CombinedDatastore.

采纳的回答

Aylin
Aylin 2020-8-19
编辑:Aylin 2020-8-19
Hello Shen Zhao,
This is a known limitation in the FileDatastore + combine workflow.
Even though FileDatastore by itself is partitionable, combining two FileDatastores is currently not defined as partitionable. We are working on ways to remove this limitation in future releases.
One possible workaround for this is to directly import each pair of MAT files in a single FileDatastore. You would need to have some kind of mapping between the filenames used in the Train_Noisy/ and Train_Noise/ datasets for this to work:
addpath('Train_Noisy')
addpath('Train_Noise')
Train_Data = fileDatastore(fullfile('Train_Noisy'), 'ReadFcn', @Load_All, 'FileExtensions', '.mat');
function Data = Load_All(noisy_filename)
File = load(noisy_filename);
Noisy = File.Noisy;
noise_filename = Make_Noise_Filename(noisy_filename);
File = load(noise_filename);
Noise = File.Noise;
Data = [Noisy Noise];
end
You'd also need to define another function here called Make_Noise_Filename that converts filenames from the first dataset to the second dataset. This sidesteps the limitation in FileDatastore + combine for now.
I hope this helps!
Rylan
  2 个评论
Shen Zhao
Shen Zhao 2020-8-21
Thank you Rylan.
I have also made it work by replacing fileDatastore with imageDatastore, nothing else chaged.
Jari Manni
Jari Manni 2022-2-21
is there any updates with this issue. I have come across similar problem when applying custom data augmentation to pixelLabelImageDatastore with transform(...) function, which returns a TransformedDatastore. It somehow becomes not partitionable afterwards.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 AI for Signals 的更多信息

产品


版本

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by