Skip to content
This repository was archived by the owner on Mar 10, 2026. It is now read-only.
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions benchmarks/vectorized_channel_shuffle.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class OldChannelShuffle(BaseImageAugmentationLayer):
`(..., height, width, channels)`, in `"channels_last"` format

Args:
groups: Number of groups to divide the input channels, defaults to 3.
groups: Number of groups to divide the input channels, defaults to `3`.
seed: Integer. Used to create a random seed.

Call arguments:
Expand All @@ -48,7 +48,7 @@ class OldChannelShuffle(BaseImageAugmentationLayer):
` or (width, height, channels)`, with dtype
tf.float32 / tf.uint8
training: A boolean argument that determines whether the call should be
run in inference mode or training mode, defaults to True.
run in inference mode or training mode, defaults to `True`.

Usage:
```python
Expand Down
11 changes: 5 additions & 6 deletions benchmarks/vectorized_jittered_resize.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,14 @@ class OldJitteredResize(BaseImageAugmentationLayer):
This factor is used to scale the input image.
To replicate the results of the MaskRCNN paper pass `(0.8, 1.25)`.
crop_size: (Optional) the size of the image to crop from the scaled
image, defaults to `target_size` when not provided.
image, when not provided, defaults to `target_size`.
bounding_box_format: The format of bounding boxes of input boxes.
Refer to
https://github.com/keras-team/keras-cv/blob/master/keras_cv/bounding_box/converters.py
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why drop the github.com prefix?

Will GitHub automagically render this link for us in the UI? That would be cool

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ianstenbit Oh actually I think it was flake8 picking up a long line

keras-team/keras-cv/blob/master/keras_cv/bounding_box/converters.py
for more details on supported bounding box formats.
interpolation: String, the interpolation method, defaults to
`"bilinear"`. Supports `"bilinear"`, `"nearest"`, `"bicubic"`,
`"area"`, `"lanczos3"`, `"lanczos5"`, `"gaussian"`,
`"mitchellcubic"`.
interpolation: String, the interpolation method. Supports `"bilinear"`,
`"nearest"`, `"bicubic"`, `"area"`, `"lanczos3"`, `"lanczos5"`,
`"gaussian"`, `"mitchellcubic"`. Defaults to `"bilinear"`.
seed: (Optional) integer to use as the random seed.
"""

Expand Down
7 changes: 4 additions & 3 deletions benchmarks/vectorized_mosaic.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,16 @@ class OldMosaic(BaseImageAugmentationLayer):
sampled between the two values for every image augmented. If a
single float is used, a value between `0.0` and the passed float is
sampled. In order to ensure the value is always the same, please
pass a tuple with two identical floats: `(0.5, 0.5)`. Defaults to
(0.25, 0.75).
pass a tuple with two identical floats: `(0.5, 0.5)`.
Defaults to `(0.25, 0.75)`.
bounding_box_format: a case-insensitive string (for example, "xyxy") to
be passed if bounding boxes are being augmented by this layer.
Each bounding box is defined by at least these 4 values. The inputs
may contain additional information such as classes and confidence
after these 4 values but these values will be ignored and returned
as is. For detailed information on the supported formats, see the
[KerasCV bounding box documentation](https://keras.io/api/keras_cv/bounding_box/formats/). Defaults to None.
[KerasCV bounding box documentation](https://keras.io/api/keras_cv/bounding_box/formats/).
Defaults to `None`.
seed: integer, used to create a random seed.

References:
Expand Down
10 changes: 5 additions & 5 deletions benchmarks/vectorized_random_brightness.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ class OldRandomBrightness(BaseImageAugmentationLayer):
is provided, eg, 0.2, then -0.2 will be used for lower bound and 0.2
will be used for upper bound.
value_range: Optional list/tuple of 2 floats for the lower and upper limit
of the values of the input data, defaults to [0.0, 255.0]. Can be
changed to e.g. [0.0, 1.0] if the image input has been scaled before
this layer. The brightness adjustment will be scaled to this range, and
the output values will be clipped to this range.
seed: optional integer, for fixed RNG behavior.
of the values of the input data. Can be changed to e.g. [0.0, 1.0] if
the image input has been scaled before this layer. The brightness
adjustment will be scaled to this range, and the output values will be
clipped to this range. Defaults to `[0.0, 255.0]`.
seed: optional integer, for fixed RNG behavior. Defaults to [0.0, 255.0]
Inputs: 3D (HWC) or 4D (NHWC) tensor, with float or int dtype. Input pixel
values can be of any range (e.g. `[0., 1.)` or `[0, 255]`)
Output: 3D (HWC) or 4D (NHWC) tensor with brightness adjusted based on the
Expand Down
6 changes: 3 additions & 3 deletions benchmarks/vectorized_random_flip.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ class OldRandomFlip(BaseImageAugmentationLayer):

Arguments:
mode: String indicating which flip mode to use. Can be `"horizontal"`,
`"vertical"`, or `"horizontal_and_vertical"`, defaults to
`"horizontal"`. `"horizontal"` is a left-right flip and `"vertical"` is
a top-bottom flip.
`"vertical"`, or `"horizontal_and_vertical"`. `"horizontal"` is a
left-right flip and `"vertical"` is a top-bottom flip.
Defaults to `"horizontal"`.
seed: Integer. Used to create a random seed.
bounding_box_format: The format of bounding boxes of input dataset.
Refer to
Expand Down
4 changes: 2 additions & 2 deletions benchmarks/vectorized_random_zoom.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ class OldRandomZoom(BaseImageAugmentationLayer):
represented as a single float, this value is used for both the upper and
lower bound. For instance, `width_factor=(0.2, 0.3)` result in an output
zooming out between 20% to 30%. `width_factor=(-0.3, -0.2)` result in an
output zooming in between 20% to 30%. Defaults to `None`, i.e., zooming
output zooming in between 20% to 30%. When None: zooming
vertical and horizontal directions by preserving the aspect ratio. If
height_factor=0 and width_factor=None, it would result in images with
no zoom at all.
no zoom at all. Defaults to `None`.
fill_mode: Points outside the boundaries of the input are filled according
to the given mode (one of `{"constant", "reflect", "wrap", "nearest"}`).
- *reflect*: `(d c b a | a b c d | d c b a)` The input is extended by
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/vectorized_randomly_zoomed_crop.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class OldRandomlyZoomedCrop(BaseImageAugmentationLayer):
value `(1.0, 1.0)`.
interpolation: (Optional) A string specifying the sampling method for
resizing, defaults to "bilinear".
seed: (Optional) Used to create a random seed, defaults to None.
seed: (Optional) Used to create a random seed, defaults to `None`.
"""

def __init__(
Expand Down
3 changes: 2 additions & 1 deletion keras_cv/bounding_box/to_ragged.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ def to_ragged(bounding_boxes, sentinel=-1, dtype=tf.float32):
bounding_boxes: a Tensor of bounding boxes. May be batched, or
unbatched.
sentinel: The value indicating that a bounding box does not exist at the
current index, and the corresponding box is padding, defaults to -1.
current index, and the corresponding box is padding.
Defaults to `-1`.
dtype: the data type to use for the underlying Tensors.
Returns:
dictionary of `tf.RaggedTensor` or 'tf.Tensor' containing the filtered
Expand Down
8 changes: 4 additions & 4 deletions keras_cv/datasets/imagenet/load.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,12 @@ def load(
batch_size: how many instances to include in batches after loading.
Should only be specified if img_size is specified (so that images
can be resized to the same size before batching).
shuffle: whether to shuffle the dataset, defaults to True.
shuffle: whether to shuffle the dataset, defaults to `True`.
shuffle_buffer: the size of the buffer to use in shuffling.
reshuffle_each_iteration: whether to reshuffle the dataset on every
epoch, defaults to False.
img_size: the size to resize the images to, defaults to None, indicating
that images should not be resized.
epoch, defaults to `False`.
img_size: the size to resize the images to, when None, this indicates
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when None

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to me:

the size to resize the images to, when None, this indicates that images should not be resized. Defaults to None.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry I just meant use backticks for None. GitHub is rendering my backticks which makes these comments less clear 😓

that images should not be resized. Defaults to `None`.

Returns:
tf.data.Dataset containing ImageNet. Each entry is a dictionary
Expand Down
2 changes: 1 addition & 1 deletion keras_cv/datasets/pascal_voc/load.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def load(
batch_size: how many instances to include in batches after loading
shuffle_buffer: the size of the buffer to use in shuffling.
shuffle_files: (Optional) whether to shuffle files, defaults to
True.
`True`.
dataset: (Optional) the PascalVOC dataset to load from. Should be either
'voc/2007' or 'voc/2012', defaults to 'voc/2007'.

Expand Down
4 changes: 2 additions & 2 deletions keras_cv/datasets/pascal_voc/segmentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -484,8 +484,8 @@ def load(
dataset. Defaults to `sbd_train`.
data_dir: string, local directory path for the loaded data. This will be
used to download the data file, and unzip. It will be used as a
cache directory. Defaults to None, and `~/.keras/pascal_voc_2012`
will be used.
cache directory. When `None`: `~/.keras/pascal_voc_2012`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe best to just say defaults to ~/.keras/pascal_voc_2012?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But it doesn't default to that value? - It computes to it sure, but defaults to None.

will be used. Defaults to `None`.
"""
supported_split_value = [
"train",
Expand Down
2 changes: 1 addition & 1 deletion keras_cv/keypoint/converters.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def convert_format(keypoints, source, target, images=None, dtype=None):
Required when transforming from a rel format to a non-rel
format.
dtype: the data type to use when transforming the boxes.
Defaults to None, i.e. `keypoints` dtype.
When `None` uses a `keypoints` dtype. Defaults to `None`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Defaults to the dtype of keypoints?

"""

source = source.lower()
Expand Down
8 changes: 4 additions & 4 deletions keras_cv/layers/feature_pyramid.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,13 @@ class FeaturePyramid(keras.layers.Layer):
lateral_layers: a python dict with int keys that matches to each of the
pyramid level. The values of the dict should be `keras.Layer`, which
will be called with feature activation outputs from backbone at each
level. Defaults to None, and a `keras.Conv2D` layer with kernel 1x1
will be created for each pyramid level.
level. When None: a `keras.Conv2D` layer with kernel 1x1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When None

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Meant to indicate that backticks should be used)

will be created for each pyramid level. Defaults to `None`.
output_layers: a python dict with int keys that matches to each of the
pyramid level. The values of the dict should be `keras.Layer`, which
will be called with feature inputs and merged result from upstream
levels. Defaults to None, and a `keras.Conv2D` layer with kernel 3x3
will be created for each pyramid level.
levels. When `None`: a `keras.Conv2D` layer with kernel 3x3
will be created for each pyramid level. Defaults to `None`.

Sample Usage:
```python
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ class MultiClassNonMaxSuppression(keras.layers.Layer):
confidence.
iou_threshold: a float value in the range [0, 1] representing the minimum
IoU threshold for two boxes to be considered same for suppression.
Defaults to 0.5.
Defaults to `0.5`.
confidence_threshold: a float value in the range [0, 1]. All boxes with
confidence below this value will be discarded, defaults to 0.5.
confidence below this value will be discarded, defaults to `0.5`.
max_detections: the maximum detections to consider after nms is applied. A
large number may trigger significant memory overhead, defaults to 100.
large number may trigger significant memory overhead, defaults to `100`.
max_detections_per_class: the maximum detections to consider per class
after nms is applied, defaults to 100.
after nms is applied, defaults to `100`.
""" # noqa: E501

def __init__(
Expand Down
2 changes: 1 addition & 1 deletion keras_cv/layers/object_detection/roi_sampler.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class _ROISampler(keras.layers.Layer):
background_class: the background class which is used to map returned the
sampled ground truth which is classified as background.
num_sampled_rois: the number of sampled proposals per image for
further (loss) calculation, defaults to 256.
further (loss) calculation, defaults to `256`.
append_gt_boxes: boolean, whether gt_boxes will be appended to rois
before sample the rois, defaults to True.
""" # noqa: E501
Expand Down
5 changes: 3 additions & 2 deletions keras_cv/layers/preprocessing/aug_mix.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,14 @@ class AugMix(BaseImageAugmentationLayer):
`keras_cv.FactorSampler`. A value is sampled from the provided
range. If a float is passed, the range is interpreted as
`(0, severity)`. This value represents the level of strength of
augmentations and is in the range [0, 1]. Defaults to 0.3.
augmentations and is in the range [0, 1]. Defaults to `0.3`.
num_chains: an integer representing the number of different chains to
be mixed, defaults to 3.
chain_depth: an integer or range representing the number of
transformations in the chains. If a range is passed, a random
`chain_depth` value sampled from a uniform distribution over the
given range is called at the start of the chain. Defaults to [1,3].
given range is called at the start of the chain.
Defaults to `[1,3]`.
alpha: a float value used as the probability coefficients for the
Beta and Dirichlet distributions, defaults to 1.0.
seed: Integer. Used to create a random seed.
Expand Down
4 changes: 2 additions & 2 deletions keras_cv/layers/preprocessing/cut_mix.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ class CutMix(BaseImageAugmentationLayer):
Args:
alpha: Float between 0 and 1. Inverse scale parameter for the gamma
distribution. This controls the shape of the distribution from which
the smoothing values are sampled. Defaults to 1.0, which is a
recommended value when training an imagenet1k classification model.
the smoothing values are sampled. 1.0 is a recommended value when
training an imagenet1k classification model. Defaults to `1.0`.
seed: Integer. Used to create a random seed.
References:
- [CutMix paper]( https://arxiv.org/abs/1905.04899).
Expand Down
4 changes: 2 additions & 2 deletions keras_cv/layers/preprocessing/fourier_mix.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ class FourierMix(BaseImageAugmentationLayer):
Args:
alpha: Float value for beta distribution. Inverse scale parameter for
the gamma distribution. This controls the shape of the distribution
from which the smoothing values are sampled. Defaults to 0.5, which
is a recommended value in the paper.
from which the smoothing values are sampled. 0.5 is a recommended
value in the paper. Defaults to `0.5`.
decay_power: A float value representing the decay power, defaults to 3,
as recommended in the paper.
seed: Integer. Used to create a random seed.
Expand Down
1 change: 0 additions & 1 deletion keras_cv/layers/preprocessing/grid_mask.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ class GridMask(BaseImageAugmentationLayer):
Floats should be in the range [0, 1]. 0.5 indicates that grid and
spacing will be of equal size. To always use the same value, pass a
`keras_cv.ConstantFactorSampler()`.

Defaults to `(0, 0.5)`.
rotation_factor:
The rotation_factor will be used to randomly rotate the grid_mask
Expand Down
4 changes: 2 additions & 2 deletions keras_cv/layers/preprocessing/mix_up.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ class MixUp(BaseImageAugmentationLayer):
Args:
alpha: Float between 0 and 1. Inverse scale parameter for the gamma
distribution. This controls the shape of the distribution from which
the smoothing values are sampled. Defaults to 0.2, which is a
recommended value when training an imagenet1k classification model.
the smoothing values are sampled. 0.2 is a recommended value when
training an imagenet1k classification model. Defaults to `0.2`.
seed: Integer. Used to create a random seed.

References:
Expand Down
4 changes: 2 additions & 2 deletions keras_cv/layers/preprocessing/mosaic.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,15 @@ class Mosaic(VectorizedBaseImageAugmentationLayer):
single float is used, a value between `0.0` and the passed float is
sampled. In order to ensure the value is always the same, please
pass a tuple with two identical floats: `(0.5, 0.5)`. Defaults to
(0.25, 0.75).
`(0.25, 0.75)`.
bounding_box_format: a case-insensitive string (for example, "xyxy") to
be passed if bounding boxes are being augmented by this layer. Each
bounding box is defined by at least these 4 values. The inputs may
contain additional information such as classes and confidence after
these 4 values but these values will be ignored and returned as is.
For detailed information on the supported formats, see the
[KerasCV bounding box documentation](https://keras.io/api/keras_cv/bounding_box/formats/).
Defaults to None.
Defaults to `None`.
seed: integer, used to create a random seed.

References:
Expand Down
2 changes: 1 addition & 1 deletion keras_cv/layers/preprocessing/rand_augment.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class RandAugment(RandomAugmentationPipeline):
augmentation 10/11th of the time. Defaults to `1.0`.
geometric: whether to include geometric augmentations. This
should be set to False when performing object detection. Defaults to
True.
`True`.
Usage:
```python
(x_test, y_test), _ = keras.datasets.cifar10.load_data()
Expand Down
4 changes: 2 additions & 2 deletions keras_cv/layers/preprocessing/random_apply.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ class RandomApply(BaseImageAugmentationLayer):
modify the size of provided inputs.
rate: controls the frequency of applying the layer. 1.0 means all
elements in a batch will be modified. 0.0 means no elements will be
modified. Defaults to 0.5.
modified. Defaults to `0.5`.
batchwise: (Optional) bool, whether to pass entire batches to the
underlying layer. When set to true, only a single random sample is
drawn to determine if the batch should be passed to the underlying
layer. This is useful when using `MixUp()`, `CutMix()`, `Mosaic()`,
etc.
auto_vectorize: bool, whether to use tf.vectorized_map or tf.map_fn for
batched input. Setting this to True might give better performance
but currently doesn't work with XLA. Defaults to False.
but currently doesn't work with XLA. Defaults to `False`.
seed: integer, controls random behaviour.

Example usage:
Expand Down
8 changes: 4 additions & 4 deletions keras_cv/layers/preprocessing/random_flip.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ class RandomFlip(VectorizedBaseImageAugmentationLayer):

Args:
mode: String indicating which flip mode to use. Can be `"horizontal"`,
`"vertical"`, or `"horizontal_and_vertical"`, defaults to
`"horizontal"`. `"horizontal"` is a left-right flip and
`"vertical"` is a top-bottom flip.
`"vertical"`, or `"horizontal_and_vertical"`. `"horizontal"` is a
left-right flip and `"vertical"` is a top-bottom flip.
Defaults to `"horizontal"`
rate: A float that controls the frequency of flipping. 1.0 indicates
that images are always flipped. 0.0 indicates no flipping.
Defaults to 0.5.
Defaults to `0.5`.
seed: Integer. Used to create a random seed.
bounding_box_format: The format of bounding boxes of input dataset.
Refer to
Expand Down
4 changes: 2 additions & 2 deletions keras_cv/layers/preprocessing/random_zoom.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ class RandomZoom(VectorizedBaseImageAugmentationLayer):
represented as a single float, this value is used for both the upper and
lower bound. For instance, `width_factor=(0.2, 0.3)` result in an output
zooming out between 20% to 30%. `width_factor=(-0.3, -0.2)` result in an
output zooming in between 20% to 30%. Defaults to `None`, i.e., zooming
output zooming in between 20% to 30%. When set to `None`, i.e., zooming
vertical and horizontal directions by preserving the aspect ratio. If
height_factor=0 and width_factor=None, it would result in images with
no zoom at all.
no zoom at all. Defaults to `None`.
fill_mode: Points outside the boundaries of the input are filled according
to the given mode (one of `{"constant", "reflect", "wrap", "nearest"}`).
- *reflect*: `(d c b a | a b c d | d c b a)` The input is extended by
Expand Down
Loading