PVT
23 memberslucid.models.vision.pvtPVT — Pyramid Vision Transformer v2 (Wang et al., 2021/2022).
Wang, Wenhai, et al. "Pyramid Vision Transformer: A Versatile Backbone for Dense Prediction without Convolutions." Proceedings of the IEEE/CVF International Conference on Computer Vision, 2021, pp. 568-578.
The Pyramid Vision Transformer (PVT) introduces a hierarchical feature pyramid into a pure-transformer backbone so that it can serve as a drop-in replacement for ResNet-style backbones in dense prediction tasks such as detection and segmentation. Plain ViT produces a single-scale, low-resolution feature map and scales quadratically with the input resolution; PVT addresses both problems with two design changes.
First, the backbone has four stages, each beginning with a patch embedding convolution (overlapping in PVT v2, non-overlapping in v1) of stride , producing the canonical pyramid. Second, each transformer block uses Spatial-Reduction Attention (SRA): before computing keys and values, the token sequence is reshaped back to a 2-D feature map and downsampled by a stride- convolution, then flattened again. Concretely,
where decreases with depth (e.g. ). This cuts the per-stage attention cost from to , enabling high-resolution inputs at reasonable cost. Variants PVT-Tiny / Small / Medium / Large scale stage depths along this shared pyramidal-SRA design.
Classes
Functions
pvt_tiny→ PVTPVT-Tiny backbone — alias for pvt_v2_b1.
pvt_tiny_cls→ PVTForImageClassificationPVT-Tiny image classifier — alias for pvt_v2_b1_cls.
pvt_v2_b0→ PVTPVT v2-B0 backbone (Wang et al., 2022).
pvt_v2_b0_cls→ PVTForImageClassificationPVT v2-B0 image classifier (Wang et al., 2022).
pvt_v2_b1→ PVTPVT v2-B1 backbone (Wang et al., 2022).
pvt_v2_b1_cls→ PVTForImageClassificationPVT v2-B1 image classifier (Wang et al., 2022).
pvt_v2_b2→ PVTPVT v2-B2 backbone (Wang et al., 2022).
pvt_v2_b2_cls→ PVTForImageClassificationPVT v2-B2 image classifier (Wang et al., 2022).
pvt_v2_b3→ PVTPVT v2-B3 backbone (Wang et al., 2022).
pvt_v2_b3_cls→ PVTForImageClassificationPVT v2-B3 image classifier (Wang et al., 2022).
pvt_v2_b4→ PVTPVT v2-B4 backbone (Wang et al., 2022).
pvt_v2_b4_cls→ PVTForImageClassificationPVT v2-B4 image classifier (Wang et al., 2022).
pvt_v2_b5→ PVTPVT v2-B5 backbone (Wang et al., 2022).
pvt_v2_b5_cls→ PVTForImageClassificationPVT v2-B5 image classifier (Wang et al., 2022).
Weights
PVTv2B0WeightsPretrained weights for lucid.models.pvt_v2_b0_cls.
PVTv2B1WeightsPretrained weights for lucid.models.pvt_v2_b1_cls.
PVTv2B2WeightsPretrained weights for lucid.models.pvt_v2_b2_cls.
PVTv2B3WeightsPretrained weights for lucid.models.pvt_v2_b3_cls.
PVTv2B4WeightsPretrained weights for lucid.models.pvt_v2_b4_cls.
PVTv2B5WeightsPretrained weights for lucid.models.pvt_v2_b5_cls.