当前位置: 首页>>代码示例 >>用法及示例精选 >>正文


Python PyTorch fasterrcnn_mobilenet_v3_large_320_fpn用法及代码示例


本文简要介绍python语言中 torchvision.models.detection.fasterrcnn_mobilenet_v3_large_320_fpn 的用法。

用法:

torchvision.models.detection.fasterrcnn_mobilenet_v3_large_320_fpn(pretrained=False, progress=True, num_classes=91, pretrained_backbone=True, trainable_backbone_layers=None, **kwargs)

参数

  • pretrained(bool) -如果为 True,则返回在 COCO train2017 上预训练的模型

  • progress(bool) -如果为 True,则显示下载到 stderr 的进度条

  • num_classes(int) -模型的输出类数(包括背景)

  • pretrained_backbone(bool) -如果为 True,则返回一个在 Imagenet 上预训练过主干的模型

  • trainable_backbone_layers(int) -从最终块开始的可训练(未冻结)resnet 层数。有效值介于 0 和 6 之间,其中 6 表示所有主干层都是可训练的。

使用针对移动 use-cases 调整的 MobileNetV3-Large FPN 主干网络构建低分辨率 Faster R-CNN 模型。它的工作原理与具有 ResNet-50 FPN 主干的 Faster R-CNN 类似。有关更多详细信息,请参阅fasterrcnn_resnet50_fpn()

例子:

>>> model = torchvision.models.detection.fasterrcnn_mobilenet_v3_large_320_fpn(pretrained=True)
>>> model.eval()
>>> x = [torch.rand(3, 300, 400), torch.rand(3, 500, 400)]
>>> predictions = model(x)

相关用法


注:本文由纯净天空筛选整理自pytorch.org大神的英文原创作品 torchvision.models.detection.fasterrcnn_mobilenet_v3_large_320_fpn。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。