Skip to content

Commit

Permalink
Standardize docstring (#2399)
Browse files Browse the repository at this point in the history
  • Loading branch information
sachinprasadhs authored Mar 25, 2024
1 parent 301f7cd commit 15f09eb
Show file tree
Hide file tree
Showing 88 changed files with 88 additions and 88 deletions.
2 changes: 1 addition & 1 deletion benchmarks/vectorized_channel_shuffle.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class OldChannelShuffle(BaseImageAugmentationLayer):
training: A boolean argument that determines whether the call should be
run in inference mode or training mode, defaults to True.
Usage:
Example:
```python
(images, labels), _ = keras.datasets.cifar10.load_data()
channel_shuffle = keras_cv.layers.ChannelShuffle()
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/vectorized_grayscale.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class OldGrayscale(BaseImageAugmentationLayer):
after the `Grayscale` operation:
a. (..., height, width, 1) if output_channels = 1
b. (..., height, width, 3) if output_channels = 3.
Usage:
Example:
```python
(images, labels), _ = keras.datasets.cifar10.load_data()
to_grayscale = keras_cv.layers.preprocessing.Grayscale()
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/vectorized_jittered_resize.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class OldJitteredResize(BaseImageAugmentationLayer):
are translated and scaled according to the random scaling and random
cropping.
Usage:
Example:
```python
train_ds = load_object_detection_dataset()
jittered_resize = layers.JitteredResize(
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/vectorized_mosaic.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class OldMosaic(BaseImageAugmentationLayer):
- [Yolov5 implementation](https://github.com/ultralytics/yolov5).
- [YoloX implementation](https://github.com/Megvii-BaseDetection/YOLOX)
Sample usage:
Example:
```python
(images, labels), _ = keras.datasets.cifar10.load_data()
labels = tf.one_hot(labels,10)
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/vectorized_random_color_jitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class OldRandomColorJitter(BaseImageAugmentationLayer):
pass a tuple with two identical floats: `(0.5, 0.5)`.
seed: Integer. Used to create a random seed.
Usage:
Example:
```python
(images, labels), _ = keras.datasets.cifar10.load_data()
color_jitter = keras_cv.layers.RandomColorJitter(
Expand Down
2 changes: 1 addition & 1 deletion keras_cv/bounding_box/converters.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ def convert_format(
performance loss, as each image will need to be processed separately due to
the mismatching image shapes.
Usage:
Example:
```python
boxes = load_coco_dataset()
Expand Down
2 changes: 1 addition & 1 deletion keras_cv/bounding_box/to_ragged.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def to_ragged(bounding_boxes, sentinel=-1, dtype=tf.float32):
checking for padded sentinel value of the class_id axis of the
bounding_boxes.
Usage:
Example:
```python
bounding_boxes = {
"boxes": tf.constant([[2, 3, 4, 5], [0, 1, 2, 3]]),
Expand Down
2 changes: 1 addition & 1 deletion keras_cv/core/factor_sampler/constant_factor_sampler.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class ConstantFactorSampler(FactorSampler):
Args:
value: the value to return from `__call__()`.
Usage:
Example:
```python
constant_factor = keras_cv.ConstantFactorSampler(0.5)
random_sharpness = keras_cv.layers.RandomSharpness(factor=constant_factor)
Expand Down
2 changes: 1 addition & 1 deletion keras_cv/core/factor_sampler/normal_factor_sampler.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class NormalFactorSampler(FactorSampler):
min_value: values below min_value are clipped to min_value.
max_value: values above max_value are clipped to max_value.
Usage:
Example:
```python
factor = keras_cv.core.NormalFactor(
mean=0.5,
Expand Down
2 changes: 1 addition & 1 deletion keras_cv/core/factor_sampler/uniform_factor_sampler.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class UniformFactorSampler(FactorSampler):
seed: A shape int or Tensor, the seed to the random number generator.
Must have dtype int32 or int64. (When using XLA, only int32 is
allowed.)
Usage:
Example:
```python
uniform_factor = keras_cv.UniformFactorSampler(0, 0.5)
random_sharpness = keras_cv.layers.RandomSharpness(factor=uniform_factor)
Expand Down
2 changes: 1 addition & 1 deletion keras_cv/datasets/imagenet/load.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def load(
):
"""Loads the ImageNet dataset from TFRecords
Usage:
Example:
```python
dataset, ds_info = keras_cv.datasets.imagenet.load(
split="train", tfrecord_path="gs://my-bucket/imagenet-tfrecords"
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 @@ -52,7 +52,7 @@ def load(
):
"""Loads the PascalVOC 2007 dataset.
Usage:
Example:
```python
dataset, ds_info = keras_cv.datasets.pascal_voc.load(
split="train", bounding_box_format="xywh", batch_size=9
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 @@ -82,7 +82,7 @@ def convert_format(keypoints, source, target, images=None, dtype=None):
will need to be processed separately due to the mismatching image
shapes.
Usage:
Example:
```python
images, keypoints = load_my_dataset()
Expand Down
2 changes: 1 addition & 1 deletion keras_cv/layers/augmenter.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class Augmenter(keras.layers.Layer):
Args:
layers: A list of `keras.layers.Layers` to apply to the example
Examples:
Example:
from keras_cv import layers
images = np.ones((16, 256, 256, 3))
augmenter = layers.Augmenter(
Expand Down
2 changes: 1 addition & 1 deletion keras_cv/layers/feature_pyramid.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class FeaturePyramid(keras.layers.Layer):
levels. Defaults to None, and a `keras.Conv2D` layer with kernel 3x3
will be created for each pyramid level.
Sample Usage:
Example:
```python
inp = keras.layers.Input((384, 384, 3))
Expand Down
2 changes: 1 addition & 1 deletion keras_cv/layers/fusedmbconv.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class FusedMBConvBlock(keras.layers.Layer):
block
Example usage:
Example:
```
inputs = tf.random.normal(shape=(1, 64, 64, 32), dtype=tf.float32)
Expand Down
2 changes: 1 addition & 1 deletion keras_cv/layers/hierarchical_transformer_encoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class HierarchicalTransformerEncoder(keras.layers.Layer):
`SegFormerMultiheadAttention`. If set to > 1, a `Conv2D`
layer is used to reduce the length of the sequence. Defaults to `1`.
Basic usage:
Example:
```
project_dim = 1024
Expand Down
2 changes: 1 addition & 1 deletion keras_cv/layers/mbconv.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def __init__(
block
Example usage:
Example:
```
inputs = tf.random.normal(shape=(1, 64, 64, 32), dtype=tf.float32)
Expand Down
2 changes: 1 addition & 1 deletion keras_cv/layers/object_detection/anchor_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class AnchorGenerator(keras.layers.Layer):
clip_boxes: whether to clip generated anchor boxes to the image
size, defaults to `False`.
Usage:
Example:
```python
strides = [8, 16, 32]
scales = [1, 1.2599210498948732, 1.5874010519681994]
Expand Down
2 changes: 1 addition & 1 deletion keras_cv/layers/object_detection/box_matcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class BoxMatcher(keras.layers.Layer):
ValueError: if `thresholds` not sorted or
len(`match_values`) != len(`thresholds`) + 1
Usage:
Example:
```python
box_matcher = keras_cv.layers.BoxMatcher([0.3, 0.7], [-1, 0, 1])
Expand Down
2 changes: 1 addition & 1 deletion keras_cv/layers/object_detection/roi_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class ROIGenerator(keras.layers.Layer):
feature maps / levels (as in FPN) this number is per
feature map / level.
Usage:
Example:
```python
roi_generator = ROIGenerator("xyxy")
boxes = {2: tf.random.normal([32, 5, 4])}
Expand Down
2 changes: 1 addition & 1 deletion keras_cv/layers/object_detection/roi_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class ROIPooler(keras.layers.Layer):
image_shape: List of Tuple of 3 integers, or `TensorShape` of the input
image shape.
Usage:
Example:
```python
feature_map = tf.random.normal([2, 16, 16, 512])
roi_pooler = ROIPooler(bounding_box_format="yxyx", target_size=[7, 7],
Expand Down
2 changes: 1 addition & 1 deletion keras_cv/layers/overlapping_patching_embedding.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def __init__(self, project_dim=32, patch_size=7, stride=4, **kwargs):
stride: integer, the stride to use for the patching before
projection. Defaults to `5`.
Basic usage:
Example:
```
project_dim = 1024
Expand Down
2 changes: 1 addition & 1 deletion keras_cv/layers/preprocessing/aug_mix.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class AugMix(BaseImageAugmentationLayer):
- [Official Code](https://github.com/google-research/augmix)
- [Unofficial TF Code](https://github.com/szacho/augmix-tf)
Sample Usage:
Example:
```python
(images, labels), _ = keras.datasets.cifar10.load_data()
augmix = keras_cv.layers.AugMix([0, 255])
Expand Down
2 changes: 1 addition & 1 deletion keras_cv/layers/preprocessing/channel_shuffle.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class ChannelShuffle(VectorizedBaseImageAugmentationLayer):
groups: Number of groups to divide the input channels, defaults to 3.
seed: Integer. Used to create a random seed.
Usage:
Example:
```python
(images, labels), _ = keras.datasets.cifar10.load_data()
channel_shuffle = ChannelShuffle(groups=3)
Expand Down
2 changes: 1 addition & 1 deletion keras_cv/layers/preprocessing/equalization.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class Equalization(VectorizedBaseImageAugmentationLayer):
bins: Integer indicating the number of bins to use in histogram
equalization. Should be in the range [0, 256].
Usage:
Example:
```python
equalize = Equalization()
Expand Down
2 changes: 1 addition & 1 deletion keras_cv/layers/preprocessing/fourier_mix.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class FourierMix(BaseImageAugmentationLayer):
References:
- [FMix paper](https://arxiv.org/abs/2002.12047).
Sample usage:
Example:
```python
(images, labels), _ = keras.datasets.cifar10.load_data()
fourier_mix = keras_cv.layers.preprocessing.FourierMix(0.5)
Expand Down
2 changes: 1 addition & 1 deletion keras_cv/layers/preprocessing/grayscale.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class Grayscale(VectorizedBaseImageAugmentationLayer):
a. (..., height, width, 1) if output_channels = 1
b. (..., height, width, 3) if output_channels = 3.
Usage:
Example:
```python
(images, labels), _ = keras.datasets.cifar10.load_data()
to_grayscale = keras_cv.layers.preprocessing.Grayscale()
Expand Down
2 changes: 1 addition & 1 deletion keras_cv/layers/preprocessing/grid_mask.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class GridMask(BaseImageAugmentationLayer):
[0 to 255]
seed: Integer. Used to create a random seed.
Usage:
Example:
```python
(images, labels), _ = keras.datasets.cifar10.load_data()
random_gridmask = keras_cv.layers.preprocessing.GridMask()
Expand Down
2 changes: 1 addition & 1 deletion keras_cv/layers/preprocessing/jittered_resize.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class JitteredResize(VectorizedBaseImageAugmentationLayer):
`"mitchellcubic"`.
seed: (Optional) integer to use as the random seed.
Usage:
Example:
```python
train_ds = load_object_detection_dataset()
jittered_resize = layers.JitteredResize(
Expand Down
2 changes: 1 addition & 1 deletion keras_cv/layers/preprocessing/mix_up.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class MixUp(BaseImageAugmentationLayer):
- [MixUp paper](https://arxiv.org/abs/1710.09412).
- [MixUp for Object Detection paper](https://arxiv.org/pdf/1902.04103).
Sample usage:
Example:
```python
(images, labels), _ = keras.datasets.cifar10.load_data()
images, labels = images[:10], labels[:10]
Expand Down
2 changes: 1 addition & 1 deletion keras_cv/layers/preprocessing/mosaic.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class Mosaic(VectorizedBaseImageAugmentationLayer):
- [Yolov5 implementation](https://github.com/ultralytics/yolov5).
- [YoloX implementation](https://github.com/Megvii-BaseDetection/YOLOX)
Sample usage:
Example:
```python
(images, labels), _ = keras.datasets.cifar10.load_data()
labels = tf.one_hot(labels,10)
Expand Down
2 changes: 1 addition & 1 deletion keras_cv/layers/preprocessing/posterization.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class Posterization(BaseImageAugmentationLayer):
bits: integer, the number of bits to keep for each channel. Must be a
value between 1-8.
Usage:
Example:
```python
(images, labels), _ = keras.datasets.cifar10.load_data()
print(images[0, 0, 0])
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):
geometric: whether to include geometric augmentations. This
should be set to False when performing object detection. Defaults to
True.
Usage:
Example:
```python
(x_test, y_test), _ = keras.datasets.cifar10.load_data()
rand_augment = keras_cv.layers.RandAugment(
Expand Down
2 changes: 1 addition & 1 deletion keras_cv/layers/preprocessing/random_apply.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class RandomApply(BaseImageAugmentationLayer):
but currently doesn't work with XLA. Defaults to False.
seed: integer, controls random behaviour.
Example usage:
Example:
```
# Let's declare an example layer that will set all image pixels to zero.
zero_out = keras.layers.Lambda(lambda x: {"images": 0 * x["images"]})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class RandomAugmentationPipeline(BaseImageAugmentationLayer):
This layer can be used to create custom policies resembling `RandAugment` or
`AutoAugment`.
Usage:
Example:
```python
# construct a list of layers
layers = keras_cv.layers.RandAugment.get_standard_policy(
Expand Down
2 changes: 1 addition & 1 deletion keras_cv/layers/preprocessing/random_brightness.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class RandomBrightness(VectorizedBaseImageAugmentationLayer):
be clipped to the range `[0, 255]`, the valid range of RGB colors, and
rescaled based on the `value_range` if needed.
Usage:
Example:
```python
(images, labels), _ = keras.datasets.cifar10.load_data()
random_brightness = keras_cv.layers.preprocessing.RandomBrightness()
Expand Down
2 changes: 1 addition & 1 deletion keras_cv/layers/preprocessing/random_channel_shift.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class RandomChannelShift(BaseImageAugmentationLayer):
less channels.
seed: Integer. Used to create a random seed.
Usage:
Example:
```python
(images, labels), _ = keras.datasets.cifar10.load_data()
rgb_shift = keras_cv.layers.RandomChannelShift(value_range=(0, 255),
Expand Down
2 changes: 1 addition & 1 deletion keras_cv/layers/preprocessing/random_choice.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class RandomChoice(BaseImageAugmentationLayer):
`call`(), the policy selects a random layer from the provided list of
`layers`. It then calls the `layer()` on the inputs.
Usage:
Example:
```python
# construct a list of layers
layers = keras_cv.layers.RandAugment.get_standard_policy(
Expand Down
2 changes: 1 addition & 1 deletion keras_cv/layers/preprocessing/random_color_jitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class RandomColorJitter(VectorizedBaseImageAugmentationLayer):
pass a tuple with two identical floats: `(0.5, 0.5)`.
seed: Integer. Used to create a random seed.
Usage:
Example:
```python
(images, labels), _ = keras.datasets.cifar10.load_data()
color_jitter = keras_cv.layers.RandomColorJitter(
Expand Down
2 changes: 1 addition & 1 deletion keras_cv/layers/preprocessing/random_contrast.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class RandomContrast(VectorizedBaseImageAugmentationLayer):
`mean` is the mean value of the channel.
seed: Integer. Used to create a random seed.
Usage:
Example:
```python
(images, labels), _ = keras.datasets.cifar10.load_data()
random_contrast = keras_cv.layers.preprocessing.RandomContrast()
Expand Down
2 changes: 1 addition & 1 deletion keras_cv/layers/preprocessing/random_cutout.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class RandomCutout(VectorizedBaseImageAugmentationLayer):
when `fill_mode="constant"`.
seed: Integer. Used to create a random seed.
Sample usage:
Example:
```python
(images, labels), _ = keras.datasets.cifar10.load_data()
random_cutout = keras_cv.layers.preprocessing.RandomCutout(0.5, 0.5)
Expand Down
2 changes: 1 addition & 1 deletion keras_cv/layers/preprocessing/random_hue.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class RandomHue(VectorizedBaseImageAugmentationLayer):
preprocessing pipeline is set up.
seed: Integer. Used to create a random seed.
Usage:
Example:
```python
(images, labels), _ = keras.datasets.cifar10.load_data()
random_hue = keras_cv.layers.preprocessing.RandomHue()
Expand Down
2 changes: 1 addition & 1 deletion keras_cv/layers/preprocessing/random_jpeg_quality.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class RandomJpegQuality(BaseImageAugmentationLayer):
`tf.image.adjust_jpeg_quality()`.
seed: Integer. Used to create a random seed.
Usage:
Example:
```python
layer = keras_cv.RandomJpegQuality(factor=(75, 100)))
(images, labels), _ = keras.datasets.cifar10.load_data()
Expand Down
Loading

0 comments on commit 15f09eb

Please sign in to comment.