vision の API リファレンス
vision (pytorch/vision) の公開 API 186 件 —— クラス 109、関数 62、メソッド 15。実際のソースを静的解析して抽出した正確なシグネチャを掲載しています。
リポジトリ: pytorch/vision
| 種別 | 件数 |
|---|---|
| クラス | 109 |
| 関数 | 62 |
| メソッド | 15 |
API 一覧
class
references.classification.transforms.RandomCutMixRandomly apply CutMix to the provided batch and targets.
class
references.classification.transforms.RandomMixUpRandomly apply MixUp to the provided batch and targets.
func
references.depth.stereo.train.shuffle_dataset(dataset)Shuffle the dataset
func
references.depth.stereo.utils.losses.make_gaussian_kernel(kernel_size:int, sigma:float) -> torch.TensorFunction to create a 2D Gaussian kernel.
class
references.depth.stereo.utils.padder.InputPadderPads images such that dimensions are divisible by 8
class
references.optical_flow.utils.InputPadderPads images such that dimensions are divisible by 8
class
references.video_classification.transforms.ConvertBCHWtoCBHWConvert tensor from (B, C, H, W) to (C, B, H, W)
class
torchvision.datasets._stereo_matching.StereoMatchingDatasetBase interface for Stereo matching datasets
class
torchvision.datasets.folder.DatasetFolderA generic data loader.
func
torchvision.datasets.folder.find_classes(directory:Union[str, Path]) -> tuple[list[str], dict[str, int]]Finds the class folders in a dataset.
func
torchvision.datasets.folder.has_file_allowed_extension(filename:str, extensions:Union[str, tuple[str, ...]]) -> boolChecks if a file is an allowed extension.
func
torchvision.datasets.folder.is_image_file(filename:str) -> boolChecks if a file is an allowed image extension.
class
torchvision.datasets.lfw.LFWPairs`LFW <http://vis-www.cs.umass.edu/lfw/>`_ Dataset.
class
torchvision.datasets.lfw.LFWPeople`LFW <http://vis-www.cs.umass.edu/lfw/>`_ Dataset.
class
torchvision.datasets.lsun.LSUN`LSUN <https://paperswithcode.com/dataset/lsun>`_ dataset.
class
torchvision.datasets.mnist.MNIST`MNIST <http://yann.lecun.com/exdb/mnist/>`_ Dataset.
method
torchvision.datasets.mnist.MNIST.download() -> NoneDownload the MNIST data if it doesn't exist already.
method
torchvision.datasets.mnist.QMNIST.download() -> NoneDownload the QMNIST data if it doesn't exist already.
class
torchvision.datasets.pcam.PCAM`PCAM Dataset <https://github.com/basveeling/pcam>`_.
func
torchvision.datasets.phototour.PIL2array(_img:Image.Image) -> np.ndarrayConvert PIL image type to numpy 2D array
func
torchvision.datasets.phototour.read_image_file(data_dir:str, image_ext:str, n:int) -> torch.TensorReturn a Tensor containing the patches
class
torchvision.datasets.stl10.STL10`STL10 <https://cs.stanford.edu/~acoates/stl10/>`_ Dataset.
class
torchvision.datasets.svhn.SVHN`SVHN <http://ufldl.stanford.edu/housenumbers/>`_ Dataset.
class
torchvision.datasets.ucf101.UCF101`UCF101 <https://www.crcv.ucf.edu/data/UCF101.php>`_ dataset.
func
torchvision.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.
class
torchvision.datasets.vision.VisionDatasetBase Class For making datasets which are compatible with torchvision.
class
torchvision.datasets.widerface.WIDERFace`WIDERFace <http://shuoyang1213.me/WIDERFACE/>`_ Dataset.
class
torchvision.io.image.ImageReadModeAllow automatic conversion to RGB, RGBA, etc while decoding.
func
torchvision.io.image.decode_avif(input:torch.Tensor, mode:ImageReadMode=ImageReadMode.UNCHANGED) -> torch.TensorDecode an AVIF image into a 3 dimensional RGB[A] Tensor.
func
torchvision.io.image.decode_gif(input:torch.Tensor) -> torch.TensorDecode a GIF image into a 3 or 4 dimensional RGB Tensor.
func
torchvision.io.image.decode_heic(input:torch.Tensor, mode:ImageReadMode=ImageReadMode.UNCHANGED) -> torch.TensorDecode an HEIC image into a 3 dimensional RGB[A] Tensor.
func
torchvision.io.image.decode_webp(input:torch.Tensor, mode:ImageReadMode=ImageReadMode.UNCHANGED) -> torch.TensorDecode a WEBP image into a 3 dimensional RGB[A] Tensor.
func
torchvision.io.image.read_file(path:str) -> torch.TensorReturn the bytes contents of a file as a uint8 1D Tensor.
func
torchvision.io.image.write_file(filename:str, data:torch.Tensor) -> torch.TensorWrite the content of an uint8 1D tensor to a file.
class
torchvision.models._api.WeightsEnumThis class is the parent class of all model weights.
func
torchvision.models._api.get_model_builder(name:str) -> Callable[..., nn.Module]Gets the model name and returns the model builder method.
func
torchvision.models._api.get_model_weights(name:Union[Callable, str]) -> type[WeightsEnum]Returns the weights enum class associated to the given model.
func
torchvision.models._api.get_weight(name:str) -> WeightsEnumGets the weights enum value by its full name.
class
torchvision.models.detection._utils.BoxLinearCoderThe linear box-to-box transform defined in FCOS.
class
torchvision.models.detection.backbone_utils.BackboneWithFPNAdds a FPN on top of a model.
class
torchvision.models.detection.faster_rcnn.FasterRCNNImplements Faster R-CNN.
class
torchvision.models.detection.fcos.FCOSImplements FCOS.
class
torchvision.models.detection.fcos.FCOSClassificationHeadA classification head for use in FCOS.
class
torchvision.models.detection.fcos.FCOSHeadA regression and classification head for use in FCOS.
class
torchvision.models.detection.generalized_rcnn.GeneralizedRCNNMain class for Generalized R-CNN.
class
torchvision.models.detection.keypoint_rcnn.KeypointRCNNImplements Keypoint R-CNN.
class
torchvision.models.detection.mask_rcnn.MaskRCNNImplements Mask R-CNN.
class
torchvision.models.detection.retinanet.RetinaNetImplements RetinaNet.
class
torchvision.models.detection.retinanet.RetinaNetClassificationHeadA classification head for use in RetinaNet.
class
torchvision.models.detection.retinanet.RetinaNetRegressionHeadA regression head for use in RetinaNet.
class
torchvision.models.detection.rpn.RegionProposalNetworkImplements Region Proposal Network (RPN).
class
torchvision.models.feature_extraction.DualGraphModuleA derivative of `fx.GraphModule`.
class
torchvision.models.maxvit.MBConvMBConv: Mobile Inverted Residual Bottleneck.
method
torchvision.models.maxvit.MBConv.forward(x:Tensor) -> TensorArgs: x (Tensor): Input tensor with expected layout of [B, C, H, W].
class
torchvision.models.maxvit.MaxVitBlockA MaxVit block consisting of `n_layers` MaxVit layers.
method
torchvision.models.maxvit.MaxVitBlock.forward(x:Tensor) -> TensorArgs: x (Tensor): Input tensor of shape (B, C, H, W).
class
torchvision.models.maxvit.RelativePositionalMultiHeadAttentionRelative Positional Multi-Head Attention.
class
torchvision.models.maxvit.SwapAxesPermute the axes of a tensor.
class
torchvision.models.maxvit.WindowPartitionPartition the input tensor into non-overlapping windows.
class
torchvision.models.mnasnet.MNASNetMNASNet, as described in https://arxiv.org/abs/1807.11626.
class
torchvision.models.optical_flow.raft.ConvGRUConvolutional Gru unit.
class
torchvision.models.optical_flow.raft.CorrBlockThe correlation block.
class
torchvision.models.optical_flow.raft.FlowHeadFlow head, part of the update block.
class
torchvision.models.optical_flow.raft.MotionEncoderThe motion encoder, part of the update block.
class
torchvision.models.optical_flow.raft.Raft_Large_WeightsThe metrics reported here are as follows.
class
torchvision.models.optical_flow.raft.Raft_Small_WeightsThe metrics reported here are as follows.
class
torchvision.models.optical_flow.raft.RecurrentBlockRecurrent block, part of the update block.
class
torchvision.models.regnet.AnyStageAnyNet stage (sequence of blocks w/ the same output shape).
class
torchvision.models.regnet.BottleneckTransformBottleneck transformation: 1x1, 3x3 [+SE], 1x1.
class
torchvision.models.regnet.SimpleStemINSimple stem for ImageNet: 3x3, BN, ReLU.
func
torchvision.models.resnet.conv1x1(in_planes:int, out_planes:int, stride:int=1) -> nn.Conv2d1x1 convolution
func
torchvision.models.resnet.conv3x3(in_planes:int, out_planes:int, stride:int=1, groups:int=1, dilation:int=1) -> nn.Conv2d3x3 convolution with padding
class
torchvision.models.swin_transformer.PatchMergingPatch Merging Layer.
class
torchvision.models.swin_transformer.PatchMergingV2Patch Merging Layer for Swin Transformer V2.
class
torchvision.models.swin_transformer.ShiftedWindowAttentionSee :func:`shifted_window_attention`.
class
torchvision.models.swin_transformer.ShiftedWindowAttentionV2See :func:`shifted_window_attention_v2`.
class
torchvision.models.swin_transformer.SwinTransformerBlockSwin Transformer Block.
class
torchvision.models.swin_transformer.SwinTransformerBlockV2Swin Transformer V2 Block.
class
torchvision.models.video.resnet.BasicStemThe default conv-batchnorm-relu stem
func
torchvision.models.video.resnet.mc3_18(*weights:Optional[MC3_18_Weights]=None, *progress:bool=True, **kwargs:Any) -> VideoResNetConstruct 18 layer Mixed Convolution network as in ..
func
torchvision.models.video.resnet.r2plus1d_18(*weights:Optional[R2Plus1D_18_Weights]=None, *progress:bool=True, **kwargs:Any) -> VideoResNetConstruct 18 layer deep R(2+1)D network as in ..
func
torchvision.models.video.resnet.r3d_18(*weights:Optional[R3D_18_Weights]=None, *progress:bool=True, **kwargs:Any) -> VideoResNetConstruct 18 layer Resnet3D model.
class
torchvision.models.video.s3d.S3DS3D main class.
func
torchvision.models.video.s3d.s3d(*weights:Optional[S3D_Weights]=None, *progress:bool=True, **kwargs:Any) -> S3DConstruct Separable 3D CNN model.
class
torchvision.models.video.swin_transformer.PatchEmbed3dVideo to Patch Embedding.
method
torchvision.models.video.swin_transformer.PatchEmbed3d.forward(x:Tensor) -> TensorForward function.
class
torchvision.models.video.swin_transformer.ShiftedWindowAttention3dSee :func:`shifted_window_attention_3d`.
class
torchvision.models.vision_transformer.EncoderBlockTransformer encoder block.
class
torchvision.models.vision_transformer.MLPBlockTransformer MLP block.
func
torchvision.ops.boxes.batched_nms(boxes:Tensor, scores:Tensor, idxs:Tensor, iou_threshold:float) -> TensorPerforms non-maximum suppression in a batched fashion.
func
torchvision.ops.boxes.box_area(boxes:Tensor, fmt:str='xyxy') -> TensorComputes the area of a set of bounding boxes from a given format.
func
torchvision.ops.boxes.clip_boxes_to_image(boxes:Tensor, size:tuple[int, int]) -> TensorClip boxes so that they lie inside an image of size ``size``.
func
torchvision.ops.boxes.masks_to_boxes(masks:torch.Tensor) -> torch.TensorCompute the bounding boxes around the provided masks.
class
torchvision.ops.deform_conv.DeformConv2dSee :func:`deform_conv2d`.
class
torchvision.ops.drop_block.DropBlock2dSee :func:`drop_block2d`.
class
torchvision.ops.drop_block.DropBlock3dSee :func:`drop_block3d`.
class
torchvision.ops.feature_pyramid_network.ExtraFPNBlockBase class for the extra block in the FPN.
class
torchvision.ops.misc.MLPThis block implements the multi-layer perceptron (MLP) module.
class
torchvision.ops.ps_roi_align.PSRoIAlignSee :func:`ps_roi_align`.
class
torchvision.ops.ps_roi_pool.PSRoIPoolSee :func:`ps_roi_pool`.
class
torchvision.ops.roi_align.RoIAlignSee :func:`roi_align`.
class
torchvision.ops.roi_pool.RoIPoolSee :func:`roi_pool`.
class
torchvision.ops.stochastic_depth.StochasticDepthSee :func:`stochastic_depth`.
method
torchvision.transforms.autoaugment.AugMix.forward(orig_img:Tensor) -> Tensorimg (PIL Image or Tensor): Image to be transformed.
class
torchvision.transforms.autoaugment.AutoAugmentPolicyAutoAugment policies learned on different datasets.
func
torchvision.transforms.functional.adjust_brightness(img:Tensor, brightness_factor:float) -> TensorAdjust brightness of an image.
func
torchvision.transforms.functional.adjust_contrast(img:Tensor, contrast_factor:float) -> TensorAdjust contrast of an image.
func
torchvision.transforms.functional.adjust_gamma(img:Tensor, gamma:float, gain:float=1) -> TensorPerform gamma correction on an image.
func
torchvision.transforms.functional.adjust_hue(img:Tensor, hue_factor:float) -> TensorAdjust hue of an image.
func
torchvision.transforms.functional.adjust_saturation(img:Tensor, saturation_factor:float) -> TensorAdjust color saturation of an image.
func
torchvision.transforms.functional.adjust_sharpness(img:Tensor, sharpness_factor:float) -> TensorAdjust the sharpness of an image.
func
torchvision.transforms.functional.center_crop(img:Tensor, output_size:list[int]) -> TensorCrops the given image at the center.
func
torchvision.transforms.functional.crop(img:Tensor, top:int, left:int, height:int, width:int) -> TensorCrop the given image at specified location and output size.
func
torchvision.transforms.functional.erase(img:Tensor, i:int, j:int, h:int, w:int, v:Tensor, inplace:bool=False) -> TensorErase the input Tensor Image with given value.
func
torchvision.transforms.functional.get_dimensions(img:Tensor) -> list[int]Returns the dimensions of an image as [channels, height, width].
func
torchvision.transforms.functional.get_image_num_channels(img:Tensor) -> intReturns the number of channels of an image.
func
torchvision.transforms.functional.get_image_size(img:Tensor) -> list[int]Returns the size of an image as [width, height].
func
torchvision.transforms.functional.hflip(img:Tensor) -> TensorHorizontally flip the given image.
func
torchvision.transforms.functional.invert(img:Tensor) -> TensorInvert the colors of an RGB/grayscale image.
func
torchvision.transforms.functional.pil_to_tensor(pic:Any) -> TensorConvert a ``PIL Image`` to a tensor of the same type.
func
torchvision.transforms.functional.rgb_to_grayscale(img:Tensor, num_output_channels:int=1) -> TensorConvert RGB image to grayscale version of image.
func
torchvision.transforms.functional.rotate(img:Tensor, angle:float, interpolation:InterpolationMode=InterpolationMode.NEAREST, expand:bool=False, center:Optional[list[int]]=None, fill:Optional[list[float]]=None) -> TensorRotate the image by angle.
func
torchvision.transforms.functional.to_tensor(pic:Union[PILImage, np.ndarray]) -> TensorConvert a ``PIL Image`` or ``numpy.ndarray`` to tensor.
func
torchvision.transforms.functional.vflip(img:Tensor) -> TensorVertically flip the given image.
class
torchvision.transforms.transforms.CenterCropCrops the given image at the center.
class
torchvision.transforms.transforms.ComposeComposes several transforms together.
class
torchvision.transforms.transforms.ElasticTransformTransform a tensor image with elastic transformations.
method
torchvision.transforms.transforms.ElasticTransform.forward(tensor:Tensor) -> TensorArgs: tensor (PIL Image or Tensor): Image to be transformed.
class
torchvision.transforms.transforms.GaussianBlurBlurs image with randomly chosen Gaussian blur.
method
torchvision.transforms.transforms.GaussianBlur.forward(img:Tensor) -> TensorArgs: img (PIL Image or Tensor): image to be blurred.
method
torchvision.transforms.transforms.GaussianBlur.get_params(sigma_min:float, sigma_max:float) -> floatChoose sigma for random gaussian blurring.
class
torchvision.transforms.transforms.GrayscaleConvert image to grayscale.
class
torchvision.transforms.transforms.LambdaApply a user-defined lambda as a transform.
class
torchvision.transforms.transforms.NormalizeNormalize a tensor image with mean and standard deviation.
method
torchvision.transforms.transforms.Normalize.forward(tensor:Tensor) -> TensorArgs: tensor (Tensor): Tensor image to be normalized.
class
torchvision.transforms.transforms.PadPad the given image on all sides with the given "pad" value.
class
torchvision.transforms.transforms.RandomChoiceApply single transformation randomly picked from a list.
class
torchvision.transforms.transforms.RandomCropCrop the given image at a random location.
method
torchvision.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.
class
torchvision.transforms.transforms.RandomOrderApply a list of transformations in a random order.
class
torchvision.transforms.transforms.RandomRotationRotate the image by angle.
method
torchvision.transforms.transforms.RandomRotation.get_params(degrees:list[float]) -> floatGet parameters for ``rotate`` for a random rotation.
class
torchvision.transforms.transforms.ResizeResize the input image to the given size.
class
torchvision.transforms.v2._augment.CutMixApply CutMix to the provided batch of images and labels.
class
torchvision.transforms.v2._augment.MixUpApply MixUp to the provided batch of images and labels.
class
torchvision.transforms.v2._color.GrayscaleConvert images or videos to grayscale.
class
torchvision.transforms.v2._color.RandomChannelPermutationRandomly permute the channels of an image or video
class
torchvision.transforms.v2._container.ComposeComposes several transforms together.
class
torchvision.transforms.v2._container.RandomChoiceApply single transformation randomly picked from a list.
class
torchvision.transforms.v2._container.RandomOrderApply a list of transformations in a random order.
class
torchvision.transforms.v2._geometry.CenterCropCrop the input at the center.
class
torchvision.transforms.v2._geometry.ElasticTransformTransform the input with elastic transformations.
class
torchvision.transforms.v2._geometry.PadPad the input on all sides with the given "pad" value.
class
torchvision.transforms.v2._geometry.RandomCropCrop the input at a random location.
class
torchvision.transforms.v2._geometry.RandomHorizontalFlipHorizontally flip the input with a given probability.
class
torchvision.transforms.v2._geometry.RandomResizeRandomly resize the input.
class
torchvision.transforms.v2._geometry.RandomRotationRotate the input by angle.
class
torchvision.transforms.v2._geometry.RandomShortestSizeRandomly resize the input.
class
torchvision.transforms.v2._geometry.RandomVerticalFlipVertically flip the input with a given probability.
class
torchvision.transforms.v2._geometry.ResizeResize the input to the given size.
class
torchvision.transforms.v2._meta.ClampKeyPointsClamp keypoints to their corresponding image dimensions.
class
torchvision.transforms.v2._misc.GaussianBlurBlurs image with randomly chosen Gaussian blur kernel.
class
torchvision.transforms.v2._misc.GaussianNoiseAdd gaussian noise to images or videos.
class
torchvision.transforms.v2._misc.LambdaApply a user-defined function as a transform.
class
torchvision.transforms.v2._transform.TransformBase class to implement your own v2 transforms.
method
torchvision.transforms.v2._transform.Transform.forward(*inputs:Any) -> AnyDo not override this!
method
torchvision.transforms.v2._transform.Transform.make_params(flat_inputs:list[Any]) -> dict[str, Any]Method to override for custom transforms.
method
torchvision.transforms.v2._transform.Transform.transform(inpt:Any, params:dict[str, Any]) -> AnyMethod to override for custom transforms.
func
torchvision.transforms.v2._utils.get_bounding_boxes(flat_inputs:list[Any]) -> tv_tensors.BoundingBoxesReturn the Bounding Boxes in the input.
func
torchvision.transforms.v2._utils.get_keypoints(flat_inputs:list[Any]) -> tv_tensors.KeyPointsReturn the keypoints in the input.
func
torchvision.transforms.v2._utils.query_chw(flat_inputs:list[Any]) -> tuple[int, int, int]Return Channel, Height, and Width.
func
torchvision.transforms.v2._utils.query_size(flat_inputs:list[Any]) -> tuple[int, int]Return Height and Width.
func
torchvision.transforms.v2.functional._augment.jpeg(image:torch.Tensor, quality:int) -> torch.TensorSee :class:`~torchvision.transforms.v2.JPEG` for details.
func
torchvision.transforms.v2.functional._color.adjust_brightness(inpt:torch.Tensor, brightness_factor:float) -> torch.TensorAdjust brightness.
func
torchvision.transforms.v2.functional._color.adjust_gamma(inpt:torch.Tensor, gamma:float, gain:float=1) -> torch.TensorAdjust gamma.
func
torchvision.transforms.v2.functional._color.adjust_hue(inpt:torch.Tensor, hue_factor:float) -> torch.TensorAdjust hue
func
torchvision.transforms.v2.functional._color.adjust_saturation(inpt:torch.Tensor, saturation_factor:float) -> torch.TensorAdjust saturation.
func
torchvision.transforms.v2.functional._color.grayscale_to_rgb(inpt:torch.Tensor) -> torch.TensorSee :class:`~torchvision.transforms.v2.RGB` for details.
func
torchvision.transforms.v2.functional._color.invert(inpt:torch.Tensor) -> torch.TensorSee :func:`~torchvision.transforms.v2.RandomInvert`.
func
torchvision.transforms.v2.functional._deprecated.to_tensor(inpt:Any) -> torch.Tensor[DEPREACTED] Use to_image() and to_dtype() instead.
func
torchvision.transforms.v2.functional._misc.convert_image_dtype(image:torch.Tensor, dtype:torch.dtype=torch.float32) -> torch.Tensor[DEPRECATED] Use to_dtype() instead.
class
torchvision.tv_tensors._bounding_boxes.BoundingBoxFormatCoordinate format of a bounding box.
class
torchvision.tv_tensors._tv_tensor.TVTensorBase class for all TVTensors.
func
torchvision.utils.flow_to_image(flow:torch.Tensor) -> torch.TensorConverts a flow to an RGB image.
func
torchvision.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.TensorMake a grid of images.
func
torchvision.utils.save_image(tensor:Union[torch.Tensor, list[torch.Tensor]], fp:Union[str, pathlib.Path, BinaryIO], format:Optional[str]=None, **kwargs) -> NoneSave a given Tensor into an image file.
この情報について
掲載しているシグネチャは pytorch/vision の公開ソースコードを
Python の ast モジュールで静的解析し、引数名・デフォルト値・
型注釈・戻り値型をそのまま抽出したものです。実装コードは保存していません。
詳しくは仕組みの解説をご覧ください。