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 importDarknetNetwork (line 31) Cannot open file: weights/darknet19.weights #13

Open
Soumaya-coder opened this issue Jan 20, 2021 · 16 comments

Comments

@Soumaya-coder
Copy link

Hi, can anyone help me to resolve this error please:
when I try to run this line [mynet,hyperParams,numsNetParams,FLOPs] = importDarknetNetwork(cfg_file,weight_file);
I have this error
Error using importDarknetNetwork (line 31) Cannot open file: weights/darknet19.weights

@rickymedrano
Copy link

Hi, can anyone help me to resolve this error please:
when I try to run this line [mynet,hyperParams,numsNetParams,FLOPs] = importDarknetNetwork(cfg_file,weight_file);
I have this error
Error using importDarknetNetwork (line 31) Cannot open file: weights/darknet19.weights

You need to download darknet19.weights and place it in your "weights" folder.

@Hind-colla
Copy link

Hi, can anyone help me to resolve this error please:
when I try to run this line [mynet,hyperParams,numsNetParams,FLOPs] = importDarknetNetwork(cfg_file,weight_file);
I have this error
Error using importDarknetNetwork (line 31) Cannot open file: weights/darknet19.weights

You need to download darknet19.weights and place it in your "weights" folder.

I've done it but i still get this error:
Error using importDarkNetLayers (line 38)
Cannot open file: ./cfg/yolov3-tiny.cfg

Error in importDarknetWeights (line 30)
moduleTypeList,moduleInfoList,layerToModuleIndex] = importDarkNetLayers(cfgfile);% only weights需要cutoff,layer都导入

Error in newyolo (line 19)
[lgModel,hyperParams] = importDarknetWeights(cfg_file,weight_file);

@rickymedrano
Copy link

@Hind-colla seems like you need this file and place it in your cfg folder. https://github.com/pjreddie/darknet/blob/master/cfg/yolov3-tiny.cfg

@Hind-colla
Copy link

@Hind-colla seems like you need this file and place it in your cfg folder. https://github.com/pjreddie/darknet/blob/master/cfg/yolov3-tiny.cfg

Oh Thank you. I see i was not on the right path. it start runing then it gives me this new error:
Unrecognized function or variable 'yolov3Layer'.

Error in importDarkNetLayers (line 372)
yolov3_layer = yolov3Layer(['yolo_v3_id',num2str(yoloIndex)],...

Error in importDarknetWeights (line 30)
moduleTypeList,moduleInfoList,layerToModuleIndex] = importDarkNetLayers(cfgfile);% only weights需要cutoff,layer都导入

Error in newyolo (line 19)
[lgModel,hyperParams] = importDarknetWeights(cfg_file,weight_file);

@rickymedrano
Copy link

I think you're supposed to use this cfg file instead, not the one I linked earlier. https://github.com/cuixing158/yolov3-yolov4-matlab/blob/master/cfg/yolov3-tiny.cfg

@Hind-colla
Copy link

I'm really sorry, i have a new error again :( i'm so sorry can you help me please:
This module No: 1 [net] ,have #params:0 ,FLops:0 ,feature map size:(416416),channels in:- ,channels out:3
This module No: 2 [convolutional] ,have #params:512 ,FLops:88604672 ,feature map size:(416
416),channels in:3 ,channels out:16
This module No: 3 [maxpool] ,have #params:0 ,FLops:0 ,feature map size:(208208),channels in:16 ,channels out:16
This module No: 4 [convolutional] ,have #params:4768 ,FLops:206282752 ,feature map size:(208
208),channels in:16 ,channels out:32
This module No: 5 [maxpool] ,have #params:0 ,FLops:0 ,feature map size:(104104),channels in:32 ,channels out:32
This module No: 6 [convolutional] ,have #params:18752 ,FLops:202821632 ,feature map size:(104
104),channels in:32 ,channels out:64
This module No: 7 [maxpool] ,have #params:0 ,FLops:0 ,feature map size:(52 *52 ),channels in:64 ,channels out:64
This module No: 8 [convolutional] ,have #params:74368 ,FLops:201091072 ,feature map size:(52 *52 ),channels in:64 ,channels out:128
This module No: 9 [maxpool] ,have #params:0 ,FLops:0 ,feature map size:(26 *26 ),channels in:128 ,channels out:128
This module No:10 [convolutional] ,have #params:296192 ,FLops:200225792 ,feature map size:(26 *26 ),channels in:128 ,channels out:256
This module No:11 [maxpool] ,have #params:0 ,FLops:0 ,feature map size:(13 *13 ),channels in:256 ,channels out:256
This module No:12 [convolutional] ,have #params:1182208 ,FLops:199793152 ,feature map size:(13 *13 ),channels in:256 ,channels out:512
This module No:13 [maxpool] ,have #params:0 ,FLops:0 ,feature map size:(13 *13 ),channels in:512 ,channels out:512
This module No:14 [convolutional] ,have #params:4723712 ,FLops:798307328 ,feature map size:(13 *13 ),channels in:512 ,channels out:1024
This module No:15 [convolutional] ,have #params:263424 ,FLops:44518656 ,feature map size:(13 *13 ),channels in:1024 ,channels out:256
This module No:16 [convolutional] ,have #params:1182208 ,FLops:199793152 ,feature map size:(13 *13 ),channels in:256 ,channels out:512
This module No:17 [convolutional] ,have #params:130815 ,FLops:22107735 ,feature map size:(13 *13 ),channels in:512 ,channels out:255
Not enough input arguments.

