pypi torchvision 0.2.0
v0.2.0: New transforms + a new functional interface

latest releases: 0.18.0, 0.17.2, 0.17.1...
6 years ago

This version introduced a functional interface to the transforms, allowing for joint random transformation of inputs and targets. We also introduced a few breaking changes to some datasets and transforms (see below for more details).

Transforms

We have introduced a functional interface for the torchvision transforms, available under torchvision.transforms.functional. This now makes it possible to do joint random transformations on inputs and targets, which is especially useful in tasks like object detection, segmentation and super resolution. For example, you can now do the following:

from torchvision import transforms
import torchvision.transforms.functional as F
import random

def my_segmentation_transform(input, target):
	i, j, h, w = transforms.RandomCrop.get_params(input, (100, 100))
	input = F.crop(input, i, j, h, w)
	target = F.crop(target, i, j, h, w)
	if random.random() > 0.5:
		input = F.hflip(input)
		target = F.hflip(target)
	F.to_tensor(input), F.to_tensor(target)
	return input, target

The following transforms have also been added:

  • F.vflip and RandomVerticalFlip
  • FiveCrop and TenCrop
  • Various color transformations:
    • ColorJitter
    • F.adjust_brightness
    • F.adjust_contrast
    • F.adjust_saturation
    • F.adjust_hue
  • LinearTransformation for applications such as whitening
  • Grayscale and RandomGrayscale
  • Rotate and RandomRotation
  • ToPILImage now supports RGBA images
  • ToPILImage now accepts a mode argument so you can specify which colorspace the image should be
  • RandomResizedCrop now accepts scale and ratio ranges as input parameters

Documentation

Documentation is now auto generated and publishing to pytorch.org

Datasets:

SEMEION Dataset of handwritten digits added
Phototour dataset patches computed via multi-scale Harris corners now available by setting name equal to notredame_harris, yosemite_harris or liberty_harris in the Phototour dataset

Bug fixes:

  • Pre-trained densenet models is now CPU compatible #251

Breaking changes:

This version also introduced some breaking changes:

  • The SVHN dataset has now been made consistent with other datasets by making the label for the digit 0 be 0, instead of 10 (as it was previously) (see #194 for more details)
  • the labels for the unlabelled STL10 dataset is now an array filled with -1
  • the order of the input args to the deprecated Scale transform has changed from (width, height) to (height, width) to be consistent with other transforms

Don't miss a new torchvision release

NewReleases is sending notifications on new releases.