How to solve Unable to read file: 'E:\TIME-IQ\128QAM\frame_snr30iq_128QAM_100.mat'?
2 views (last 30 days)
Show older comments
I have dataset in .mat file and shape of dataset is [2,1280,2]. I have change the inpu layer of the model by using the deepNetworkDesigner app of matlab. All code works good but when i run below command i got the following error.
net = trainNetwork(imdsTrain,lgraph,options);
error
Error using trainNetwork (line 184)
Unable to read file: 'E:\TIME-IQ\128QAM\frame_snr30iq_128QAM_100.mat'.
Caused by:
Error using matlab.io.datastore.ImageDatastore/read (line 77)
Unable to read file: 'E:\TIME-IQ\128QAM\frame_snr30iq_128QAM_100.mat'.
Error using matlab.io.datastore.exceptions.decorateCustomFunctionError>generateReadFcnError (line 103)
Error using ReadFcn @readDatastoreImage for file:
E:\TIME-IQ\128QAM\frame_snr30iq_128QAM_100.mat
Error using imread>get_format_info (line 545)
Unable to determine the file format.
Error in imread (line 391)
fmt_s = get_format_info(fullname);
Error in readDatastoreImage (line 12)
data = imread(filename);
full code
imds = imageDatastore('E:\TIME-IQ\', ...
'IncludeSubfolders',true, 'FileExtensions','.mat',...
'LabelSource','foldernames');
[imdsTrain,imdsValidation] = splitEachLabel(imds,0.7,'randomized');%%
net = lgraph_2;
net(1)
inputSize = lgraph_2.Layers(1).InputSize;
[learnableLayer,classLayer] = findLayersToReplace(lgraph_2);
[learnableLayer,classLayer]
numClasses = numel(categories(imdsTrain.Labels));
if isa(learnableLayer,'nnet.cnn.layer.FullyConnectedLayer')
newLearnableLayer = fullyConnectedLayer(numClasses, ...
'Name','new_fc', ...
'WeightLearnRateFactor',10, ...
'BiasLearnRateFactor',10);
elseif isa(learnableLayer,'nnet.cnn.layer.Convolution2DLayer')
newLearnableLayer = convolution2dLayer(1,numClasses, ...
'Name','new_conv', ...
'WeightLearnRateFactor',10, ...
'BiasLearnRateFactor',10);
end
lgraph_2 = replaceLayer(lgraph_2,learnableLayer.Name,newLearnableLayer);
newClassLayer = classificationLayer('Name','new_classoutput');
lgraph = replaceLayer(lgraph_2,classLayer.Name,newClassLayer);
miniBatchSize = 128;
valFrequency = floor(numel(imdsTrain.Files)/miniBatchSize);
checkpointPath = pwd;
options = trainingOptions('sgdm', ...
'MiniBatchSize',miniBatchSize, ...
'MaxEpochs',100, ...
'InitialLearnRate',1e-3, ...
'Shuffle','every-epoch', ...
'ValidationData',imdsValidation, ...
'ValidationFrequency',valFrequency, ...
'Verbose',false, ...
'Plots','training-progress', ...
'CheckpointPath',checkpointPath);
net = trainNetwork(imdsTrain,lgraph,options);
Please help
0 Comments
Answers (0)
See Also
Categories
Find more on Image Data Workflows in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!