cuixing158 / yolov3-yolov4-matlab

Import and export Darknet™ models within MATLAB deep learning networks.
94 stars 44 forks source link

Error when loading yolov3-tiny.weights #11

Open BG4WCE opened 3 years ago

BG4WCE commented 3 years ago

Hi,

I got error when loading yolov3 weights after module No 17.

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 yolov3v4Predict (line 24) [layerGraphYolo,hyperParams] = importDarknetWeights(cfg_file,weight_file);

Error in detect (line 26) outFeatures = yolov3v4Predict(cfg_file,weight_file,im);% M*(5+nc) ,为[x,y,w,h,Pobj,p1,p2,...,pn]

cuixing158 commented 3 years ago

Please try to remove the last parameter "arc" of the constructor in the yolov3Layer custom layer.

BG4WCE commented 3 years ago

Thanks. I modified your code to take arc = 'default' when arc is not defined. BTW, where is this 'arc' coming from? Is it from YOLOv4?

bikekowal commented 3 years ago

Is there any mirror of baidu serwer providing weights and .cfg files?

Hind-colla commented 3 years ago

Thanks. I modified your code to take arc = 'default' when arc is not defined. BTW, where is this 'arc' coming from? Is it from YOLOv4?

Can you please tell me where do i need to put arc='default'. I have tried to remove "arc" from here: function layer = yolov3Layer(name, mask,allAnchors,nClasses,yoloIndex,imageSize,arc) and in the line 65: layer.arc = arc; they tell me that the 'arc' is not defined! I don't know what i should do? pklease help me. And thank you very much

ecardozog commented 2 years ago
        if nargin == 6
            arc = 'default';
        end
Gary-HUA commented 2 years ago
methods
    function layer = yolov3Layer(name, mask,allAnchors,nClasses,yoloIndex,imageSize)  % %%% modeified 
        % 输入参数:
        % name: 字符向量或字符串,层名字
        % mask: 见上面properties说明
        % allAnchors:同上面properties之anchors说明
        % nClasses: 1*1 标量,检测的类别数量
        % imageSize:[imageHeight,imageWidth],输入网络的图像大小
        % yoloIndex:1*1标量,从1开始的索引,输出yolo检测层的序号
        % arc:字符向量或字符串,计算损失的方式
        %
        % cuixingxing150@gmail.com
        % 2020.4.20
        %
        assert(size(allAnchors,2)==2,'allAnchors must have n*2 shape!');% nAchors*2,形如[width,height]

        layer.mask = mask;
        layer.anchors = allAnchors;
        layer.num = numel(allAnchors)/2;
        layer.classes = nClasses;
        layer.ignore_thresh = .7;
        layer.truth_thresh = 1;
        layer.jitter = .3;
        layer.random = 1;

        anchorsUse = allAnchors(mask,:);% na*2, 注意matlab中mask是从1开始的索引 
        layer.Name = name;
        text = ['all number classes:', num2str(nClasses),...
            ',used anchor box:',mat2str(round(anchorsUse)),...
            ', yoloLayerID:',num2str(yoloIndex),...
            ];  %%% modeified 
        layer.Description = text;
        layer.Type = 'yoloV3Layer';

        layer.numY = 1;
        layer.numX = 1;
        layer.stride =1;
        [
        layer.anchorsUse = anchorsUse;](url)
        layer.nAnchors = size(anchorsUse,1);
        layer.imageSize = imageSize;
        %layer.arc = arc;  %%%% modeified 
    end

2022-08-22_181203

Gary-HUA commented 2 years ago

remove these arc parameters. my coding running well.............

FenGk999 commented 1 year ago

你好,我删除arc之后,去跑预测,就会有误,,置信度很低的都显示上去了,这怎么解决呢??