View source: R/target-transforms-detection.R
| target_transform_affine | R Documentation |
Applies an affine transformation (rotation, translation, scale and shear) to
the bounding boxes of a detection target so that they follow an image
transformed by transform_affine() with the same parameters. Each box centre
is moved by the affine transformation around the given centre, the box is
scaled by scale and rotated by angle, and the result is returned as a
rotated box in xyxyr format. Passing an already rotated target accumulates the
rotation, so transforms compose.
target_transform_affine(
target,
angle = 0,
translate = c(0, 0),
scale = 1,
shear = 0,
center = NULL
)
## S3 method for class 'object_detection_target'
target_transform_affine(
target,
angle = 0,
translate = c(0, 0),
scale = 1,
shear = 0,
center = NULL
)
target |
An
|
angle |
(numeric): Rotation angle value in degrees, counter-clockwise. |
translate |
(integer vector of length 2): Horizontal and vertical translations (post-rotation translation). |
scale |
(numeric): Overall scale. |
shear |
(numeric vector or numeric): Shear angle value in degrees
between |
center |
(numeric vector of length 2, optional): Optional center of
rotation, |
A list with the same structure as the input target, where boxes is a
tensor of shape (N, 5) in xyxyr format.
Other target_transforms_detection:
prepare_sahi_split(),
target_transform_resize(),
target_transform_rotate()
## Not run:
target <- list(
boxes = torch_tensor(matrix(c(10, 20, 50, 60), ncol = 4), dtype = torch_float32()),
labels = torch_tensor(1L, dtype = torch_long()),
image_height = 100L,
image_width = 200L
)
class(target) <- c("object_detection_target", "list")
target_transform_affine(target, angle = 20, translate = c(10, 5), scale = 1.1, shear = 8)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.