tfm.vision.anchor_generator.AnchorGenerator
Stay organized with collections
Save and categorize content based on your preferences.
Utility to generate anchors for a multiple feature maps.
tfm.vision.anchor_generator.AnchorGenerator(
anchor_sizes, scales, aspect_ratios, strides, clip_boxes=False
)
Example:
anchor_gen = AnchorGenerator([32, 64], [.5, 1., 2.],
strides=[16, 32])
anchors = anchor_gen([512, 512, 3])
Args |
anchor_sizes
|
A list of int represents the anchor size for each scale. The
anchor height will be anchor_size / sqrt(aspect_ratio) , anchor width
will be anchor_size * sqrt(aspect_ratio) for each scale.
|
scales
|
A list/tuple, or a list/tuple of a list/tuple of positive
floats representing the actual anchor size to the base anchor_size .
|
aspect_ratios
|
A list/tuple, or a list/tuple of a list/tuple of positive
floats representing the ratio of anchor width to anchor height.
|
strides
|
A list/tuple of ints represent the anchor stride size between
center of anchors at each scale.
|
clip_boxes
|
Boolean to represents whether the anchor coordinates should be
clipped to the image size. Defaults to False .
|
Methods
__call__
View source
__call__(
image_size
)
Call self as a function.
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 2024-02-02 UTC.
[null,null,["Last updated 2024-02-02 UTC."],[],[],null,["# tfm.vision.anchor_generator.AnchorGenerator\n\n\u003cbr /\u003e\n\n|------------------------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/tensorflow/models/blob/v2.15.0/official/vision/ops/anchor_generator.py#L112-L168) |\n\nUtility to generate anchors for a multiple feature maps. \n\n tfm.vision.anchor_generator.AnchorGenerator(\n anchor_sizes, scales, aspect_ratios, strides, clip_boxes=False\n )\n\n#### Example:\n\n anchor_gen = AnchorGenerator([32, 64], [.5, 1., 2.],\n strides=[16, 32])\n anchors = anchor_gen([512, 512, 3])\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|-----------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `anchor_sizes` | A list of int represents the anchor size for each scale. The anchor height will be `anchor_size / sqrt(aspect_ratio)`, anchor width will be `anchor_size * sqrt(aspect_ratio)` for each scale. |\n| `scales` | A list/tuple, or a list/tuple of a list/tuple of positive floats representing the actual anchor size to the base `anchor_size`. |\n| `aspect_ratios` | A list/tuple, or a list/tuple of a list/tuple of positive floats representing the ratio of anchor width to anchor height. |\n| `strides` | A list/tuple of ints represent the anchor stride size between center of anchors at each scale. |\n| `clip_boxes` | Boolean to represents whether the anchor coordinates should be clipped to the image size. Defaults to `False`. |\n\n\u003cbr /\u003e\n\nMethods\n-------\n\n### `__call__`\n\n[View source](https://github.com/tensorflow/models/blob/v2.15.0/official/vision/ops/anchor_generator.py#L165-L168) \n\n __call__(\n image_size\n )\n\nCall self as a function."]]