torchvision¶
该库是 PyTorch 项目的一部分。PyTorch 是一个开源的机器学习框架。
本文档中描述的功能按发布状态进行分类:
Stable: These features will be maintained long-term and there should generally be no major performance limitations or gaps in documentation. We also expect to maintain backwards compatibility (although breaking changes can happen and notice will be given one release ahead of time).
Beta: Features are tagged as Beta because the API may change based on user feedback, because the performance needs to improve, or because coverage across operators is not yet complete. For Beta features, we are committing to seeing the feature through to the Stable classification. We are not, however, committing to backwards compatibility.
Prototype: These features are typically not available as part of binary distributions like PyPI or Conda, except sometimes behind run-time flags, and are at an early stage for feedback and testing.
The torchvision 包含了流行的计算机视觉数据集、模型架构和常用图像变换。
包参考
- 图像转换和增强
- 模型和预训练权重
- 数据集
- 工具
- 操作符
- batched_nms
- box_area
- box_convert
- box_iou
- clip_boxes_to_image
- deform_conv2d
- generalized_box_iou
- generalized_box_iou_loss
- masks_to_boxes
- 非极大值抑制
- ps_roi_align
- ps_roi_pool
- remove_small_boxes
- roi_align
- roi_pool
- sigmoid_focal_loss
- stochastic_depth
- RoIAlign
- PSRoIAlign
- RoIPool
- PSRoIPool
- DeformConv2d
- MultiScaleRoIAlign
- FeaturePyramidNetwork
- StochasticDepth
- FrozenBatchNorm2d
- SqueezeExcitation
- 读取/写入图像和视频
- 用于模型检查的特征提取
-
torchvision.get_video_backend()[source]¶ 返回当前用于解码视频的活动视频后端。
- Returns
视频后端的名称。可以是 {‘pyav’, ‘video_reader’} 中的一个。
- Return type
-
torchvision.set_image_backend(backend)[source]¶ 指定用于加载图像的软件包。
- Parameters
后端 (字符串) – 图像后端的名称。可选 {‘PIL’, ‘accimage’}.
accimage包使用了 Intel IPP 库。它通常比 PIL 更快,但不支持那么多操作。
-
torchvision.set_video_backend(backend)[source]¶ 指定用于解码视频的软件包。
- Parameters
后端 (字符串) – 视频后端的名称。可选值为 {‘pyav’, ‘video_reader’}.
pyav包使用第三方 PyAv 库。它是 FFmpeg 库的 Pythonic 绑定。video_reader包在 FFMPEG 库之上包含一个本地 C++ 实现,以及 TorchScript 自定义操作符的 Python API。 它通常比pyav解码得更快,但可能不够健壮。
注意
在最新的 main 中,默认情况下禁用使用 FFMPEG 构建。如果要使用 'video_reader' 后端,请从源代码编译 torchvision。