yolov3-yolov4-matlab icon indicating copy to clipboard operation
yolov3-yolov4-matlab copied to clipboard

Error using importDarknetNetwork (line 31) Cannot open file: weights/darknet19.weights

Open Soumaya-coder opened this issue 4 years ago • 16 comments

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

Soumaya-coder avatar Jan 20 '21 12:01 Soumaya-coder

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.

rickymedrano avatar Jan 26 '21 22:01 rickymedrano

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);

Hind-colla avatar May 03 '21 16:05 Hind-colla

@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

rickymedrano avatar May 03 '21 17:05 rickymedrano

@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);

Hind-colla avatar May 03 '21 17:05 Hind-colla

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

rickymedrano avatar May 03 '21 17:05 rickymedrano

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);

Hind-colla avatar May 03 '21 17:05 Hind-colla

Solution is here https://github.com/cuixing158/yolov3-yolov4-matlab/issues/11

rickymedrano avatar May 03 '21 18:05 rickymedrano

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;

Hind-colla avatar May 03 '21 18:05 Hind-colla

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.

rickymedrano avatar May 03 '21 20:05 rickymedrano

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 :(

Hind-colla avatar May 03 '21 20:05 Hind-colla

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?

rickymedrano avatar May 03 '21 21:05 rickymedrano

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 avatar May 03 '21 21:05 Hind-colla

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

Hind-colla avatar May 03 '21 21:05 Hind-colla

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

Hind-colla avatar May 04 '21 16:05 Hind-colla

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.

rickymedrano avatar May 04 '21 19:05 rickymedrano

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);

Hind-colla avatar May 05 '21 10:05 Hind-colla