Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use a max line length of 80 universally #1552

Merged
merged 25 commits into from
Apr 7, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
7816a83
Enforces line length 80 Part 1
ID6109 Mar 18, 2023
f63d839
Enforces line length 80 Part 2 and fixes typos
ID6109 Mar 19, 2023
9529907
Enforces line length 80 Part 3 and fixes typos
ID6109 Mar 20, 2023
8b5f4bd
Enforces line length 80 Part 4 and fixes typos
ID6109 Mar 20, 2023
2ceb745
Merge branch 'master' of https://github.com/keras-team/keras-cv into …
ID6109 Mar 20, 2023
c3e4518
Enforces line length 80 Part 5 and fixes typos
ID6109 Mar 20, 2023
76b4164
Merge branch 'master' of https://github.com/keras-team/keras-cv into …
ID6109 Mar 20, 2023
d78fbe9
Minor change
ID6109 Mar 20, 2023
2bdeaf9
Merge branch 'master' of https://github.com/keras-team/keras-cv into …
ID6109 Mar 21, 2023
fae927e
Replaced double spaces with a single space
ID6109 Mar 21, 2023
a4646fc
Merge branch 'master' of https://github.com/keras-team/keras-cv into …
ID6109 Mar 21, 2023
fbbd972
Merge branch 'master' of https://github.com/keras-team/keras-cv into …
ID6109 Mar 21, 2023
7af3dfc
Merge Conflicts
ID6109 Mar 21, 2023
38b32f0
Minor Changes
ID6109 Mar 21, 2023
035cb6e
Merge branch 'master' of https://github.com/keras-team/keras-cv into …
ID6109 Mar 23, 2023
469fbe6
Resolves Merge Conflicts
ID6109 Mar 23, 2023
6193336
Merge branch 'master' into MaxLineLength
haifeng-jin Apr 4, 2023
92ab80f
Merge branch 'master' into MaxLineLength
haifeng-jin Apr 4, 2023
f662bfd
Merge conflicts
ID6109 Apr 5, 2023
356fb1a
Additional improvements + Changes requested
ID6109 Apr 5, 2023
53c8246
Merge branch 'master' of https://github.com/keras-team/keras-cv into …
ID6109 Apr 6, 2023
1e7477d
Merging
ID6109 Apr 6, 2023
80a6ed4
Changes requested
ID6109 Apr 7, 2023
0a40c56
Minor improvements
ID6109 Apr 7, 2023
06244d4
Merge branch 'master' into MaxLineLength
haifeng-jin Apr 7, 2023
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
Prev Previous commit
Next Next commit
Changes requested
  • Loading branch information
ID6109 committed Apr 7, 2023
commit 80a6ed435fe96f0b1de58e2b87db344edfacd89f
4 changes: 2 additions & 2 deletions benchmarks/vectorized_random_sharpness.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class OldRandomSharpness(BaseImageAugmentationLayer):
an image less sharp than they were in the original image.

