ops.rst 1.78 KB
Newer Older
1
2
.. _ops:

3
4
Operators
=========
5
6
7

.. currentmodule:: torchvision.ops

Aditya Oke's avatar
Aditya Oke committed
8
:mod:`torchvision.ops` implements operators, losses and layers that are specific for Computer Vision.
9
10

.. note::
11
  All operators have native support for TorchScript.
12

Aditya Oke's avatar
Aditya Oke committed
13
14
15
16
17
18

Detection and Segmentation Operators
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The below operators perform pre-processing as well as post-processing required in object detection and segmentation models.

19
20
21
.. autosummary::
    :toctree: generated/
    :template: function.rst
22

23
    batched_nms
Aditya Oke's avatar
Aditya Oke committed
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
    masks_to_boxes
    nms
    roi_align
    roi_pool
    ps_roi_align
    ps_roi_pool

.. autosummary::
    :toctree: generated/
    :template: class.rst

    FeaturePyramidNetwork
    MultiScaleRoIAlign
    RoIAlign
    RoIPool
    PSRoIAlign
    PSRoIPool


Box Operators
~~~~~~~~~~~~~

These utility functions perform various operations on bounding boxes.

.. autosummary::
    :toctree: generated/
    :template: function.rst

52
53
54
55
    box_area
    box_convert
    box_iou
    clip_boxes_to_image
Abhijit Deo's avatar
Abhijit Deo committed
56
    complete_box_iou
Yassine Alouini's avatar
Yassine Alouini committed
57
    distance_box_iou
Aditya Oke's avatar
Aditya Oke committed
58
    generalized_box_iou
59
    remove_small_boxes
Aditya Oke's avatar
Aditya Oke committed
60
61
62
63
64
65
66
67
68
69
70
71
72

Losses
~~~~~~

The following vision-specific loss functions are implemented:

.. autosummary::
    :toctree: generated/
    :template: function.rst

    complete_box_iou_loss
    distance_box_iou_loss
    generalized_box_iou_loss
73
    sigmoid_focal_loss
Aditya Oke's avatar
Aditya Oke committed
74
75
76
77
78
79


Layers
~~~~~~

TorchVision provides commonly used building blocks as layers:
80
81
82
83
84

.. autosummary::
    :toctree: generated/
    :template: class.rst

85
86
    Conv2dNormActivation
    Conv3dNormActivation
Aditya Oke's avatar
Aditya Oke committed
87
    DeformConv2d
88
89
    DropBlock2d
    DropBlock3d
90
    MLP
Aditya Oke's avatar
Aditya Oke committed
91
92
93
94
95
96
97
98
99
100
101
102
    FrozenBatchNorm2d
    SqueezeExcitation
    StochasticDepth

.. autosummary::
    :toctree: generated/
    :template: function.rst

    deform_conv2d
    drop_block2d
    drop_block3d
    stochastic_depth