Unverified Commit 6116812d authored by Nicolas Hug's avatar Nicolas Hug Committed by GitHub
Browse files

Document undocumented parameters (#3299)



* Document undodcumented parameters

* remove setup.cfg changes

* Properly pass normalize down instead of deprecating it

* Fix flake8

* Add new CI check

* Fix type spec

* Leave normalize be part of kwargs
Co-authored-by: default avatarVasilis Vryniotis <datumbox@users.noreply.github.com>
parent 59df482d
...@@ -120,6 +120,16 @@ jobs: ...@@ -120,6 +120,16 @@ jobs:
pip install --user --progress-bar off --editable . pip install --user --progress-bar off --editable .
mypy --config-file mypy.ini mypy --config-file mypy.ini
docstring_parameters_sync:
docker:
- image: circleci/python:3.7
steps:
- checkout
- run:
command: |
pip install --user pydocstyle
pydocstyle
clang_format: clang_format:
docker: docker:
- image: circleci/python:3.7 - image: circleci/python:3.7
...@@ -1167,6 +1177,7 @@ workflows: ...@@ -1167,6 +1177,7 @@ workflows:
- build_docs - build_docs
- python_lint - python_lint
- python_type_check - python_type_check
- docstring_parameters_sync
- clang_format - clang_format
- torchhub_test - torchhub_test
- torch_onnx_test - torch_onnx_test
...@@ -1283,6 +1294,7 @@ workflows: ...@@ -1283,6 +1294,7 @@ workflows:
- circleci_consistency - circleci_consistency
- python_lint - python_lint
- python_type_check - python_type_check
- docstring_parameters_sync
- clang_format - clang_format
- torchhub_test - torchhub_test
- torch_onnx_test - torch_onnx_test
......
...@@ -120,6 +120,16 @@ jobs: ...@@ -120,6 +120,16 @@ jobs:
pip install --user --progress-bar off --editable . pip install --user --progress-bar off --editable .
mypy --config-file mypy.ini mypy --config-file mypy.ini
docstring_parameters_sync:
docker:
- image: circleci/python:3.7
steps:
- checkout
- run:
command: |
pip install --user pydocstyle
pydocstyle
clang_format: clang_format:
docker: docker:
- image: circleci/python:3.7 - image: circleci/python:3.7
...@@ -778,6 +788,7 @@ workflows: ...@@ -778,6 +788,7 @@ workflows:
{{ build_workflows(windows_latest_only=True) }} {{ build_workflows(windows_latest_only=True) }}
- python_lint - python_lint
- python_type_check - python_type_check
- docstring_parameters_sync
- clang_format - clang_format
- torchhub_test - torchhub_test
- torch_onnx_test - torch_onnx_test
...@@ -796,6 +807,7 @@ workflows: ...@@ -796,6 +807,7 @@ workflows:
- circleci_consistency - circleci_consistency
- python_lint - python_lint
- python_type_check - python_type_check
- docstring_parameters_sync
- clang_format - clang_format
- torchhub_test - torchhub_test
- torch_onnx_test - torch_onnx_test
......
...@@ -239,6 +239,7 @@ def loadRes(self, resFile): ...@@ -239,6 +239,7 @@ def loadRes(self, resFile):
""" """
Load result file and return a result api object. Load result file and return a result api object.
Args: Args:
self (obj): coco object with ground truth annotations
resFile (str): file name of result file resFile (str): file name of result file
Returns: Returns:
res (obj): result api object res (obj): result api object
......
...@@ -11,3 +11,6 @@ max-line-length = 120 ...@@ -11,3 +11,6 @@ max-line-length = 120
max-line-length = 120 max-line-length = 120
ignore = F401,E402,F403,W503,W504,F821 ignore = F401,E402,F403,W503,W504,F821
exclude = venv exclude = venv
[pydocstyle]
select = D417 # Missing argument descriptions in the docstring
...@@ -229,6 +229,7 @@ class VideoClips(object): ...@@ -229,6 +229,7 @@ class VideoClips(object):
Args: Args:
num_frames (int): number of frames for the clip num_frames (int): number of frames for the clip
step (int): distance between two clips step (int): distance between two clips
frame_rate (int, optional): The frame rate
""" """
self.num_frames = num_frames self.num_frames = num_frames
self.step = step self.step = step
......
...@@ -86,6 +86,7 @@ def encode_boxes(reference_boxes, proposals, weights): ...@@ -86,6 +86,7 @@ def encode_boxes(reference_boxes, proposals, weights):
Args: Args:
reference_boxes (Tensor): reference boxes reference_boxes (Tensor): reference boxes
proposals (Tensor): boxes to be encoded proposals (Tensor): boxes to be encoded
weights (Tensor[4]): the weights for ``(x, y, w, h)``
""" """
# perform some unpacking to make it JIT-fusion friendly # perform some unpacking to make it JIT-fusion friendly
......
...@@ -76,11 +76,18 @@ def resnet_fpn_backbone( ...@@ -76,11 +76,18 @@ def resnet_fpn_backbone(
Args: Args:
backbone_name (string): resnet architecture. Possible values are 'ResNet', 'resnet18', 'resnet34', 'resnet50', backbone_name (string): resnet architecture. Possible values are 'ResNet', 'resnet18', 'resnet34', 'resnet50',
'resnet101', 'resnet152', 'resnext50_32x4d', 'resnext101_32x8d', 'wide_resnet50_2', 'wide_resnet101_2' 'resnet101', 'resnet152', 'resnext50_32x4d', 'resnext101_32x8d', 'wide_resnet50_2', 'wide_resnet101_2'
pretrained (bool): If True, returns a model with backbone pre-trained on Imagenet
norm_layer (torchvision.ops): it is recommended to use the default value. For details visit: norm_layer (torchvision.ops): it is recommended to use the default value. For details visit:
(https://github.com/facebookresearch/maskrcnn-benchmark/issues/267) (https://github.com/facebookresearch/maskrcnn-benchmark/issues/267)
pretrained (bool): If True, returns a model with backbone pre-trained on Imagenet
trainable_layers (int): number of trainable (not frozen) resnet layers starting from final block. trainable_layers (int): number of trainable (not frozen) resnet layers starting from final block.
Valid values are between 0 and 5, with 5 meaning all backbone layers are trainable. Valid values are between 0 and 5, with 5 meaning all backbone layers are trainable.
returned_layers (list of int): The layers of the network to return. Each entry must be in ``[1, 4]``.
By default all layers are returned.
extra_blocks (ExtraFPNBlock or None): if provided, extra operations will
be performed. It is expected to take the fpn features, the original
features and the names of the original features as input, and returns
a new list of feature maps and their corresponding names. By
default a ``LastLevelMaxPool`` is used.
""" """
backbone = resnet.__dict__[backbone_name]( backbone = resnet.__dict__[backbone_name](
pretrained=pretrained, pretrained=pretrained,
......
...@@ -29,6 +29,7 @@ def googlenet(pretrained=False, progress=True, quantize=False, **kwargs): ...@@ -29,6 +29,7 @@ def googlenet(pretrained=False, progress=True, quantize=False, **kwargs):
Args: Args:
pretrained (bool): If True, returns a model pre-trained on ImageNet pretrained (bool): If True, returns a model pre-trained on ImageNet
progress (bool): If True, displays a progress bar of the download to stderr progress (bool): If True, displays a progress bar of the download to stderr
quantize (bool): If True, return a quantized version of the model
aux_logits (bool): If True, adds two auxiliary branches that can improve training. aux_logits (bool): If True, adds two auxiliary branches that can improve training.
Default: *False* when pretrained is True otherwise *True* Default: *False* when pretrained is True otherwise *True*
transform_input (bool): If True, preprocesses the input according to the method with which it transform_input (bool): If True, preprocesses the input according to the method with which it
......
...@@ -38,6 +38,7 @@ def inception_v3(pretrained=False, progress=True, quantize=False, **kwargs): ...@@ -38,6 +38,7 @@ def inception_v3(pretrained=False, progress=True, quantize=False, **kwargs):
Args: Args:
pretrained (bool): If True, returns a model pre-trained on ImageNet pretrained (bool): If True, returns a model pre-trained on ImageNet
progress (bool): If True, displays a progress bar of the download to stderr progress (bool): If True, displays a progress bar of the download to stderr
quantize (bool): If True, return a quantized version of the model
aux_logits (bool): If True, add an auxiliary branch that can improve training. aux_logits (bool): If True, add an auxiliary branch that can improve training.
Default: *True* Default: *True*
transform_input (bool): If True, preprocesses the input according to the method with which it transform_input (bool): If True, preprocesses the input according to the method with which it
......
...@@ -143,6 +143,7 @@ def resnet18(pretrained=False, progress=True, quantize=False, **kwargs): ...@@ -143,6 +143,7 @@ def resnet18(pretrained=False, progress=True, quantize=False, **kwargs):
Args: Args:
pretrained (bool): If True, returns a model pre-trained on ImageNet pretrained (bool): If True, returns a model pre-trained on ImageNet
progress (bool): If True, displays a progress bar of the download to stderr progress (bool): If True, displays a progress bar of the download to stderr
quantize (bool): If True, return a quantized version of the model
""" """
return _resnet('resnet18', QuantizableBasicBlock, [2, 2, 2, 2], pretrained, progress, return _resnet('resnet18', QuantizableBasicBlock, [2, 2, 2, 2], pretrained, progress,
quantize, **kwargs) quantize, **kwargs)
...@@ -155,6 +156,7 @@ def resnet50(pretrained=False, progress=True, quantize=False, **kwargs): ...@@ -155,6 +156,7 @@ def resnet50(pretrained=False, progress=True, quantize=False, **kwargs):
Args: Args:
pretrained (bool): If True, returns a model pre-trained on ImageNet pretrained (bool): If True, returns a model pre-trained on ImageNet
progress (bool): If True, displays a progress bar of the download to stderr progress (bool): If True, displays a progress bar of the download to stderr
quantize (bool): If True, return a quantized version of the model
""" """
return _resnet('resnet50', QuantizableBottleneck, [3, 4, 6, 3], pretrained, progress, return _resnet('resnet50', QuantizableBottleneck, [3, 4, 6, 3], pretrained, progress,
quantize, **kwargs) quantize, **kwargs)
...@@ -167,6 +169,7 @@ def resnext101_32x8d(pretrained=False, progress=True, quantize=False, **kwargs): ...@@ -167,6 +169,7 @@ def resnext101_32x8d(pretrained=False, progress=True, quantize=False, **kwargs):
Args: Args:
pretrained (bool): If True, returns a model pre-trained on ImageNet pretrained (bool): If True, returns a model pre-trained on ImageNet
progress (bool): If True, displays a progress bar of the download to stderr progress (bool): If True, displays a progress bar of the download to stderr
quantize (bool): If True, return a quantized version of the model
""" """
kwargs['groups'] = 32 kwargs['groups'] = 32
kwargs['width_per_group'] = 8 kwargs['width_per_group'] = 8
......
...@@ -107,6 +107,7 @@ def shufflenet_v2_x0_5(pretrained=False, progress=True, quantize=False, **kwargs ...@@ -107,6 +107,7 @@ def shufflenet_v2_x0_5(pretrained=False, progress=True, quantize=False, **kwargs
Args: Args:
pretrained (bool): If True, returns a model pre-trained on ImageNet pretrained (bool): If True, returns a model pre-trained on ImageNet
progress (bool): If True, displays a progress bar of the download to stderr progress (bool): If True, displays a progress bar of the download to stderr
quantize (bool): If True, return a quantized version of the model
""" """
return _shufflenetv2('shufflenetv2_x0.5', pretrained, progress, quantize, return _shufflenetv2('shufflenetv2_x0.5', pretrained, progress, quantize,
[4, 8, 4], [24, 48, 96, 192, 1024], **kwargs) [4, 8, 4], [24, 48, 96, 192, 1024], **kwargs)
...@@ -121,6 +122,7 @@ def shufflenet_v2_x1_0(pretrained=False, progress=True, quantize=False, **kwargs ...@@ -121,6 +122,7 @@ def shufflenet_v2_x1_0(pretrained=False, progress=True, quantize=False, **kwargs
Args: Args:
pretrained (bool): If True, returns a model pre-trained on ImageNet pretrained (bool): If True, returns a model pre-trained on ImageNet
progress (bool): If True, displays a progress bar of the download to stderr progress (bool): If True, displays a progress bar of the download to stderr
quantize (bool): If True, return a quantized version of the model
""" """
return _shufflenetv2('shufflenetv2_x1.0', pretrained, progress, quantize, return _shufflenetv2('shufflenetv2_x1.0', pretrained, progress, quantize,
[4, 8, 4], [24, 116, 232, 464, 1024], **kwargs) [4, 8, 4], [24, 116, 232, 464, 1024], **kwargs)
...@@ -135,6 +137,7 @@ def shufflenet_v2_x1_5(pretrained=False, progress=True, quantize=False, **kwargs ...@@ -135,6 +137,7 @@ def shufflenet_v2_x1_5(pretrained=False, progress=True, quantize=False, **kwargs
Args: Args:
pretrained (bool): If True, returns a model pre-trained on ImageNet pretrained (bool): If True, returns a model pre-trained on ImageNet
progress (bool): If True, displays a progress bar of the download to stderr progress (bool): If True, displays a progress bar of the download to stderr
quantize (bool): If True, return a quantized version of the model
""" """
return _shufflenetv2('shufflenetv2_x1.5', pretrained, progress, quantize, return _shufflenetv2('shufflenetv2_x1.5', pretrained, progress, quantize,
[4, 8, 4], [24, 176, 352, 704, 1024], **kwargs) [4, 8, 4], [24, 176, 352, 704, 1024], **kwargs)
...@@ -149,6 +152,7 @@ def shufflenet_v2_x2_0(pretrained=False, progress=True, quantize=False, **kwargs ...@@ -149,6 +152,7 @@ def shufflenet_v2_x2_0(pretrained=False, progress=True, quantize=False, **kwargs
Args: Args:
pretrained (bool): If True, returns a model pre-trained on ImageNet pretrained (bool): If True, returns a model pre-trained on ImageNet
progress (bool): If True, displays a progress bar of the download to stderr progress (bool): If True, displays a progress bar of the download to stderr
quantize (bool): If True, return a quantized version of the model
""" """
return _shufflenetv2('shufflenetv2_x2.0', pretrained, progress, quantize, return _shufflenetv2('shufflenetv2_x2.0', pretrained, progress, quantize,
[4, 8, 4], [24, 244, 488, 976, 2048], **kwargs) [4, 8, 4], [24, 244, 488, 976, 2048], **kwargs)
...@@ -152,8 +152,8 @@ def deeplabv3_resnet101(pretrained=False, progress=True, ...@@ -152,8 +152,8 @@ def deeplabv3_resnet101(pretrained=False, progress=True,
pretrained (bool): If True, returns a model pre-trained on COCO train2017 which pretrained (bool): If True, returns a model pre-trained on COCO train2017 which
contains the same classes as Pascal VOC contains the same classes as Pascal VOC
progress (bool): If True, displays a progress bar of the download to stderr progress (bool): If True, displays a progress bar of the download to stderr
num_classes (int): number of output classes of the model (including the background) num_classes (int): The number of classes
aux_loss (bool): If True, it uses an auxiliary loss aux_loss (bool): If True, include an auxiliary classifier
""" """
return _load_model('deeplabv3', 'resnet101', pretrained, progress, num_classes, aux_loss, **kwargs) return _load_model('deeplabv3', 'resnet101', pretrained, progress, num_classes, aux_loss, **kwargs)
......
...@@ -153,7 +153,7 @@ def draw_bounding_boxes( ...@@ -153,7 +153,7 @@ def draw_bounding_boxes(
Args: Args:
image (Tensor): Tensor of shape (C x H x W) image (Tensor): Tensor of shape (C x H x W)
bboxes (Tensor): Tensor of size (N, 4) containing bounding boxes in (xmin, ymin, xmax, ymax) format. Note that boxes (Tensor): Tensor of size (N, 4) containing bounding boxes in (xmin, ymin, xmax, ymax) format. Note that
the boxes are absolute coordinates with respect to the image. In other words: `0 <= xmin < xmax < W` and the boxes are absolute coordinates with respect to the image. In other words: `0 <= xmin < xmax < W` and
`0 <= ymin < ymax < H`. `0 <= ymin < ymax < H`.
labels (List[str]): List containing the labels of bounding boxes. labels (List[str]): List containing the labels of bounding boxes.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment