Route layer
- class layers.route_layer.Route_layer(input_layers, by_channels=True, **kwargs)[source]
Bases:
NumPyNet.layers.base.BaseLayer
- Route layer
For Now the idea is: it takes the seleted layers output and concatenate them along the batch axis OR the channels axis
YOLOv3 implementation always concatenate by channels
By definition, this layer can’t be used without a Network model.
- Parameters
input_layers (int or list of int.) – indexes of the layers in the network for which the outputs have to concatenated.
by_channels (bool, (default = True).) – It determines along which dimension the concatenation is performed. For examples if two input with size (b1, w, h , c) and (b2, w, h, c) are concatenated with by_channels=False, then the final output shape will be (b1 + b2, w, h, c). Otherwise, if the shapes are (b, w, h, c1) and (b, w, h, c2) and axis=3, the final output size will be (b, w, h, c1 + c2) (YOLOv3 model). Notice that the all the other dimensions must be equal.
Example
TODO
TODO
- backward(delta, network)[source]
Sum self.delta to the correct layer delta on the network
- Parameters
delta (array-like) – delta array of shape (batch, w, h, c). Global delta to be backpropagated.
network (Network object type.) – The network model to which this layer belongs to.
- Return type
self
- forward(network)[source]
Concatenate along chosen axis the outputs of selected network layers In main CNN applications, like YOLOv3, the concatenation happens long channels axis
- Parameters
network (Network object type.) – The network model to which this layer belongs to.
- Return type
self
- property out_shape
Get the output shape
- Returns
out_shape – Tuple as (batch, out_w, out_h, out_c)
- Return type
tuple