sdkagent

vision API reference

186 public APIs from vision (pytorch/vision) — 109 classes, 62 functions, 15 methods. Signatures extracted by static analysis of the actual source.

Repository: pytorch/vision

KindCount
Classes109
Functions62
Methods15

API list

classreferences.classification.transforms.RandomCutMix
Randomly apply CutMix to the provided batch and targets.
classreferences.classification.transforms.RandomMixUp
Randomly apply MixUp to the provided batch and targets.
funcreferences.depth.stereo.train.shuffle_dataset(dataset)
Shuffle the dataset
funcreferences.depth.stereo.utils.losses.make_gaussian_kernel(kernel_size:int, sigma:float) -> torch.Tensor
Function to create a 2D Gaussian kernel.
classreferences.depth.stereo.utils.padder.InputPadder
Pads images such that dimensions are divisible by 8
classreferences.optical_flow.utils.InputPadder
Pads images such that dimensions are divisible by 8
classreferences.video_classification.transforms.ConvertBCHWtoCBHW
Convert tensor from (B, C, H, W) to (C, B, H, W)
classtorchvision.datasets._stereo_matching.StereoMatchingDataset
Base interface for Stereo matching datasets
classtorchvision.datasets.folder.DatasetFolder
A generic data loader.
functorchvision.datasets.folder.find_classes(directory:Union[str, Path]) -> tuple[list[str], dict[str, int]]
Finds the class folders in a dataset.
functorchvision.datasets.folder.has_file_allowed_extension(filename:str, extensions:Union[str, tuple[str, ...]]) -> bool
Checks if a file is an allowed extension.
functorchvision.datasets.folder.is_image_file(filename:str) -> bool
Checks if a file is an allowed image extension.
classtorchvision.datasets.lfw.LFWPairs
`LFW <http://vis-www.cs.umass.edu/lfw/>`_ Dataset.
classtorchvision.datasets.lfw.LFWPeople
`LFW <http://vis-www.cs.umass.edu/lfw/>`_ Dataset.
classtorchvision.datasets.lsun.LSUN
`LSUN <https://paperswithcode.com/dataset/lsun>`_ dataset.
classtorchvision.datasets.mnist.MNIST
`MNIST <http://yann.lecun.com/exdb/mnist/>`_ Dataset.
methodtorchvision.datasets.mnist.MNIST.download() -> None
Download the MNIST data if it doesn't exist already.
methodtorchvision.datasets.mnist.QMNIST.download() -> None
Download the QMNIST data if it doesn't exist already.
classtorchvision.datasets.pcam.PCAM
`PCAM Dataset <https://github.com/basveeling/pcam>`_.
functorchvision.datasets.phototour.PIL2array(_img:Image.Image) -> np.ndarray
Convert PIL image type to numpy 2D array
functorchvision.datasets.phototour.read_image_file(data_dir:str, image_ext:str, n:int) -> torch.Tensor
Return a Tensor containing the patches
classtorchvision.datasets.stl10.STL10
`STL10 <https://cs.stanford.edu/~acoates/stl10/>`_ Dataset.
classtorchvision.datasets.svhn.SVHN
`SVHN <http://ufldl.stanford.edu/housenumbers/>`_ Dataset.
classtorchvision.datasets.ucf101.UCF101
`UCF101 <https://www.crcv.ucf.edu/data/UCF101.php>`_ dataset.
functorchvision.datasets.utils.extract_archive(from_path:Union[str, pathlib.Path], to_path:Optional[Union[str, pathlib.Path]]=None, remove_finished:bool=False) -> Union[str, pathlib.Path]
Extract an archive.
classtorchvision.datasets.vision.VisionDataset
Base Class For making datasets which are compatible with torchvision.
classtorchvision.datasets.widerface.WIDERFace
`WIDERFace <http://shuoyang1213.me/WIDERFACE/>`_ Dataset.
classtorchvision.io.image.ImageReadMode
Allow automatic conversion to RGB, RGBA, etc while decoding.
functorchvision.io.image.decode_avif(input:torch.Tensor, mode:ImageReadMode=ImageReadMode.UNCHANGED) -> torch.Tensor
Decode an AVIF image into a 3 dimensional RGB[A] Tensor.
functorchvision.io.image.decode_gif(input:torch.Tensor) -> torch.Tensor
Decode a GIF image into a 3 or 4 dimensional RGB Tensor.
functorchvision.io.image.decode_heic(input:torch.Tensor, mode:ImageReadMode=ImageReadMode.UNCHANGED) -> torch.Tensor
Decode an HEIC image into a 3 dimensional RGB[A] Tensor.
functorchvision.io.image.decode_webp(input:torch.Tensor, mode:ImageReadMode=ImageReadMode.UNCHANGED) -> torch.Tensor
Decode a WEBP image into a 3 dimensional RGB[A] Tensor.
functorchvision.io.image.read_file(path:str) -> torch.Tensor
Return the bytes contents of a file as a uint8 1D Tensor.
functorchvision.io.image.write_file(filename:str, data:torch.Tensor) -> torch.Tensor
Write the content of an uint8 1D tensor to a file.
classtorchvision.models._api.WeightsEnum
This class is the parent class of all model weights.
functorchvision.models._api.get_model_builder(name:str) -> Callable[..., nn.Module]
Gets the model name and returns the model builder method.
functorchvision.models._api.get_model_weights(name:Union[Callable, str]) -> type[WeightsEnum]
Returns the weights enum class associated to the given model.
functorchvision.models._api.get_weight(name:str) -> WeightsEnum
Gets the weights enum value by its full name.
classtorchvision.models.detection._utils.BoxLinearCoder
The linear box-to-box transform defined in FCOS.
classtorchvision.models.detection.backbone_utils.BackboneWithFPN
Adds a FPN on top of a model.
classtorchvision.models.detection.faster_rcnn.FasterRCNN
Implements Faster R-CNN.
classtorchvision.models.detection.fcos.FCOS
Implements FCOS.
classtorchvision.models.detection.fcos.FCOSClassificationHead
A classification head for use in FCOS.
classtorchvision.models.detection.fcos.FCOSHead
A regression and classification head for use in FCOS.
classtorchvision.models.detection.generalized_rcnn.GeneralizedRCNN
Main class for Generalized R-CNN.
classtorchvision.models.detection.keypoint_rcnn.KeypointRCNN
Implements Keypoint R-CNN.
classtorchvision.models.detection.mask_rcnn.MaskRCNN
Implements Mask R-CNN.
classtorchvision.models.detection.retinanet.RetinaNet
Implements RetinaNet.
classtorchvision.models.detection.retinanet.RetinaNetClassificationHead
A classification head for use in RetinaNet.
classtorchvision.models.detection.retinanet.RetinaNetRegressionHead
A regression head for use in RetinaNet.
classtorchvision.models.detection.rpn.RegionProposalNetwork
Implements Region Proposal Network (RPN).
classtorchvision.models.feature_extraction.DualGraphModule
A derivative of `fx.GraphModule`.
classtorchvision.models.maxvit.MBConv
MBConv: Mobile Inverted Residual Bottleneck.
methodtorchvision.models.maxvit.MBConv.forward(x:Tensor) -> Tensor
Args: x (Tensor): Input tensor with expected layout of [B, C, H, W].
classtorchvision.models.maxvit.MaxVitBlock
A MaxVit block consisting of `n_layers` MaxVit layers.
methodtorchvision.models.maxvit.MaxVitBlock.forward(x:Tensor) -> Tensor
Args: x (Tensor): Input tensor of shape (B, C, H, W).
classtorchvision.models.maxvit.RelativePositionalMultiHeadAttention
Relative Positional Multi-Head Attention.
classtorchvision.models.maxvit.SwapAxes
Permute the axes of a tensor.
classtorchvision.models.maxvit.WindowPartition
Partition the input tensor into non-overlapping windows.
classtorchvision.models.mnasnet.MNASNet
MNASNet, as described in https://arxiv.org/abs/1807.11626.
classtorchvision.models.optical_flow.raft.ConvGRU
Convolutional Gru unit.
classtorchvision.models.optical_flow.raft.CorrBlock
The correlation block.
classtorchvision.models.optical_flow.raft.FlowHead
Flow head, part of the update block.
classtorchvision.models.optical_flow.raft.MotionEncoder
The motion encoder, part of the update block.
classtorchvision.models.optical_flow.raft.Raft_Large_Weights
The metrics reported here are as follows.
classtorchvision.models.optical_flow.raft.Raft_Small_Weights
The metrics reported here are as follows.
classtorchvision.models.optical_flow.raft.RecurrentBlock
Recurrent block, part of the update block.
classtorchvision.models.regnet.AnyStage
AnyNet stage (sequence of blocks w/ the same output shape).
classtorchvision.models.regnet.BottleneckTransform
Bottleneck transformation: 1x1, 3x3 [+SE], 1x1.
classtorchvision.models.regnet.SimpleStemIN
Simple stem for ImageNet: 3x3, BN, ReLU.
functorchvision.models.resnet.conv1x1(in_planes:int, out_planes:int, stride:int=1) -> nn.Conv2d
1x1 convolution
functorchvision.models.resnet.conv3x3(in_planes:int, out_planes:int, stride:int=1, groups:int=1, dilation:int=1) -> nn.Conv2d
3x3 convolution with padding
classtorchvision.models.swin_transformer.PatchMerging
Patch Merging Layer.
classtorchvision.models.swin_transformer.PatchMergingV2
Patch Merging Layer for Swin Transformer V2.
classtorchvision.models.swin_transformer.ShiftedWindowAttention
See :func:`shifted_window_attention`.
classtorchvision.models.swin_transformer.ShiftedWindowAttentionV2
See :func:`shifted_window_attention_v2`.
classtorchvision.models.swin_transformer.SwinTransformerBlock
Swin Transformer Block.
classtorchvision.models.swin_transformer.SwinTransformerBlockV2
Swin Transformer V2 Block.
classtorchvision.models.video.resnet.BasicStem
The default conv-batchnorm-relu stem
functorchvision.models.video.resnet.mc3_18(*weights:Optional[MC3_18_Weights]=None, *progress:bool=True, **kwargs:Any) -> VideoResNet
Construct 18 layer Mixed Convolution network as in ..
functorchvision.models.video.resnet.r2plus1d_18(*weights:Optional[R2Plus1D_18_Weights]=None, *progress:bool=True, **kwargs:Any) -> VideoResNet
Construct 18 layer deep R(2+1)D network as in ..
functorchvision.models.video.resnet.r3d_18(*weights:Optional[R3D_18_Weights]=None, *progress:bool=True, **kwargs:Any) -> VideoResNet
Construct 18 layer Resnet3D model.
classtorchvision.models.video.s3d.S3D
S3D main class.
functorchvision.models.video.s3d.s3d(*weights:Optional[S3D_Weights]=None, *progress:bool=True, **kwargs:Any) -> S3D
Construct Separable 3D CNN model.
classtorchvision.models.video.swin_transformer.PatchEmbed3d
Video to Patch Embedding.
methodtorchvision.models.video.swin_transformer.PatchEmbed3d.forward(x:Tensor) -> Tensor
Forward function.
classtorchvision.models.video.swin_transformer.ShiftedWindowAttention3d
See :func:`shifted_window_attention_3d`.
classtorchvision.models.vision_transformer.EncoderBlock
Transformer encoder block.
classtorchvision.models.vision_transformer.MLPBlock
Transformer MLP block.
functorchvision.ops.boxes.batched_nms(boxes:Tensor, scores:Tensor, idxs:Tensor, iou_threshold:float) -> Tensor
Performs non-maximum suppression in a batched fashion.
functorchvision.ops.boxes.box_area(boxes:Tensor, fmt:str='xyxy') -> Tensor
Computes the area of a set of bounding boxes from a given format.
functorchvision.ops.boxes.clip_boxes_to_image(boxes:Tensor, size:tuple[int, int]) -> Tensor
Clip boxes so that they lie inside an image of size ``size``.
functorchvision.ops.boxes.masks_to_boxes(masks:torch.Tensor) -> torch.Tensor
Compute the bounding boxes around the provided masks.
classtorchvision.ops.deform_conv.DeformConv2d
See :func:`deform_conv2d`.
classtorchvision.ops.drop_block.DropBlock2d
See :func:`drop_block2d`.
classtorchvision.ops.drop_block.DropBlock3d
See :func:`drop_block3d`.
classtorchvision.ops.feature_pyramid_network.ExtraFPNBlock
Base class for the extra block in the FPN.
classtorchvision.ops.misc.MLP
This block implements the multi-layer perceptron (MLP) module.
classtorchvision.ops.ps_roi_align.PSRoIAlign
See :func:`ps_roi_align`.
classtorchvision.ops.ps_roi_pool.PSRoIPool
See :func:`ps_roi_pool`.
classtorchvision.ops.roi_align.RoIAlign
See :func:`roi_align`.
classtorchvision.ops.roi_pool.RoIPool
See :func:`roi_pool`.
classtorchvision.ops.stochastic_depth.StochasticDepth
See :func:`stochastic_depth`.
methodtorchvision.transforms.autoaugment.AugMix.forward(orig_img:Tensor) -> Tensor
img (PIL Image or Tensor): Image to be transformed.
classtorchvision.transforms.autoaugment.AutoAugmentPolicy
AutoAugment policies learned on different datasets.
functorchvision.transforms.functional.adjust_brightness(img:Tensor, brightness_factor:float) -> Tensor
Adjust brightness of an image.
functorchvision.transforms.functional.adjust_contrast(img:Tensor, contrast_factor:float) -> Tensor
Adjust contrast of an image.
functorchvision.transforms.functional.adjust_gamma(img:Tensor, gamma:float, gain:float=1) -> Tensor
Perform gamma correction on an image.
functorchvision.transforms.functional.adjust_hue(img:Tensor, hue_factor:float) -> Tensor
Adjust hue of an image.
functorchvision.transforms.functional.adjust_saturation(img:Tensor, saturation_factor:float) -> Tensor
Adjust color saturation of an image.
functorchvision.transforms.functional.adjust_sharpness(img:Tensor, sharpness_factor:float) -> Tensor
Adjust the sharpness of an image.
functorchvision.transforms.functional.center_crop(img:Tensor, output_size:list[int]) -> Tensor
Crops the given image at the center.
functorchvision.transforms.functional.crop(img:Tensor, top:int, left:int, height:int, width:int) -> Tensor
Crop the given image at specified location and output size.
functorchvision.transforms.functional.erase(img:Tensor, i:int, j:int, h:int, w:int, v:Tensor, inplace:bool=False) -> Tensor
Erase the input Tensor Image with given value.
functorchvision.transforms.functional.get_dimensions(img:Tensor) -> list[int]
Returns the dimensions of an image as [channels, height, width].
functorchvision.transforms.functional.get_image_num_channels(img:Tensor) -> int
Returns the number of channels of an image.
functorchvision.transforms.functional.get_image_size(img:Tensor) -> list[int]
Returns the size of an image as [width, height].
functorchvision.transforms.functional.hflip(img:Tensor) -> Tensor
Horizontally flip the given image.
functorchvision.transforms.functional.invert(img:Tensor) -> Tensor
Invert the colors of an RGB/grayscale image.
functorchvision.transforms.functional.pil_to_tensor(pic:Any) -> Tensor
Convert a ``PIL Image`` to a tensor of the same type.
functorchvision.transforms.functional.rgb_to_grayscale(img:Tensor, num_output_channels:int=1) -> Tensor
Convert RGB image to grayscale version of image.
functorchvision.transforms.functional.rotate(img:Tensor, angle:float, interpolation:InterpolationMode=InterpolationMode.NEAREST, expand:bool=False, center:Optional[list[int]]=None, fill:Optional[list[float]]=None) -> Tensor
Rotate the image by angle.
functorchvision.transforms.functional.to_tensor(pic:Union[PILImage, np.ndarray]) -> Tensor
Convert a ``PIL Image`` or ``numpy.ndarray`` to tensor.
functorchvision.transforms.functional.vflip(img:Tensor) -> Tensor
Vertically flip the given image.
classtorchvision.transforms.transforms.CenterCrop
Crops the given image at the center.
classtorchvision.transforms.transforms.Compose
Composes several transforms together.
classtorchvision.transforms.transforms.ElasticTransform
Transform a tensor image with elastic transformations.
methodtorchvision.transforms.transforms.ElasticTransform.forward(tensor:Tensor) -> Tensor
Args: tensor (PIL Image or Tensor): Image to be transformed.
classtorchvision.transforms.transforms.GaussianBlur
Blurs image with randomly chosen Gaussian blur.
methodtorchvision.transforms.transforms.GaussianBlur.forward(img:Tensor) -> Tensor
Args: img (PIL Image or Tensor): image to be blurred.
methodtorchvision.transforms.transforms.GaussianBlur.get_params(sigma_min:float, sigma_max:float) -> float
Choose sigma for random gaussian blurring.
classtorchvision.transforms.transforms.Grayscale
Convert image to grayscale.
classtorchvision.transforms.transforms.Lambda
Apply a user-defined lambda as a transform.
classtorchvision.transforms.transforms.Normalize
Normalize a tensor image with mean and standard deviation.
methodtorchvision.transforms.transforms.Normalize.forward(tensor:Tensor) -> Tensor
Args: tensor (Tensor): Tensor image to be normalized.
classtorchvision.transforms.transforms.Pad
Pad the given image on all sides with the given "pad" value.
classtorchvision.transforms.transforms.RandomChoice
Apply single transformation randomly picked from a list.
classtorchvision.transforms.transforms.RandomCrop
Crop the given image at a random location.
methodtorchvision.transforms.transforms.RandomCrop.get_params(img:Tensor, output_size:tuple[int, int]) -> tuple[int, int, int, int]
Get parameters for ``crop`` for a random crop.
classtorchvision.transforms.transforms.RandomOrder
Apply a list of transformations in a random order.
classtorchvision.transforms.transforms.RandomRotation
Rotate the image by angle.
methodtorchvision.transforms.transforms.RandomRotation.get_params(degrees:list[float]) -> float
Get parameters for ``rotate`` for a random rotation.
classtorchvision.transforms.transforms.Resize
Resize the input image to the given size.
classtorchvision.transforms.v2._augment.CutMix
Apply CutMix to the provided batch of images and labels.
classtorchvision.transforms.v2._augment.MixUp
Apply MixUp to the provided batch of images and labels.
classtorchvision.transforms.v2._color.Grayscale
Convert images or videos to grayscale.
classtorchvision.transforms.v2._color.RandomChannelPermutation
Randomly permute the channels of an image or video
classtorchvision.transforms.v2._container.Compose
Composes several transforms together.
classtorchvision.transforms.v2._container.RandomChoice
Apply single transformation randomly picked from a list.
classtorchvision.transforms.v2._container.RandomOrder
Apply a list of transformations in a random order.
classtorchvision.transforms.v2._geometry.CenterCrop
Crop the input at the center.
classtorchvision.transforms.v2._geometry.ElasticTransform
Transform the input with elastic transformations.
classtorchvision.transforms.v2._geometry.Pad
Pad the input on all sides with the given "pad" value.
classtorchvision.transforms.v2._geometry.RandomCrop
Crop the input at a random location.
classtorchvision.transforms.v2._geometry.RandomHorizontalFlip
Horizontally flip the input with a given probability.
classtorchvision.transforms.v2._geometry.RandomResize
Randomly resize the input.
classtorchvision.transforms.v2._geometry.RandomRotation
Rotate the input by angle.
classtorchvision.transforms.v2._geometry.RandomShortestSize
Randomly resize the input.
classtorchvision.transforms.v2._geometry.RandomVerticalFlip
Vertically flip the input with a given probability.
classtorchvision.transforms.v2._geometry.Resize
Resize the input to the given size.
classtorchvision.transforms.v2._meta.ClampKeyPoints
Clamp keypoints to their corresponding image dimensions.
classtorchvision.transforms.v2._misc.GaussianBlur
Blurs image with randomly chosen Gaussian blur kernel.
classtorchvision.transforms.v2._misc.GaussianNoise
Add gaussian noise to images or videos.
classtorchvision.transforms.v2._misc.Lambda
Apply a user-defined function as a transform.
classtorchvision.transforms.v2._transform.Transform
Base class to implement your own v2 transforms.
methodtorchvision.transforms.v2._transform.Transform.forward(*inputs:Any) -> Any
Do not override this!
methodtorchvision.transforms.v2._transform.Transform.make_params(flat_inputs:list[Any]) -> dict[str, Any]
Method to override for custom transforms.
methodtorchvision.transforms.v2._transform.Transform.transform(inpt:Any, params:dict[str, Any]) -> Any
Method to override for custom transforms.
functorchvision.transforms.v2._utils.get_bounding_boxes(flat_inputs:list[Any]) -> tv_tensors.BoundingBoxes
Return the Bounding Boxes in the input.
functorchvision.transforms.v2._utils.get_keypoints(flat_inputs:list[Any]) -> tv_tensors.KeyPoints
Return the keypoints in the input.
functorchvision.transforms.v2._utils.query_chw(flat_inputs:list[Any]) -> tuple[int, int, int]
Return Channel, Height, and Width.
functorchvision.transforms.v2._utils.query_size(flat_inputs:list[Any]) -> tuple[int, int]
Return Height and Width.
functorchvision.transforms.v2.functional._augment.jpeg(image:torch.Tensor, quality:int) -> torch.Tensor
See :class:`~torchvision.transforms.v2.JPEG` for details.
functorchvision.transforms.v2.functional._color.adjust_brightness(inpt:torch.Tensor, brightness_factor:float) -> torch.Tensor
Adjust brightness.
functorchvision.transforms.v2.functional._color.adjust_gamma(inpt:torch.Tensor, gamma:float, gain:float=1) -> torch.Tensor
Adjust gamma.
functorchvision.transforms.v2.functional._color.adjust_hue(inpt:torch.Tensor, hue_factor:float) -> torch.Tensor
Adjust hue
functorchvision.transforms.v2.functional._color.adjust_saturation(inpt:torch.Tensor, saturation_factor:float) -> torch.Tensor
Adjust saturation.
functorchvision.transforms.v2.functional._color.grayscale_to_rgb(inpt:torch.Tensor) -> torch.Tensor
See :class:`~torchvision.transforms.v2.RGB` for details.
functorchvision.transforms.v2.functional._color.invert(inpt:torch.Tensor) -> torch.Tensor
See :func:`~torchvision.transforms.v2.RandomInvert`.
functorchvision.transforms.v2.functional._deprecated.to_tensor(inpt:Any) -> torch.Tensor
[DEPREACTED] Use to_image() and to_dtype() instead.
functorchvision.transforms.v2.functional._misc.convert_image_dtype(image:torch.Tensor, dtype:torch.dtype=torch.float32) -> torch.Tensor
[DEPRECATED] Use to_dtype() instead.
classtorchvision.tv_tensors._bounding_boxes.BoundingBoxFormat
Coordinate format of a bounding box.
classtorchvision.tv_tensors._tv_tensor.TVTensor
Base class for all TVTensors.
functorchvision.utils.flow_to_image(flow:torch.Tensor) -> torch.Tensor
Converts a flow to an RGB image.
functorchvision.utils.make_grid(tensor:Union[torch.Tensor, list[torch.Tensor]], nrow:int=8, padding:int=2, normalize:bool=False, value_range:Optional[tuple[int, int]]=None, scale_each:bool=False, pad_value:float=0.0) -> torch.Tensor
Make a grid of images.
functorchvision.utils.save_image(tensor:Union[torch.Tensor, list[torch.Tensor]], fp:Union[str, pathlib.Path, BinaryIO], format:Optional[str]=None, **kwargs) -> None
Save a given Tensor into an image file.

About this data

These signatures were extracted from the public source of pytorch/vision using Python's ast module. Argument names, default values, type annotations and return types are taken verbatim from the code. Implementation bodies are never stored. See how it works for details.

Back to all 805 libraries