References:
- [PIL](https://pillow.readthedocs.io/en/stable/reference/ImageEnhance.html) # noqa: E501
- [PIL](https://pillow.readthedocs.io/en/stable/reference/ImageEnhance.html)

Args:
factor: A tuple of two floats, a single float or
Expand All @@ -36,7 +36,7 @@ class OldRandomSharpness(BaseImageAugmentationLayer):
Represented as a two number tuple written [low, high].
This is typically either `[0, 1]` or `[0, 255]` depending
on how your preprocessing pipeline is set up.
"""
""" # noqa: E501

def __init__(
self,
Expand Down
4 changes: 2 additions & 2 deletions keras_cv/bounding_box/iou.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ def compute_iou(
unbatched.
bounding_box_format: a case-insensitive string which is one of `"xyxy"`,
`"rel_xyxy"`, `"xyWH"`, `"center_xyWH"`, `"yxyx"`, `"rel_yxyx"`.
For detailed information on the supported format, see the [KerasCV
bounding box documentation](https://keras.io/api/keras_cv/bounding_box/formats/).
For detailed information on the supported format, see the
[KerasCV bounding box documentation](https://keras.io/api/keras_cv/bounding_box/formats/).
use_masking: whether masking will be applied. This will mask all `boxes1`
or `boxes2` that have values less than 0 in all its 4 dimensions.
Default to `False`.
Expand Down
8 changes: 4 additions & 4 deletions keras_cv/datasets/pascal_voc/load.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ def load(
split: the split string passed to the `tensorflow_datasets.load()` call.
Should be one of "train", "test", or "validation."
bounding_box_format: the keras_cv bounding box format to load the boxes
into. For a list of supported formats, please refer [to the keras.io
docs](https://keras.io/api/keras_cv/bounding_box/formats/) for more
details on supported bounding box formats.
into. For a list of supported formats, please refer
[to the keras.io docs](https://keras.io/api/keras_cv/bounding_box/formats/)
for more details on supported bounding box formats.
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
Expand All @@ -76,7 +76,7 @@ def load(
containing keys {"images": images, "bounding_boxes": bounding_boxes}
where images is a Tensor of shape [batch, H, W, 3] and bounding_boxes is
a `tf.RaggedTensor` of shape [batch, None, 5].
"""
""" # noqa: E501
if dataset not in ["voc/2007", "voc/2012"]:
raise ValueError(
"keras_cv.datasets.pascal_voc.load() expects the `dataset` "
Expand Down
9 changes: 3 additions & 6 deletions keras_cv/layers/fusedmbconv.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,8 @@ class FusedMBConvBlock(layers.Layer):
"""
Implementation of the FusedMBConv block (Fused Mobile Inverted Residual
Bottleneck) from:
(EfficientNet-EdgeTPU: Creating Accelerator-Optimized Neural Networks
with AutoML)
[https://ai.googleblog.com/2019/08/efficientnet-edgetpu-creating.html]
(EfficientNetV2: Smaller Models and Faster Training)
[https://arxiv.org/abs/2104.00298v3].
[EfficientNet-EdgeTPU: Creating Accelerator-Optimized Neural Networks with AutoML](https://ai.googleblog.com/2019/08/efficientnet-edgetpu-creating.html)
[EfficientNetV2: Smaller Models and Faster Training](https://arxiv.org/abs/2104.00298v3).

FusedMBConv blocks are based on MBConv blocks, and replace the depthwise and
1x1 output convolution blocks with a single 3x3 convolution block, fusing
Expand Down Expand Up @@ -87,7 +84,7 @@ class FusedMBConvBlock(layers.Layer):
output = layer(inputs)
output.shape # TensorShape([1, 224, 224, 48])
```
"""
""" # noqa: E501

def __init__(
self,
Expand Down
6 changes: 3 additions & 3 deletions keras_cv/layers/mbconv.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ def __init__(
"""
Implementation of the MBConv block (Mobile Inverted Residual Bottleneck)
from:
(MobileNetV2: Inverted Residuals and Linear Bottlenecks)
[https://arxiv.org/abs/1801.04381v4].
[MobileNetV2: Inverted Residuals and Linear Bottlenecks](https://arxiv.org/abs/1801.04381v4).

MBConv blocks are common blocks used in mobile-oriented and efficient
architectures, present in architectures such as MobileNet, EfficientNet,
Expand Down Expand Up @@ -96,7 +95,8 @@ def __init__(
output = layer(inputs)
output.shape # TensorShape([1, 64, 64, 32])
```
"""
""" # noqa: E501

super().__init__(**kwargs)
self.input_filters = input_filters
self.output_filters = output_filters
Expand Down
5 changes: 3 additions & 2 deletions keras_cv/layers/object_detection/anchor_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@ class AnchorGenerator(keras.layers.Layer):
levels), or a dictionary from `{'level_{number}': [parameters at scale...]}`

Args:
bounding_box_format: The format of bounding boxes to generate. Refer [to
the keras.io docs](https://keras.io/api/keras_cv/bounding_box/formats/) for more details on supported bounding box formats.
bounding_box_format: The format of bounding boxes to generate. Refer
[to the keras.io docs](https://keras.io/api/keras_cv/bounding_box/formats/)
for more details on supported bounding box formats.
sizes: A list of integers that represent the anchor sizes for each level,
or a dictionary of integer lists with each key representing a level.
For each anchor size, anchor height will be
Expand Down
4 changes: 2 additions & 2 deletions keras_cv/layers/object_detection/roi_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ class ROIGenerator(keras.layers.Layer):

Args:
bounding_box_format: a case-insensitive string.
For detailed information on the supported format, see the [KerasCV
bounding box documentation](https://keras.io/api/keras_cv/bounding_box/formats/).
For detailed information on the supported format, see the
[KerasCV bounding box documentation](https://keras.io/api/keras_cv/bounding_box/formats/).
pre_nms_topk_train: int. number of top k scoring proposals to keep
before applying NMS in training mode. When RPN is run on multiple
feature maps / levels (as in FPN) this number is per
Expand Down
4 changes: 2 additions & 2 deletions keras_cv/layers/object_detection/roi_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ class ROIPooler(keras.layers.Layer):

Args:
bounding_box_format: a case-insensitive string.
For detailed information on the supported format, see the [KerasCV
bounding box documentation](https://keras.io/api/keras_cv/bounding_box/formats/).
For detailed information on the supported format, see the
[KerasCV bounding box documentation](https://keras.io/api/keras_cv/bounding_box/formats/).
target_size: List or Tuple of 2 integers of the pooled shape
image_shape: List of Tuple of 3 integers, or `TensorShape` of the input
image shape.
Expand Down
5 changes: 3 additions & 2 deletions keras_cv/layers/object_detection/roi_sampler.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@ class _ROISampler(keras.layers.Layer):
if its range is [0, num_classes).

Args:
bounding_box_format: The format of bounding boxes to generate. Refer [to
the keras.io docs](https://keras.io/api/keras_cv/bounding_box/formats/) for more details on supported bounding box formats.
bounding_box_format: The format of bounding boxes to generate. Refer
[to the keras.io docs](https://keras.io/api/keras_cv/bounding_box/formats/)
for more details on supported bounding box formats.
roi_matcher: a `BoxMatcher` object that matches proposals with ground
truth boxes. The positive match must be 1 and negative match must be -1.
Such assumption is not being validated here.
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 @@ -59,8 +59,8 @@ class Mosaic(VectorizedBaseImageAugmentationLayer):
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/).
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.
seed: integer, used to create a random seed.

Expand Down
3 changes: 1 addition & 2 deletions keras_cv/layers/preprocessing/posterization.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ class Posterization(BaseImageAugmentationLayer):

References:
- [AutoAugment: Learning Augmentation Policies from Data](https://arxiv.org/abs/1805.09501)
- [RandAugment: Practical automated data augmentation with a reduced search
space](https://arxiv.org/abs/1909.13719)
- [RandAugment: Practical automated data augmentation with a reduced search space](https://arxiv.org/abs/1909.13719)

Args:
value_range: a tuple or a list of two elements. The first value
Expand Down
3 changes: 0 additions & 3 deletions keras_cv/layers/preprocessing/randomly_zoomed_crop.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@
from tensorflow import keras

from keras_cv import core
from keras_cv.layers.preprocessing.vectorized_base_image_augmentation_layer import ( # noqa: E501
IMAGES,
)
from keras_cv.layers.preprocessing.vectorized_base_image_augmentation_layer import ( # noqa: E501
VectorizedBaseImageAugmentationLayer,
)
Expand Down
2 changes: 1 addition & 1 deletion keras_cv/layers/regularization/stochastic_depth.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class StochasticDepth(keras.layers.Layer):

Reference:
- [Deep Networks with Stochastic Depth](https://arxiv.org/abs/1603.09382)
- Docstring taken from [stochastic_depth.py](https://tinyurl.com/mr3y2af6)
- [Docstring taken from [stochastic_depth.py](https://tinyurl.com/mr3y2af6)

Args:
rate: float, the probability of the residual branch being dropped.
Expand Down
8 changes: 3 additions & 5 deletions keras_cv/layers/spatial_pyramid.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,8 @@ class SpatialPyramidPooling(keras.layers.Layer):
"""Implements the Atrous Spatial Pyramid Pooling.

References:
[Rethinking Atrous Convolution for Semantic Image Segmentation](
https://arxiv.org/pdf/1706.05587.pdf)
[Encoder-Decoder with Atrous Separable Convolution for Semantic Image
Segmentation](https://arxiv.org/pdf/1802.02611.pdf)
[Rethinking Atrous Convolution for Semantic Image Segmentation](https://arxiv.org/pdf/1706.05587.pdf)
[Encoder-Decoder with Atrous Separable Convolution for Semantic Image Segmentation](https://arxiv.org/pdf/1802.02611.pdf)

inp = keras.layers.Input((384, 384, 3))
backbone = keras.applications.EfficientNetB0(
Expand All @@ -39,7 +37,7 @@ class SpatialPyramidPooling(keras.layers.Layer):
dilation_rates=[6, 12, 18])(output)

# output[4].shape = [None, 16, 16, 256]
"""
""" # noqa: E501

def __init__(
self,
Expand Down
6 changes: 3 additions & 3 deletions keras_cv/losses/iou_loss.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ class IoULoss(keras.losses.Loss):
Args:
bounding_box_format: a case-insensitive string (for example, "xyxy").
Each bounding box is defined by these 4 values. For detailed
information on the supported formats, see the [KerasCV bounding box
documentation](https://keras.io/api/keras_cv/bounding_box/formats/).
information on the supported formats, see the
[KerasCV bounding box documentation](https://keras.io/api/keras_cv/bounding_box/formats/).
mode: must be one of
- `"linear"`. The loss will be calculated as 1 - iou
- `"quadratic"`. The loss will be calculated as 1 - iou<sup>2</sup>
Expand Down Expand Up @@ -66,7 +66,7 @@ class IoULoss(keras.losses.Loss):
```python
model.compile(optimizer='adam', loss=keras_cv.losses.IoULoss())
```
"""
""" # noqa: E501

def __init__(self, bounding_box_format, mode="log", axis=-1, **kwargs):
super().__init__(**kwargs)
Expand Down
12 changes: 6 additions & 6 deletions keras_cv/models/backbones/resnet_v1/resnet_v1_backbone.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ class ResNetBackbone(Backbone):
"""Instantiates the ResNet architecture.

Reference:
- [Deep Residual Learning for Image Recognition](https://arxiv.org/abs/1512.03385) # noqa: E501
- [Deep Residual Learning for Image Recognition](https://arxiv.org/abs/1512.03385)

The difference in ResNetV1 and ResNetV2 rests in the structure of their
individual building blocks. In ResNetV2, the batch normalization and
Expand All @@ -235,7 +235,7 @@ class ResNetBackbone(Backbone):
convolution layers.

For transfer learning use cases, make sure to read the
[guide to transfer learning & fine-tuning](https://keras.io/guides/transfer_learning/). # noqa: E501
[guide to transfer learning & fine-tuning](https://keras.io/guides/transfer_learning/).

Args:
stackwise_filters: list of ints, number of filters for each stack in
Expand Down Expand Up @@ -269,7 +269,7 @@ class ResNetBackbone(Backbone):
)
output = model(input_data)
```
"""
""" # noqa: E501

def __init__(
self,
Expand Down Expand Up @@ -360,7 +360,7 @@ def presets_with_weights(cls):
ALIAS_DOCSTRING = """ResNetBackbone (V1) model with {num_layers} layers.

Reference:
- [Deep Residual Learning for Image Recognition](https://arxiv.org/abs/1512.03385) # noqa: E501
- [Deep Residual Learning for Image Recognition](https://arxiv.org/abs/1512.03385)

The difference in ResNetV1 and ResNetV2 rests in the structure of their
individual building blocks. In ResNetV2, the batch normalization and
Expand All @@ -369,7 +369,7 @@ def presets_with_weights(cls):
convolution layers.

For transfer learning use cases, make sure to read the
[guide to transfer learning & fine-tuning](https://keras.io/guides/transfer_learning/). # noqa: E501
[guide to transfer learning & fine-tuning](https://keras.io/guides/transfer_learning/).

Args:
include_rescaling: bool, whether to rescale the inputs. If set
Expand All @@ -387,7 +387,7 @@ def presets_with_weights(cls):
model = ResNet{num_layers}Backbone()
output = model(input_data)
```
"""
""" # noqa: E501


class ResNet18Backbone(ResNetBackbone):
Expand Down
8 changes: 4 additions & 4 deletions keras_cv/models/backbones/resnet_v2/resnet_v2_backbone.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,8 +268,8 @@ class ResNetV2Backbone(Backbone):
the batch normalization and ReLU activation are applied after the
convolution layers.

For transfer learning use cases, make sure to read the [guide to transfer
learning & fine-tuning](https://keras.io/guides/transfer_learning/).
For transfer learning use cases, make sure to read the
[guide to transfer learning & fine-tuning](https://keras.io/guides/transfer_learning/).

Args:
stackwise_filters: list of ints, number of filters for each stack in
Expand Down Expand Up @@ -416,8 +416,8 @@ def presets_with_weights(cls):
the batch normalization and ReLU activation are applied after the
convolution layers.

For transfer learning use cases, make sure to read the [guide to transfer
learning & fine-tuning](https://keras.io/guides/transfer_learning/).
For transfer learning use cases, make sure to read the
[guide to transfer learning & fine-tuning](https://keras.io/guides/transfer_learning/).

Args:
include_rescaling: bool, whether to rescale the inputs. If set
Expand Down
4 changes: 2 additions & 2 deletions keras_cv/models/convnext.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@
}

BASE_DOCSTRING = """Instantiates the {name} architecture.
- [A ConvNet for the 2020s](https://arxiv.org/abs/2201.03545)
(CVPR 2022)
- [A ConvNet for the 2020s](https://arxiv.org/abs/2201.03545) (CVPR 2022)

This function returns a Keras {name} model.
Args:
include_rescaling: bool, whether to rescale the inputs. If set
Expand Down
12 changes: 6 additions & 6 deletions keras_cv/models/csp_darknet.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@
- [CSPNet Paper](https://arxiv.org/pdf/1911.11929)
- [YoloX Paper](https://arxiv.org/abs/2107.08430)
- [YoloX implementation](https://github.com/ultralytics/yolov3)
For transfer learning use cases, make sure to read the [guide to transfer
learning & fine-tuning](https://keras.io/guides/transfer_learning/).
For transfer learning use cases, make sure to read the
[guide to transfer learning & fine-tuning](https://keras.io/guides/transfer_learning/).
Args:
include_rescaling: bool, whether to rescale the inputs. If set to
True, inputs will be passed through a `Rescaling(1/255.0)` layer.
Expand Down Expand Up @@ -93,7 +93,7 @@
name: string, optional name to pass to the model, defaults to "{name}".
Returns:
A `keras.Model` instance.
"""
""" # noqa: E501


@keras.utils.register_keras_serializable(package="keras_cv.models")
Expand All @@ -107,8 +107,8 @@ class CSPDarkNet(keras.Model):
- [CSPNet Paper](https://arxiv.org/pdf/1911.11929)
- [YoloX Paper](https://arxiv.org/abs/2107.08430)
- [YoloX implementation](https://github.com/ultralytics/yolov3)
For transfer learning use cases, make sure to read the [guide to transfer
learning & fine-tuning](https://keras.io/guides/transfer_learning/).
For transfer learning use cases, make sure to read the
[guide to transfer learning & fine-tuning](https://keras.io/guides/transfer_learning/).
Args:
depth_multiplier: A float value used to calculate the base depth of the
model this changes based the detection model being used.
Expand Down Expand Up @@ -145,7 +145,7 @@ class CSPDarkNet(keras.Model):
name: (Optional) name to pass to the model, defaults to "CSPDarkNet".
Returns:
A `keras.Model` instance.
"""
""" # noqa: E501

def __init__(
self,
Expand Down
11 changes: 5 additions & 6 deletions keras_cv/models/darknet.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@
- [YoloV3 implementation](https://github.com/ultralytics/yolov3)

For transfer learning use cases, make sure to read the
[guide to transfer learning & fine-tuning](
https://keras.io/guides/transfer_learning/).
[guide to transfer learning & fine-tuning](https://keras.io/guides/transfer_learning/).

Args:
include_rescaling: bool, whether to rescale the inputs. If set to
Expand All @@ -68,7 +67,7 @@

Returns:
A `keras.Model` instance.
"""
""" # noqa: E501


@keras.utils.register_keras_serializable(package="keras_cv.models")
Expand All @@ -83,8 +82,8 @@ class DarkNet(keras.Model):
Reference:
- [YoloV3 Paper](https://arxiv.org/abs/1804.02767)
- [YoloV3 implementation](https://github.com/ultralytics/yolov3)
For transfer learning use cases, make sure to read the [guide to transfer
learning & fine-tuning](https://keras.io/guides/transfer_learning/).
For transfer learning use cases, make sure to read the
[guide to transfer learning & fine-tuning](https://keras.io/guides/transfer_learning/).

Args:
blocks: integer, numbers of building blocks from the layer dark2 to
Expand Down Expand Up @@ -116,7 +115,7 @@ class DarkNet(keras.Model):

Returns:
A `keras.Model` instance.
"""
""" # noqa: E501

def __init__(
self,
Expand Down
Loading
You are viewing a condensed version of this merge commit. You can view the full changes here.