Creates a BoxSampler to sample positive and negative boxes.
tfm.vision.layers.BoxSampler(
num_samples: int = 512, foreground_fraction: float = 0.25, **kwargs
)
Args |
num_samples
|
An int of the number of sampled boxes per image.
|
foreground_fraction
|
A float in [0, 1], what percentage of boxes should
be sampled from the positive examples.
|
**kwargs
|
Additional keyword arguments passed to Layer.
|
Methods
call
View source
call(
positive_matches: tf.Tensor,
negative_matches: tf.Tensor,
ignored_matches: tf.Tensor
)
Samples and selects positive and negative instances.
Args |
positive_matches
|
A bool tensor of shape of [batch, N] where N is the
number of instances. For each element, True means the instance
corresponds to a positive example.
|
negative_matches
|
A bool tensor of shape of [batch, N] where N is the
number of instances. For each element, True means the instance
corresponds to a negative example.
|
ignored_matches
|
A bool tensor of shape of [batch, N] where N is the
number of instances. For each element, True means the instance should
be ignored.
|
Returns |
A tf.tensor of shape of [batch_size, K], storing the indices of the
sampled examples, where K is num_samples .
|