Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error using dagnn.DagNN.loadobj (line 17) Invalid model. #1241

Open
asharani97 opened this issue May 21, 2020 · 1 comment
Open

Error using dagnn.DagNN.loadobj (line 17) Invalid model. #1241

asharani97 opened this issue May 21, 2020 · 1 comment

Comments

@asharani97
Copy link

asharani97 commented May 21, 2020

I want to extract features from the image using inception_5b/output" as output means 'icp9_out'
So, I did following

netStruct = load([modelPath 'imagenet-googlenet-dag.mat']); 
net = dagnn.DagNN.loadobj(netStruct) ;
net.mode='test';
net.move('gpu');
net.conserveMemory=false
removeLayer(net,'softmax')
removeLayer(net,'cls3_fc')
removeLayer(net,'cls3_pool')
net_mat = net.saveobj()
save('inception_5b.mat', 'net_mat') ;

While when I load the inception_5b.mat
error::
Error using dagnn.DagNN.loadobj (line 17)
Invalid model.
@jotaf98

@zosel260
Copy link

zosel260 commented Sep 3, 2020

I'm not sure my way is correct or not .
This error means that loadobj(s) function wants the input 's' has the 'layers' field,
because line17 of loadobj.m is:
assert(isfield(s, 'layers'), 'Invalid model.');

So, your 'netStruct' must has the 'layers' field.

In my case the loaded structure 'netStruct' has the sub-structure 'net' and 'net' has the 'layers' field.
So, I changed like below and then the net is loaded.
net = dagnn.DagNN.loadobj(netStruct.net) ;

Because my library is the newest (v1.0-beta25),
I don't know why the guide is not working.

I hope my comments be helpful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants