Drop Python 2 support, several improvements and bugfixes
This release is the first one that officially drops support for Python 2.
It contains a number of improvements and bugfixes.
Highlights
Faster/Mask/Keypoint RCNN supports negative samples
It is now possible to feed training images to Faster / Mask / Keypoint R-CNN that do not contain any positive annotations.
This enables increasing the number of negative samples during training. For those images, the annotations expect a tensor with 0 in the number of objects dimension, as follows:
target = {"boxes": torch.zeros((0, 4), dtype=torch.float32),
"labels": torch.zeros(0, dtype=torch.int64),
"image_id": 4,
"area": torch.zeros(0, dtype=torch.float32),
"masks": torch.zeros((0, image_height, image_width), dtype=torch.uint8),
"keypoints": torch.zeros((17, 0, 3), dtype=torch.float32),
"iscrowd": torch.zeros((0,), dtype=torch.int64)}
Aligned flag for RoIAlign
RoIAlign
now supports the aligned flag, which aligns more precisely two neighboring pixel indices.
Refactored abstractions for C++ video decoder
This change is transparent to Python users, but the whole C++ backend for video reading (which needs torchvision to be compiled from source for it to be enabled for now) has been refactored into more modular abstractions.
The core abstractions are in https://github.com/pytorch/vision/tree/master/torchvision/csrc/cpu/decoder, and the video reader functions exposed to Python, by leveraging those abstractions, can be written in a much more concise way
Backwards Incompatible Changes
- Dropping Python2 support (#1761, #1792, #1984, #1976, #2037, #2033, #2017)
- [Models] Fix inception quantized pre-trained model (#1954, #1969, #1975)
- ONNX support for Mask R-CNN and Keypoint R-CNN has been temporarily dropped, but will be fixed in next releases
New Features
- [Transforms] Add Perspective fill option (#1973)
- [Ops]
aligned
flag in ROIAlign (#1908) - [IO] Update video reader to use new decoder (#1978)
- [IO] torchscriptable functions for video io (#1653, #1794)
- [Models] Support negative samples in Faster R-CNN, Mask R-CNN and Keypoint R-CNN (#1911, #2069)
Improvements
Datasets
- STL10: don't check integrity twice when download=True (#1787)
- Improve code readability and docstring of video datasets(#2020)
- [DOC] Fixed typo in Cityscapes docs (#1851)
Transforms
- Allow passing list to the input argument 'scale' of RandomResizedCrop (#1997) (#2008)
- F.normalize unsqueeze mean & std only for 1-d arrays (#2002)
- Improved error messages for transforms.functional.normalize(). (#1915)
- generalize number of bands calculation in to_tensor (#1781)
- Replace 2 transpose ops with 1 permute in ToTensor(#2018)
- Fixed Pillow version check for Pillow >= 10 (#2039)
- [DOC]: Improve transforms.Normalize docs (#1784, #1858)
- [DOC] Fixed missing new line in transforms.Crop docstring (#1922)
Ops
- Check boxes shape in RoIPool / Align (#1968)
- [ONNX] Export new_empty_tensor (#1733)
- Fix Tensor::data<> deprecation. (#2028)
- Fix deprecation warnings (#2055)
Models
- Add warning and note docs for scipy (#1842) (#1966)
- Added repr attribute to GeneralizedRCNNTransform (#1834)
- Replace mean on dimensions 2,3 by adaptive_avg_pooling2d in mobilenet (#1838)
- Add init_weights keyword argument to Inception3 (#1832)
- Add device to torch.tensor. (#1979)
- ONNX export for variable input sizes in Faster R-CNN (#1840)
- [JIT] Cleanup torchscript constant annotations (#1721, #1923, #1907, #1727)
- [JIT] use // now that it is supported (#1658)
- [JIT] add @torch.jit.script to ImageList (#1919)
- [DOC] Improved docs for Faster R-CNN (#1886, #1868, #1768, #1763)
- [DOC] add comments for the modified implementation of ResNet (#1983)
- [DOC] Add comments to AnchorGenerator (#1941)
- [DOC] Add comment in GoogleNet (#1932)
Documentation
- Document int8 quantization model (#1951)
- Update Doc with ONNX support (#1752)
- Update README to reflect strict dependency on torch==1.4.0 (#1767)
- Update sphinx theme (#2031)
- Document origin of preprocessing mean / std (#1965)
- Fix docstring formatting issues (#2049)
Reference scripts
- Add return statement in evaluate function of detection reference script (#2029)
- [DOC]Add default training parameters to classification reference README (#1998)
- [DOC] Add README to references/segmentation (#1864)
Tests
- Improve stability of test_nms_cuda (#2044)
- [ONNX] Disable model tests since export of interpolate script module is broken (#1989)
- Skip inception v3 in test/test_quantized_models (#1885)
- [LINT] Small indentation fix (#1831)
Misc
- Remove unintentional -O0 option in setup.py (#1770)
- Create CODE_OF_CONDUCT.md
- Update issue templates (#1913, #1914)
- master version bump 0.5 → 0.6
- replace torch 1.5.0 items flagged with deprecation warnings (fix #1906) (#1918)
- CUDA_SUFFIX → PYTORCH_VERSION_SUFFIX
CI
- Remove av from the binary requirements (#2006)
- ci: Add cu102 to CI and packaging, remove cu100 (#1980)
- .circleci: Switch to use token for conda uploads (#1960)
- Improvements to CI infra (#2051, #2032, #2046, #1735, #2048, #1789, #1731, #1961)
- typing only needed for python 3.5 and previous (#1778)
- Move C++ and Python linter to CircleCI (#2056, #2057)
Bug Fixes
Datasets
- bug fix on downloading voc2007 test dataset (#1991)
- fix lsun docstring example (#1935)
- Fixes EMNIST classes attribute is wrong #1716 (#1736)
- Force object annotation to be a list in VOC (#1790)
Models
- Fix for AnchorGenerator when device switch happen (#1745)
- [JIT] fix len error (#1981)
- [JIT] fix googlenet no aux logits (#1949)
- [JIT] Fix quantized googlenet (#1974)
Transforms
Ops
- Fix bug in DeformConv2d for batch sizes > 32 (#2027, #2040)
- Fix for roi_align ONNX export (#1988)
- Fix torchscript issue in ConvTranspose2d (#1917)
- Fix interpolate when no scale_factor is passed (#1785)
- Fix Windows build by renaming Python init functions (#1779)
- fix for loading models with num_batches_tracked in frozen bn (#1728)
Deprecations
- the pts_unit of pts from read_video and read_video_timestamp is deprecated, and will be replaced in next releases with seconds.