Unrecognized field name "data".

24 次查看(过去 30 天)
%% This is a training code of Generic-ADMM-CSNet for a complex-valued MR training dataset by L-BFGS optimizing.
%% If you use this code, please cite our paper:
%% [1] Yan Yang, Jian Sun, Huibin Li, Zongben Xu. ADMM-CSNet: A Deep Learning Approach for Image Compressive Sensing, TPAMI(2019).
%% Copyright (c) 2019 Yan Yang
%% All rights reserved.
clear all ;
clc;
addpath('./Train_LBFGS/')
addpath('./Train_LBFGS/lb')
addpath('./Train_LBFGS/Matlab')
addpath('./layersfunction/')
addpath('./util')
vl_setupnn();
%% Loading data
data_dir = './data/DATA-1D-Cartesian-0.2-complex-brain/Calgary_Brain_Train/';
%data_dir = './data/DATA-1D-Cartesian-0.2-complex-brain/Train_Brain/';
%data_dir = 'H:\ADMM-CSNet-master\New Training Data';
save('data_dir.mat', 'data_dir');
load('./mask/1D-Cartesian-0.4.mat');
save('mask.mat', 'mask');
%% Network initialization
net = InitNet ( );
%% Initial lossconfig
wei0 = netTOwei(net);
l0 = loss_with_gradient_total(wei0)
%% L-BFGS optimiztion
fun = @loss_with_gradient_total;
%parameters in the L-BFGS algorithm
low = -inf*ones(length(wei0),1);
upp = inf*ones(length(wei0),1);
opts.x0 = double(gather(wei0));
opts.m = 5;
opts.maxIts = 500;
opts.maxTotalIts = 7.2e4;
opts.printEvery = 1;
opts.factr=1e-50;
opts.pgtol = 1e-50;
[wei1, l1, info] = lbfgsb(fun, low, upp, opts);
wei1=single(wei1);
net1 = weiTOnet(wei1);
fprintf('Before training, error is %f; after training, error is %f.\n', l0, l1);
When I try to run this Deep Learning Training Code, I get this error:
Unrecognized field name "data".
Error in getMData_train (line 11)
data.label = double(ma.data.i.label);
Error in loss_with_gradient_total (line 13)
data = getMData_train(i);
Error in L_BFGSnetTrain (line 28)
l0 = loss_with_gradient_total(wei0)
The Code for getMData_train:
function data = getMData_train(n)
config;
ImageSize = nnconfig.ImageSize ;
data.train = double(zeros(ImageSize));
data.label = double(zeros(ImageSize));
%dir = './data/BrainTrain_sampling/';
load('data_dir.mat');
ma = load (strcat(data_dir , saveName(n, 2)));
data.label = double(ma.data.label);
data.train = double(ma.data.train);
end

采纳的回答

Walter Roberson
Walter Roberson 2022-3-28
ma = load (strcat(data_dir , saveName(n, 2)));
Whatever file is getting loaded by that does not contain a variable named "data"

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Image Data Workflows 的更多信息

产品


版本

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by