Closed jasw1001 closed 4 years ago
Why it can not concatenate two 64 channel layer togeter to a 128-channel layer?
filters=64 isn't number of input channels, this is number of filters (and number of output channels) https://github.com/AlexeyAB/darknet/blob/6cbb75d10b43a95f11326a2475d64500b11fa64e/cfg/yolov4-custom.cfg#L95-L104
In Line 42, the filters are set as 64, and then according to the CSP rule, two 32-channel paths should be splited. One goes directly to the end of this stage Line 95, and the other goes to a regular darknet block starting from Line 59.
So the channel number should be like the following:
The 2nd stage has a correct channel numbers, starting from Line 106 which you may refer to.
Jasper
CSPNet could be:
Oh, are you talking about strict compliance with the CSP architecture?
Downsample: N * 2
There can be any N in the Downsample layer: N/2, N, N*2, ...
There are 2 completely equivalent ways - 100% equivalent: weights, inputs and output results - we use (a):
@WongKinYiu I find similar lines in your repo
Could you tell me the idea beneath the setting of channels? And, I find that @WongKinYiu in your cfg file, only the first stage does not follow the CSP rule strickly. Why?
@jasw1001
the channel number of transition layers and down-sampling layers are not included in the rule. as @AlexeyAB says https://github.com/AlexeyAB/darknet/issues/5466#issuecomment-623130824 we use (a) in this implementation
[convolutional]
batch_normalize=1
filters=64 # <- N/2 (partial 1)
size=1
stride=1
pad=1
activation=mish
[route]
layers = -2
[convolutional]
batch_normalize=1
filters=64 # <- N/2 (partial 2)
size=1
stride=1
pad=1
activation=mish
and
[convolutional]
batch_normalize=1
filters=64 # <- N/2 (partial transition)
size=1
stride=1
pad=1
activation=mish
[route]
layers = -1,-7 # <- N (merge)
it follow same rule as other stages.
https://github.com/AlexeyAB/darknet/blob/6cbb75d10b43a95f11326a2475d64500b11fa64e/cfg/yolov4-custom.cfg#L50
https://github.com/AlexeyAB/darknet/blob/6cbb75d10b43a95f11326a2475d64500b11fa64e/cfg/yolov4-custom.cfg#L61
https://github.com/AlexeyAB/darknet/blob/6cbb75d10b43a95f11326a2475d64500b11fa64e/cfg/yolov4-custom.cfg#L77
https://github.com/AlexeyAB/darknet/blob/6cbb75d10b43a95f11326a2475d64500b11fa64e/cfg/yolov4-custom.cfg#L89
I guess that the number of channels (filters) mentioned in the above four lines should be 32. So at line 95 the routine layer can concatenate two 32 channel layer togeter to a 64-channel layer.