fasterrcnn_resnet50_fpn_v2¶
- torchvision.models.detection.fasterrcnn_resnet50_fpn_v2(*, weights: Optional[FasterRCNN_ResNet50_FPN_V2_Weights] = None, progress: bool = True, num_classes: Optional[int] = None, weights_backbone: Optional[ResNet50_Weights] = None, trainable_backbone_layers: Optional[int] = None, **kwargs: Any) FasterRCNN [源代码]¶
构建了一个改进版的 Faster R-CNN 模型,具有 ResNet-50-FPN 主干,来自 Benchmarking Detection Transfer Learning with Vision Transformers 论文。
警告
检测模块处于 Beta 阶段,不保证向后兼容。
它的工作方式与带有 ResNet-50 FPN 主干的 Faster R-CNN 类似。有关更多详细信息,请参阅
fasterrcnn_resnet50_fpn()
。- 参数:
weights (
FasterRCNN_ResNet50_FPN_V2_Weights
, 可选) – 要使用的预训练权重。有关更多详细信息和可能的值,请参阅下面的FasterRCNN_ResNet50_FPN_V2_Weights
。默认情况下,不使用预训练权重。progress (bool, 可选) – 如果为 True,则在 stderr 上显示下载进度条。默认为 True。
num_classes (int, 可选) – 模型的输出类别数(包括背景)
weights_backbone (
ResNet50_Weights
, 可选) – 主干的预训练权重。trainable_backbone_layers (int, 可选) – 可训练(未冻结)的层数,从最后一个块开始。有效值为 0 到 5,5 表示所有主干层都可训练。如果传入
None
(默认值),则此值设置为 3。**kwargs – 传递给
torchvision.models.detection.faster_rcnn.FasterRCNN
基类的参数。有关此类更多详细信息,请参阅 源代码。
- class torchvision.models.detection.FasterRCNN_ResNet50_FPN_V2_Weights(value)[源代码]¶
上面的模型构建器接受以下值作为
weights
参数。FasterRCNN_ResNet50_FPN_V2_Weights.DEFAULT
等同于FasterRCNN_ResNet50_FPN_V2_Weights.COCO_V1
。您也可以使用字符串,例如weights='DEFAULT'
或weights='COCO_V1'
。FasterRCNN_ResNet50_FPN_V2_Weights.COCO_V1:
这些权重是通过增强的训练配方产生的,以提高模型精度。也可用作
FasterRCNN_ResNet50_FPN_V2_Weights.DEFAULT
。box_map (在 COCO-val2017 上)
46.7
类别
__background__, person, bicycle, … (省略 88 个)
min_size
height=1, width=1
参数数量
43712278
方案
GFLOPS
280.37
文件大小
167.1 MB
推理变换可在
FasterRCNN_ResNet50_FPN_V2_Weights.COCO_V1.transforms
中找到,并执行以下预处理操作:接受PIL.Image
、批处理的(B, C, H, W)
和单个(C, H, W)
图像torch.Tensor
对象。图像将被缩放到[0.0, 1.0]
。