Skip to content

Commit a2f6565

Browse files
ethanwhitedatumbox
andauthored
Default value docs for trainable_backbone_layers (#4913)
Closes #4905 Co-authored-by: Vasilis Vryniotis <[email protected]>
1 parent ed3e4a8 commit a2f6565

File tree

6 files changed

+16
-8
lines changed

6 files changed

+16
-8
lines changed

torchvision/models/detection/faster_rcnn.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,8 @@ def fasterrcnn_resnet50_fpn(
379379
num_classes (int): number of output classes of the model (including the background)
380380
pretrained_backbone (bool): If True, returns a model with backbone pre-trained on Imagenet
381381
trainable_backbone_layers (int): number of trainable (not frozen) resnet layers starting from final block.
382-
Valid values are between 0 and 5, with 5 meaning all backbone layers are trainable.
382+
Valid values are between 0 and 5, with 5 meaning all backbone layers are trainable. If ``None`` is
383+
passed (the default) this value is set to 3.
383384
"""
384385
trainable_backbone_layers = _validate_trainable_layers(
385386
pretrained or pretrained_backbone, trainable_backbone_layers, 5, 3
@@ -464,7 +465,8 @@ def fasterrcnn_mobilenet_v3_large_320_fpn(
464465
num_classes (int): number of output classes of the model (including the background)
465466
pretrained_backbone (bool): If True, returns a model with backbone pre-trained on Imagenet
466467
trainable_backbone_layers (int): number of trainable (not frozen) resnet layers starting from final block.
467-
Valid values are between 0 and 6, with 6 meaning all backbone layers are trainable.
468+
Valid values are between 0 and 6, with 6 meaning all backbone layers are trainable. If ``None`` is
469+
passed (the default) this value is set to 3.
468470
"""
469471
weights_name = "fasterrcnn_mobilenet_v3_large_320_fpn_coco"
470472
defaults = {
@@ -509,7 +511,8 @@ def fasterrcnn_mobilenet_v3_large_fpn(
509511
num_classes (int): number of output classes of the model (including the background)
510512
pretrained_backbone (bool): If True, returns a model with backbone pre-trained on Imagenet
511513
trainable_backbone_layers (int): number of trainable (not frozen) resnet layers starting from final block.
512-
Valid values are between 0 and 6, with 6 meaning all backbone layers are trainable.
514+
Valid values are between 0 and 6, with 6 meaning all backbone layers are trainable. If ``None`` is
515+
passed (the default) this value is set to 3.
513516
"""
514517
weights_name = "fasterrcnn_mobilenet_v3_large_fpn_coco"
515518
defaults = {

torchvision/models/detection/keypoint_rcnn.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,8 @@ def keypointrcnn_resnet50_fpn(
360360
num_keypoints (int): number of keypoints, default 17
361361
pretrained_backbone (bool): If True, returns a model with backbone pre-trained on Imagenet
362362
trainable_backbone_layers (int): number of trainable (not frozen) resnet layers starting from final block.
363-
Valid values are between 0 and 5, with 5 meaning all backbone layers are trainable.
363+
Valid values are between 0 and 5, with 5 meaning all backbone layers are trainable. If ``None`` is
364+
passed (the default) this value is set to 3.
364365
"""
365366
trainable_backbone_layers = _validate_trainable_layers(
366367
pretrained or pretrained_backbone, trainable_backbone_layers, 5, 3

torchvision/models/detection/mask_rcnn.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,8 @@ def maskrcnn_resnet50_fpn(
357357
num_classes (int): number of output classes of the model (including the background)
358358
pretrained_backbone (bool): If True, returns a model with backbone pre-trained on Imagenet
359359
trainable_backbone_layers (int): number of trainable (not frozen) resnet layers starting from final block.
360-
Valid values are between 0 and 5, with 5 meaning all backbone layers are trainable.
360+
Valid values are between 0 and 5, with 5 meaning all backbone layers are trainable. If ``None`` is
361+
passed (the default) this value is set to 3.
361362
"""
362363
trainable_backbone_layers = _validate_trainable_layers(
363364
pretrained or pretrained_backbone, trainable_backbone_layers, 5, 3

torchvision/models/detection/retinanet.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -623,7 +623,8 @@ def retinanet_resnet50_fpn(
623623
num_classes (int): number of output classes of the model (including the background)
624624
pretrained_backbone (bool): If True, returns a model with backbone pre-trained on Imagenet
625625
trainable_backbone_layers (int): number of trainable (not frozen) resnet layers starting from final block.
626-
Valid values are between 0 and 5, with 5 meaning all backbone layers are trainable.
626+
Valid values are between 0 and 5, with 5 meaning all backbone layers are trainable. If ``None`` is
627+
passed (the default) this value is set to 3.
627628
"""
628629
trainable_backbone_layers = _validate_trainable_layers(
629630
pretrained or pretrained_backbone, trainable_backbone_layers, 5, 3

torchvision/models/detection/ssd.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -587,7 +587,8 @@ def ssd300_vgg16(
587587
num_classes (int): number of output classes of the model (including the background)
588588
pretrained_backbone (bool): If True, returns a model with backbone pre-trained on Imagenet
589589
trainable_backbone_layers (int): number of trainable (not frozen) resnet layers starting from final block.
590-
Valid values are between 0 and 5, with 5 meaning all backbone layers are trainable.
590+
Valid values are between 0 and 5, with 5 meaning all backbone layers are trainable. If ``None`` is
591+
passed (the default) this value is set to 4.
591592
"""
592593
if "size" in kwargs:
593594
warnings.warn("The size of the model is already fixed; ignoring the argument.")

torchvision/models/detection/ssdlite.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,8 @@ def ssdlite320_mobilenet_v3_large(
208208
num_classes (int): number of output classes of the model (including the background)
209209
pretrained_backbone (bool): If True, returns a model with backbone pre-trained on Imagenet
210210
trainable_backbone_layers (int): number of trainable (not frozen) resnet layers starting from final block.
211-
Valid values are between 0 and 6, with 6 meaning all backbone layers are trainable.
211+
Valid values are between 0 and 6, with 6 meaning all backbone layers are trainable. If ``None`` is
212+
passed (the default) this value is set to 6.
212213
norm_layer (callable, optional): Module specifying the normalization layer to use.
213214
"""
214215
if "size" in kwargs:

0 commit comments

Comments
 (0)