tfm.vision.layers.BoxSampler
Stay organized with collections
Save and categorize content based on your preferences.
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.
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates. Some content is licensed under the numpy license.
Last updated 2026-11-06 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2026-11-06 UTC."],[],[]]