Darknet: Why should this line "assert(l.outputs == params.inputs) " in line 281 of parser.c

Created on 6 Oct 2017  Â·  14Comments  Â·  Source: pjreddie/darknet

What's the job of this assert assert(l.outputs == params.inputs)in line 281 of parser.c ?
In my opinion the parse_region is doing the assembling works of the regional proposal layer,in which the output is ordinarily as number_of_proposes*(classes + coordinates +1),although in convolutional_layer the output is ordinarily calculated as h*w*filters.
I mean there is no logical equal between input size and output size of regional proposal layer.
Can any explanation ?

Most helpful comment

@MaeThird @jktzes According to my personal experience
If you are using yolov3:
This error happens when your filter value is wrong in any of the convolution layer before [yolo] layer
It should be = num/3(classes+5)
If you are using yolov2:
This error happens when your filter value in convolution layer before region layer is wrong
It should be = num
(classes+5)

All 14 comments

Hi there! Did you by any chance solve the problem? @MaeThird

@MaeThird @jktzes According to my personal experience
If you are using yolov3:
This error happens when your filter value is wrong in any of the convolution layer before [yolo] layer
It should be = num/3(classes+5)
If you are using yolov2:
This error happens when your filter value in convolution layer before region layer is wrong
It should be = num
(classes+5)

what is "num"???

@dee6600 It's set in your configuration file. For yolo3 the default the 9 but you can change this depending on your needs.

I am working with yolov2, For three categories. so, filters = (3+5)*5 seems to work.
@peymanmortazavi its okay to set "num"in config file. But can anyone tell me what its meaning? does it change over number of categories(wild guess).

@dee6600 num is the amount of anchor-pairs, so if you increase the amount of anchors you should increase num as well.

@TheMikeyR thank you for insight. But i am kind of noob here hehe. I dont know what is anchor-pairs.

Hello there,
I am facing the same problem but I am using Yolo-LITE what should be my filter function?
@ahsan856jalal

I thought num was the number of classes that can overlap in one window. After reading #568 I think its a new concept replacing simple grid used in yolo v1.

in the yolov3-voc.cfg file there are three [yolo] block. you have to change the filter size for each of the [convolutional] block filter size before all the three [yolo] block as follow -
filter size=(num/3)*(classes+5)
In my case, as the classes are 1 and num=9 so the filter size is 18.

[convolutional]
size=1
stride=1
pad=1
filters=18
activation=linear

[yolo]
mask = 6,7,8
anchors = 10,13, 16,30, 33,23, 30,61, 62,45, 59,119, 116,90, 156,198, 373,326
classes=1
num=9

jitter=.3
ignore_thresh = .5
truth_thresh = 1
random=1

In your .cfg make sure the "classes = num of your trained object" in each layers

in the yolov3-voc.cfg file there are three [yolo] block. you have to change the filter size for each of the [convolutional] block filter size before all the three [yolo] block as follow -
filter size=(num/3)*(classes+5)
In my case, as the classes are 1 and num=9 so the filter size is 18.

[convolutional]
size=1
stride=1
pad=1
filters=18
activation=linear

[yolo]
mask = 6,7,8
anchors = 10,13, 16,30, 33,23, 30,61, 62,45, 59,119, 116,90, 156,198, 373,326
classes=1 num=9
jitter=.3
ignore_thresh = .5
truth_thresh = 1
random=1

Hi. I am using Yolov3.
My number of classes is 4. So (num/3)*(number_of_classes+5) = 27. Even after this modification in thr yolov3-voc.cfg file, I am getting the error " darknet: ./src/parser.c:315: parse_yolo: Assertion `l.outputs == params.inputs' failed ". What can I do to solve this?

If your try to run the training from terminal, after you've changed the filters and classes, try to exit the terminal and start it again. It may work like that. And do not forget to save the changes that you made in .cfg file

Was this page helpful?
0 / 5 - 0 ratings

Related issues

AndyZX picture AndyZX  Â·  3Comments

kthordarson picture kthordarson  Â·  3Comments

arianaa30 picture arianaa30  Â·  3Comments

ghost picture ghost  Â·  4Comments

cadip92 picture cadip92  Â·  3Comments