@@ -2485,6 +2485,85 @@ function (object, factor, value_range = list(0L, 255L), data_format = NULL,
24852485 create_layer(keras $ layers $ RandomSharpness , object , args )
24862486}
24872487
2488+ # ' A preprocessing layer that randomly applies shear transformations
2489+ # '
2490+ # ' @description
2491+ # ' images.
2492+ # '
2493+ # ' This layer shears the input images along the x-axis and/or y-axis by a
2494+ # ' randomly selected factor within the specified range. The shear
2495+ # ' transformation is applied to each image independently in a batch. Empty
2496+ # ' regions created during the transformation are filled according to the
2497+ # ' `fill_mode` and `fill_value` parameters.
2498+ # '
2499+ # ' @param x_factor
2500+ # ' A tuple of two floats. For each augmented image, a value
2501+ # ' is sampled from the provided range. If a float is passed, the
2502+ # ' range is interpreted as `(0, x_factor)`. Values represent a
2503+ # ' percentage of the image to shear over. For example, 0.3 shears
2504+ # ' pixels up to 30% of the way across the image. All provided values
2505+ # ' should be positive.
2506+ # '
2507+ # ' @param y_factor
2508+ # ' A tuple of two floats. For each augmented image, a value
2509+ # ' is sampled from the provided range. If a float is passed, the
2510+ # ' range is interpreted as `(0, y_factor)`. Values represent a
2511+ # ' percentage of the image to shear over. For example, 0.3 shears
2512+ # ' pixels up to 30% of the way across the image. All provided values
2513+ # ' should be positive.
2514+ # '
2515+ # ' @param interpolation
2516+ # ' Interpolation mode. Supported values: `"nearest"`,
2517+ # ' `"bilinear"`.
2518+ # '
2519+ # ' @param fill_mode
2520+ # ' Points outside the boundaries of the input are filled
2521+ # ' according to the given mode. Available methods are `"constant"`,
2522+ # ' `"nearest"`, `"wrap"` and `"reflect"`. Defaults to `"constant"`.
2523+ # ' - `"reflect"`: `(d c b a | a b c d | d c b a)`
2524+ # ' The input is extended by reflecting about the edge of the
2525+ # ' last pixel.
2526+ # ' - `"constant"`: `(k k k k | a b c d | k k k k)`
2527+ # ' The input is extended by filling all values beyond the edge
2528+ # ' with the same constant value `k` specified by `fill_value`.
2529+ # ' - `"wrap"`: `(a b c d | a b c d | a b c d)`
2530+ # ' The input is extended by wrapping around to the opposite edge.
2531+ # ' - `"nearest"`: `(a a a a | a b c d | d d d d)`
2532+ # ' The input is extended by the nearest pixel.
2533+ # ' Note that when using torch backend, `"reflect"` is redirected to
2534+ # ' `"mirror"` `(c d c b | a b c d | c b a b)` because torch does
2535+ # ' not support `"reflect"`.
2536+ # ' Note that torch backend does not support `"wrap"`.
2537+ # '
2538+ # ' @param fill_value
2539+ # ' A float representing the value to be filled outside the
2540+ # ' boundaries when `fill_mode="constant"`.
2541+ # '
2542+ # ' @param seed
2543+ # ' Integer. Used to create a random seed.
2544+ # '
2545+ # ' @param object
2546+ # ' Object to compose the layer with. A tensor, array, or sequential model.
2547+ # '
2548+ # ' @param ...
2549+ # ' For forward/backward compatability.
2550+ # '
2551+ # ' @export
2552+ # ' @tether keras.layers.RandomShear
2553+ # ' @family image preprocessing layers
2554+ # ' @family preprocessing layers
2555+ # ' @family layers
2556+ layer_random_shear <-
2557+ function (object , x_factor = 0 , y_factor = 0 , interpolation = " bilinear" ,
2558+ fill_mode = " reflect" , fill_value = 0 , data_format = NULL ,
2559+ seed = NULL , ... )
2560+ {
2561+ args <- capture_args(list (seed = as_integer , input_shape = normalize_shape ,
2562+ batch_size = as_integer , batch_input_shape = normalize_shape ),
2563+ ignore = " object" )
2564+ create_layer(keras $ layers $ RandomShear , object , args )
2565+ }
2566+
24882567# ' Applies a series of layers to an input.
24892568# '
24902569# ' @description
0 commit comments