Torchvision

Latest version: v0.20.1

Safety actively analyzes 688087 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 18 of 23

0.15.2

This is a minor release, which is compatible with [PyTorch 2.0.1](https://github.com/pytorch/pytorch/releases/tag/v2.0.1) and contains some minor bug fixes.

Highlights

Bug Fixes
- Move parameter sampling of v2.RandomPhotometricDistort into _get_params https://github.com/pytorch/vision/pull/7442
- Fix split parameter for MovingMNIST https://github.com/pytorch/vision/pull/7449
- Prevent unwrapping in v2.SanitizeBoundingBoxes https://github.com/pytorch/vision/pull/7446

0.15.1

Highlights
[[BETA](https://pytorch.org/blog/pytorch-feature-classification-changes/#beta)] New transforms API
TorchVision is extending its Transforms API! Here is what’s new:
- You can use them not only for Image Classification but also for Object Detection, Instance & Semantic Segmentation and Video Classification.
- You can use new functional transforms for transforming Videos, Bounding Boxes and Segmentation Masks.

The API is **completely backward compatible** with the previous one, and remains the same to assist the migration and adoption. We are now releasing this new API as Beta in the `torchvision.transforms.v2` namespace, and we would love to get early feedback from you to improve its functionality. Please [reach out to us](https://github.com/pytorch/vision/issues/6753) if you have any questions or suggestions.

py
import torchvision.transforms.v2 as transforms

Exactly the same interface as V1:
trans = transforms.Compose([
transforms.ColorJitter(contrast=0.5),
transforms.RandomRotation(30),
transforms.CenterCrop(480),
])
imgs, bboxes, masks, labels = trans(imgs, bboxes, masks, labels)


You can read more about these new transforms in our [docs](https://pytorch.org/vision/main/transforms.html), and you can also check out our examples:

- [End-to-end object detection example
](https://pytorch.org/vision/stable/auto_examples/plot_transforms_v2_e2e.html#sphx-glr-auto-examples-plot-transforms-v2-e2e-py)
- [Getting started with transforms v2
](https://pytorch.org/vision/stable/auto_examples/plot_transforms_v2.html#sphx-glr-auto-examples-plot-transforms-v2-py)

Note that this API is still Beta. **While we do not expect major breaking changes, some APIs may still change according to user feedback**. Please submit any feedback you may have in https://github.com/pytorch/vision/issues/6753, and you can also check out https://github.com/pytorch/vision/issues/7319 to learn more about the APIs that we suspect might involve future changes.

[[BETA](https://pytorch.org/blog/pytorch-feature-classification-changes/#beta)] New Video Swin Transformer

We added a Video SwinTransformer model is based on the [Video Swin Transformer](https://arxiv.org/abs/2106.13230) paper.

py
import torch
from torchvision.models.video import swin3d_t

video = torch.rand(1, 3, 32, 800, 600)
or swin3d_b, swin3d_s
model = swin3d_t(weights="DEFAULT")
model.eval()
with torch.inference_mode():
prediction = model(video)
print(prediction)


The model has the following accuracies on the Kinetics-400 dataset:

| Model | Acc1 | Acc5 |
| --- | ----------- | --------- |

0.14.1

This is a minor release, which is compatible with [PyTorch 1.13.1](https://github.com/pytorch/pytorch/releases/tag/v1.13.1). There are no new features added.

0.14.0

**Highlights**


[[BETA](https://pytorch.org/blog/pytorch-feature-classification-changes/#beta)] New Model Registration API

Following up on the [multi-weight support API](https://pytorch.org/blog/introducing-torchvision-new-multi-weight-support-api/) that was released on the previous version, we have added a new [model registration API](https://pytorch.org/blog/easily-list-and-initialize-models-with-new-apis-in-torchvision/) to help users retrieve models and weights. There are now 4 new methods under the `torchvision.models` module: `get_model`, `get_model_weights`, `get_weight`, and `list_models`. Here are examples of how we can use them:


python
import torchvision
from torchvision.models import get_model, get_model_weights, list_models


max_params = 5000000

tiny_models = []
for model_name in list_models(module=torchvision.models):
weights_enum = get_model_weights(model_name)
if len([w for w in weights_enum if w.meta["num_params"] <= max_params]) > 0:
tiny_models.append(model_name)

print(tiny_models)
['mnasnet0_5', 'mnasnet0_75', 'mnasnet1_0', 'mobilenet_v2', ...]

model = get_model(tiny_models[0], weights="DEFAULT")
print(sum(x.numel() for x in model.state_dict().values()))
2239188



As of now, this API is still [beta](https://pytorch.org/blog/pytorch-feature-classification-changes/#beta) and there might be changes in the future in order to improve its usability based on your [feedback](https://github.com/pytorch/vision/issues/6365).


New Architecture and Model Variants


Classification Models

We’ve added the Swin Transformer V2 architecture along with pre-trained weights for its tiny/small/base variants. In addition, we have added support for the MaxViT transformer. Here is an example on how to use the models:


python
import torch
from torchvision.models import *

image = torch.rand(1, 3, 224, 224)
model = swin_v2_t(weights="DEFAULT").eval()
model = maxvit_t(weights="DEFAULT").eval()
prediction = model(image)



Here is the table showing the accuracy of the models tested on ImageNet1K dataset.


<table>
<tr>
<td><strong>Model</strong>
</td>
<td><strong>Acc1</strong>
</td>
<td><strong>Acc1</strong>
<p>
<strong>change over V1</strong>
</td>
<td><strong>Acc5</strong>
</td>
<td><strong>Acc5</strong>
<p>
<strong>change over V1</strong>
</td>
</tr>
<tr>
<td>swin_v2_t
</td>
<td><p style="text-align: right">

0.13.1

This minor release bumps the pinned PyTorch version to v1.12.1 and contains some minor bug fixes.

Highlights

Bug Fixes
- Small Patch SwinTransformer for FX compatibility https://github.com/pytorch/vision/pull/6252
- Indicate strings can be used to specify weights parameter https://github.com/pytorch/vision/pull/6314
- Fix d/c IoU for different batch sizes https://github.com/pytorch/vision/pull/6338

0.13

py
from torchvision.models import *

Page 18 of 23

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.