Creates a Region Proposal Network (RPN) head.
tfm.vision.heads.RPNHead(
min_level: int,
max_level: int,
num_anchors_per_location: int,
num_convs: int = 1,
num_filters: int = 256,
use_separable_conv: bool = False,
activation: str = 'relu',
use_sync_bn: bool = False,
norm_momentum: float = 0.99,
norm_epsilon: float = 0.001,
kernel_regularizer: Optional[tf.keras.regularizers.Regularizer] = None,
bias_regularizer: Optional[tf.keras.regularizers.Regularizer] = None,
**kwargs
)
Args |
min_level
|
An int number of minimum feature level.
|
max_level
|
An int number of maximum feature level.
|
num_anchors_per_location
|
An int number of number of anchors per pixel
location.
|
num_convs
|
An int number that represents the number of the intermediate
convolution layers before the prediction.
|
num_filters
|
An int number that represents the number of filters of the
intermediate convolution layers.
|
use_separable_conv
|
A bool that indicates whether the separable
convolution layers is used.
|
activation
|
A str that indicates which activation is used, e.g. 'relu',
'swish', etc.
|
use_sync_bn
|
A bool that indicates whether to use synchronized batch
normalization across different replicas.
|
norm_momentum
|
A float of normalization momentum for the moving average.
|
norm_epsilon
|
A float added to variance to avoid dividing by zero.
|
kernel_regularizer
|
A tf.keras.regularizers.Regularizer object for
Conv2D. Default is None.
|
bias_regularizer
|
A tf.keras.regularizers.Regularizer object for Conv2D.
|
**kwargs
|
Additional keyword arguments to be passed.
|
Methods
call
View source
call(
features: Mapping[str, tf.Tensor]
)
Forward pass of the RPN head.
Args |
features
|
A dict of tf.Tensor where
- key: A
str of the level of the multilevel features.
- values: A
tf.Tensor , the feature map tensors, whose shape is [batch,
height_l, width_l, channels].
|
Returns |
scores
|
A dict of tf.Tensor which includes scores of the predictions.
- key: A
str of the level of the multilevel predictions.
- values: A
tf.Tensor of the box scores predicted from a particular
feature level, whose shape is
[batch, height_l, width_l, num_classes * num_anchors_per_location].
|
boxes
|
A dict of tf.Tensor which includes coordinates of the
predictions.
key: A str of the level of the multilevel predictions.
values: A tf.Tensor of the box scores predicted from a particular
feature level, whose shape is
[batch, height_l, width_l, 4 * num_anchors_per_location].
|