ResNetNetwork¶
- class ResNetNetwork(n_residual_blocks=3, n_conv_per_residual_block=3, n_filters=None, kernel_size=None, strides=1, dilation_rate=1, padding='same', activation='relu', use_bias=True)[source]¶
Establish the network structure for a ResNet.
Adapted from the implementations used in [1].
- Parameters:
- n_residual_blocksint, default = 3
The number of residual blocks of ResNet’s model.
- n_conv_per_residual_blockint, default = 3
The number of convolution blocks in each residual block.
- n_filtersint or list of int, default = [128, 64, 64]
The number of convolution filters for all the convolution layers in the same residual block, if not a list, the same number of filters is used in all convolutions of all residual blocks.
- kernel_sizeint or list of int, default = [8, 5, 3]
The kernel size of all the convolution layers in one residual block, if not a list, the same kernel size is used in all convolution layers.
- stridesint or list of int, default = 1
The strides of convolution kernels in each of the convolution layers in one residual block, if not a list, the same kernel size is used in all convolution layers.
- dilation_rateint or list of int, default = 1
The dilation rate of the convolution layers in one residual block, if not a list, the same kernel size is used in all convolution layers.
- paddingstr or list of str, default = ‘padding’
The type of padding used in the convolution layers in one residual block, if not a list, the same kernel size is used in all convolution layers.
- activationstr or list of str, default = ‘relu’
Keras activation used in the convolution layers in one residual block, if not a list, the same kernel size is used in all convolution layers.
- use_biasbool or list of bool, default = True
Condition on whether or not to use bias values in the convolution layers in one residual block, if not a list, the same kernel size is used in all convolution layers.
Notes
Adpated from the implementation source code https://github.com/hfawaz/dl-4-tsc/blob/master/classifiers/resnet.py
References
[1]Fawaz, G. B. Lanckriet, F. Petitjean, and L. Idoumghar,
Network originally defined in:
@inproceedings{wang2017time, title={Time series classification from scratch with deep neural networks: A strong baseline}, author={Wang, Zhiguang and Yan, Weizhong and Oates, Tim}, booktitle={2017 International joint conference on neural networks (IJCNN)}, pages={ 1578–1585}, year={2017}, organization={IEEE} }
Methods
build_network
(input_shape, **kwargs)Construct a network and return its input and output layers.
- build_network(input_shape, **kwargs)[source]¶
Construct a network and return its input and output layers.
- Parameters:
- input_shapetuple of shape = (n_timepoints (m), n_channels (d))
The shape of the data fed into the input layer.
- Returns:
- input_layerkeras.layers.Input
The input layer of the network.
- output_layerkeras.layers.Layer
The output layer of the network.