Error in yolov3Layer (line 54)
', arc:',arc];

Error in importDarkNetLayers (line 372)
yolov3_layer = yolov3Layer(['yolo_v3_id',num2str(yoloIndex)],...

Error in importDarknetWeights (line 30)
moduleTypeList,moduleInfoList,layerToModuleIndex] = importDarkNetLayers(cfgfile);% only weights需要cutoff,layer都导入

Error in nouveux (line 19)
[lgModel,hyperParams] = importDarknetWeights(cfg_file,weight_file);

@rickymedrano
Copy link

Solution is here #11

@Hind-colla
Copy link

That's very nice thank you for your help. I still have issues with this function. I have removed the 'arc' form Yolo's funtion :
layer = yolov3Layer(name, mask,allAnchors,nClasses,yoloIndex,imageSize,arc) but i don't know , i still don't get it i have an error telling me : Unrecognized function or variable 'arc'.

Error in yolov3Layer (line 65)
layer.arc = arc;

@rickymedrano
Copy link

Try removing line 65. It's trying to access arc in layer.arc which doesn't exist anymore since you removed it up on line 25.

@Hind-colla
Copy link

I don't know how to thank you. Now i'm having this error: Error using importDarknetWeights (line 36)
Cannot open file: ./weights/yolov3-tiny.weights

Error in nouveux (line 19)
[lgModel,hyperParams] = importDarknetWeights(cfg_file,weight_file);

These mistakes will never end :(

@rickymedrano
Copy link

Look at the error "Cannot open file: ./weights/yolov3-tiny.weights"
What do you think that is telling you? What would be the first thing you should check when seeing that error?

@Hind-colla
Copy link

Hind-colla commented May 3, 2021

I guess i should check if i have the file? but i don't have it.
in importDarknetWeights.m this is the line that give me the error
fid_w = fopen(weightsfile,'rb');
if fid_w == -1
error('Author:Function:OpenFile', 'Cannot open file: %s', weightsfile);
end

I'm new to this so that's why i don't understand very much

@Hind-colla
Copy link

I download it it's working know. Thank you so much

@Hind-colla
Copy link

Look at the error "Cannot open file: ./weights/yolov3-tiny.weights"
What do you think that is telling you? What would be the first thing you should check when seeing that error?

Hello sur, i'm sorry i need your help one more time. When i run :[gradients,boxLoss,objLoss,clsLoss,totalLoss,state] = dlfeval(@modelGradients, model, XTrain, YTrain,yoloLayerNumber);
I get this error:
'modelGradients' is used in Generate Synthetic Signals Using Conditional Generative Adversarial Network.

Error in deep.internal.dlfeval (line 18)
[varargout{1:nout}] = fun(x{:});

Error in dlfeval (line 41)
[varargout{1:nout}] = deep.internal.dlfeval(fun,varargin{:});

Error in nouveux (line 94)
[gradients,boxLoss,objLoss,clsLoss,totalLoss,state] = dlfeval(@modelGradients, model, XTrain,
YTrain,yoloLayerNumber);

I don't know what to do? I tried to Add to path the function but they tell me that there is to much input. Can you help me? please

@rickymedrano
Copy link

It's because its trying to use the helper function 'modelGradients' from the example Generate Synthetic Signals Using Conditional Generative Adversarial Network, which it can't find. Open up that example and just copy the 'modelGradients' function and paste at the end of your code and it should probably work.

@Hind-colla
Copy link

I've done it but i get this error :
Error using nouveux>modelGradients
Too many output arguments.

Error in deep.internal.dlfeval (line 18)
[varargout{1:nout}] = fun(x{:});

Error in dlfeval (line 41)
[varargout{1:nout}] = deep.internal.dlfeval(fun,varargin{:});

Error in nouveux (line 94)
[gradients,boxLoss,objLoss,clsLoss,totalLoss,state] = dlfeval(@modelGradients, model, XTrain,
YTrain,yoloLayerNumber);

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

3 participants