Skip to content
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
fcb22e9
Remove Kinetics400 class
NicolasHug Jul 11, 2022
37a437d
Remove '2007-test' in VOC
NicolasHug Jul 11, 2022
57915a5
Remove some MobileNet layer classes
NicolasHug Jul 11, 2022
54abb31
Remove torchvision/models/segmentation/segmentation.py
NicolasHug Jul 11, 2022
4796dca
Remove some MultiScaleRoIAlign methods
NicolasHug Jul 11, 2022
9e4d225
Remove torchvision/transforms/_functional_video.py
NicolasHug Jul 11, 2022
5498794
Remove torchvision/transforms/_transforms_video.py
NicolasHug Jul 11, 2022
d641a69
Remove resample parameter in transforms
NicolasHug Jul 11, 2022
8bd7e73
Remove 'range' parameter
NicolasHug Jul 11, 2022
c87f0a0
Remove 'fill_value' parameter in transforms
NicolasHug Jul 11, 2022
f3c8f09
Revert to original warning for C++ models - looks like we should stil…
NicolasHug Jul 11, 2022
28964a2
pre-commit
NicolasHug Jul 11, 2022
98e912a
Fix docs
NicolasHug Jul 12, 2022
12dddf9
Remove test/test_transforms_video.py
NicolasHug Jul 12, 2022
96dde42
Some fixes
NicolasHug Jul 12, 2022
e06f5a8
Remove more tests
NicolasHug Jul 12, 2022
c026efc
Merge branch 'main' into remove_deprecated_0_14
NicolasHug Jul 13, 2022
63b1ea7
Revert changes to C++ models
NicolasHug Jul 28, 2022
0b6bcdb
Merge branch 'main' of github.com:pytorch/vision into remove_deprecat…
NicolasHug Jul 28, 2022
de51d9f
Merge branch 'remove_deprecated_0_14' of github.com:NicolasHug/vision…
NicolasHug Jul 28, 2022
2f8d6f4
Merge branch 'main' into remove_deprecated_0_14
YosuaMichael Sep 22, 2022
137d1b9
Add back _transforms_video and change warning message
YosuaMichael Sep 22, 2022
3c4ba46
Change back the warning message, and will change the warning message …
YosuaMichael Sep 22, 2022
12a8b24
Merge branch 'main' into remove_deprecated_0_14
YosuaMichael Sep 26, 2022
4963a07
Merge branch 'main' into remove_deprecated_0_14
YosuaMichael Sep 28, 2022
6a09988
Merge branch 'main' into remove_deprecated_0_14
YosuaMichael Sep 28, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 1 addition & 25 deletions test/test_datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -616,15 +616,10 @@ class VOCSegmentationTestCase(datasets_utils.ImageDatasetTestCase):
year=[f"20{year:02d}" for year in range(7, 13)], image_set=("train", "val", "trainval")
),
dict(year="2007", image_set="test"),
dict(year="2007-test", image_set="test"),
)

def inject_fake_data(self, tmpdir, config):
year, is_test_set = (
("2007", True)
if config["year"] == "2007-test" or config["image_set"] == "test"
else (config["year"], False)
)
year, is_test_set = config["year"], config["image_set"] == "test"
image_set = config["image_set"]

base_dir = pathlib.Path(tmpdir)
Expand Down Expand Up @@ -965,25 +960,6 @@ def inject_fake_data(self, tmpdir, config):
return num_videos_per_class * len(classes)


class Kinetics400TestCase(datasets_utils.VideoDatasetTestCase):
DATASET_CLASS = datasets.Kinetics400

def inject_fake_data(self, tmpdir, config):
classes = ("Abseiling", "Zumba")
num_videos_per_class = 2

digits = string.ascii_letters + string.digits + "-_"
for cls in classes:
datasets_utils.create_video_folder(
tmpdir,
cls,
lambda _: f"{datasets_utils.create_random_string(11, digits)}.avi",
num_videos_per_class,
)

return num_videos_per_class * len(classes)


class HMDB51TestCase(datasets_utils.VideoDatasetTestCase):
DATASET_CLASS = datasets.HMDB51

Expand Down
3 changes: 2 additions & 1 deletion test/test_datasets_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,14 +245,15 @@ def cifar100():


def voc():
# TODO: Also test the "2007-test" key
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm conveniently leaving this as a TODO, because we actually don't try to download voc() anyway: further down in this file, the call to voc() is commented out because their server is unstable.

return itertools.chain(
*[
collect_download_configs(
lambda: datasets.VOCSegmentation(ROOT, year=year, download=True),
name=f"VOC, {year}",
file="voc",
)
for year in ("2007", "2007-test", "2008", "2009", "2010", "2011", "2012")
for year in ("2007", "2008", "2009", "2010", "2011", "2012")
]
)

Expand Down
4 changes: 2 additions & 2 deletions torchvision/csrc/models/modelsimpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ inline bool double_compare(double a, double b) {

inline void deprecation_warning() {
TORCH_WARN_ONCE(
"The vision::models namespace is deprecated since 0.12 and will be "
"removed in 0.14. We recommend using Torch Script instead: "
"The vision::models namespace is not actively maintained, use at "
"your own discretion. We recommend using Torch Script instead: "
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like we originally didn't intend to deprecate the C++ models: at least according to #4375 (review), the original intention was to stop maintaininng them but to still keep them around.

So I put back the original warning, instead of removing the files. I'll still wait for @datumbox 's input on this tho.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for checking @NicolasHug. The intention was to remove them. The majority of the new models can't be added on C++ because the layers are only available on Python. So I think we are good to drop them, which was the intention when we deprecated them.

"https://pytorch.org/tutorials/advanced/cpp_export.html");
}

Expand Down
3 changes: 1 addition & 2 deletions torchvision/datasets/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from .hmdb51 import HMDB51
from .imagenet import ImageNet
from .inaturalist import INaturalist
from .kinetics import Kinetics400, Kinetics
from .kinetics import Kinetics
from .kitti import Kitti
from .lfw import LFWPeople, LFWPairs
from .lsun import LSUN, LSUNClass
Expand Down Expand Up @@ -80,7 +80,6 @@
"SBDataset",
"VisionDataset",
"USPS",
"Kinetics400",
"Kinetics",
"HMDB51",
"UCF101",
Expand Down
81 changes: 0 additions & 81 deletions torchvision/datasets/kinetics.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import os
import time
import urllib
import warnings
from functools import partial
from multiprocessing import Pool
from os import path
Expand Down Expand Up @@ -246,83 +245,3 @@ def __getitem__(self, idx: int) -> Tuple[Tensor, Tensor, int]:
video = self.transform(video)

return video, audio, label


class Kinetics400(Kinetics):
"""
`Kinetics-400 <https://deepmind.com/research/open-source/open-source-datasets/kinetics/>`_
dataset.

.. warning::
This class was deprecated in ``0.12`` and will be removed in ``0.14``. Please use
``Kinetics(..., num_classes='400')`` instead.

Kinetics-400 is an action recognition video dataset.
This dataset consider every video as a collection of video clips of fixed size, specified
by ``frames_per_clip``, where the step in frames between each clip is given by
``step_between_clips``.

To give an example, for 2 videos with 10 and 15 frames respectively, if ``frames_per_clip=5``
and ``step_between_clips=5``, the dataset size will be (2 + 3) = 5, where the first two
elements will come from video 1, and the next three elements from video 2.
Note that we drop clips which do not have exactly ``frames_per_clip`` elements, so not all
frames in a video might be present.

Internally, it uses a VideoClips object to handle clip creation.

Args:
root (string): Root directory of the Kinetics-400 Dataset. Should be structured as follows:

.. code::

root/
├── class1
│ ├── clip1.avi
│ ├── clip2.avi
│ ├── clip3.mp4
│ └── ...
└── class2
├── clipx.avi
└── ...

frames_per_clip (int): number of frames in a clip
step_between_clips (int): number of frames between each clip
transform (callable, optional): A function/transform that takes in a TxHxWxC video
and returns a transformed version.

Returns:
tuple: A 3-tuple with the following entries:

- video (Tensor[T, H, W, C]): the `T` video frames
- audio(Tensor[K, L]): the audio frames, where `K` is the number of channels
and `L` is the number of points
- label (int): class of the video clip
"""

def __init__(
self,
root: str,
frames_per_clip: int,
num_classes: Any = None,
split: Any = None,
download: Any = None,
num_download_workers: Any = None,
**kwargs: Any,
) -> None:
warnings.warn(
"The Kinetics400 class is deprecated since 0.12 and will be removed in 0.14."
"Please use Kinetics(..., num_classes='400') instead."
"Note that Kinetics(..., num_classes='400') returns video in a Tensor[T, C, H, W] format."
)
if any(value is not None for value in (num_classes, split, download, num_download_workers)):
raise RuntimeError(
"Usage of 'num_classes', 'split', 'download', or 'num_download_workers' is not supported in "
"Kinetics400. Please use Kinetics instead."
)

super().__init__(
root=root,
frames_per_clip=frames_per_clip,
_legacy=True,
**kwargs,
)
17 changes: 2 additions & 15 deletions torchvision/datasets/voc.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from defusedxml.ElementTree import parse as ET_parse
except ImportError:
from xml.etree.ElementTree import parse as ET_parse
import warnings
from typing import Any, Callable, Dict, Optional, Tuple, List

from PIL import Image
Expand Down Expand Up @@ -77,20 +76,8 @@ def __init__(
transforms: Optional[Callable] = None,
):
super().__init__(root, transforms, transform, target_transform)
if year == "2007-test":
if image_set == "test":
warnings.warn(
"Accessing the test image set of the year 2007 with year='2007-test' is deprecated "
"since 0.12 and will be removed in 0.14. "
"Please use the combination year='2007' and image_set='test' instead."
)
year = "2007"
else:
raise ValueError(
"In the test image set of the year 2007 only image_set='test' is allowed. "
"For all other image sets use year='2007' instead."
)
self.year = year

self.year = verify_str_arg(year, "year", valid_values=[str(yr) for yr in range(2007, 2013)])

valid_image_sets = ["train", "trainval", "val"]
if year == "2007":
Expand Down
19 changes: 0 additions & 19 deletions torchvision/models/mobilenetv2.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import warnings
from functools import partial
from typing import Callable, Any, Optional, List

Expand All @@ -18,24 +17,6 @@


# necessary for backwards compatibility
class _DeprecatedConvBNAct(Conv2dNormActivation):
def __init__(self, *args, **kwargs):
warnings.warn(
"The ConvBNReLU/ConvBNActivation classes are deprecated since 0.12 and will be removed in 0.14. "
"Use torchvision.ops.misc.Conv2dNormActivation instead.",
FutureWarning,
)
if kwargs.get("norm_layer", None) is None:
kwargs["norm_layer"] = nn.BatchNorm2d
if kwargs.get("activation_layer", None) is None:
kwargs["activation_layer"] = nn.ReLU6
super().__init__(*args, **kwargs)


ConvBNReLU = _DeprecatedConvBNAct
ConvBNActivation = _DeprecatedConvBNAct


class InvertedResidual(nn.Module):
def __init__(
self, inp: int, oup: int, stride: int, expand_ratio: int, norm_layer: Optional[Callable[..., nn.Module]] = None
Expand Down
16 changes: 0 additions & 16 deletions torchvision/models/mobilenetv3.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import warnings
from functools import partial
from typing import Any, Callable, List, Optional, Sequence

Expand All @@ -22,21 +21,6 @@
]


class SqueezeExcitation(SElayer):
"""DEPRECATED"""

def __init__(self, input_channels: int, squeeze_factor: int = 4):
squeeze_channels = _make_divisible(input_channels // squeeze_factor, 8)
super().__init__(input_channels, squeeze_channels, scale_activation=nn.Hardsigmoid)
self.relu = self.activation
delattr(self, "activation")
warnings.warn(
"This SqueezeExcitation class is deprecated since 0.12 and will be removed in 0.14. "
"Use torchvision.ops.SqueezeExcitation instead.",
FutureWarning,
)


class InvertedResidualConfig:
# Stores information listed at Tables 1 and 2 of the MobileNetV3 paper
def __init__(
Expand Down
10 changes: 0 additions & 10 deletions torchvision/models/segmentation/segmentation.py

This file was deleted.

17 changes: 0 additions & 17 deletions torchvision/ops/poolers.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import warnings
from typing import Optional, List, Dict, Tuple, Union

import torch
Expand Down Expand Up @@ -287,22 +286,6 @@ def __init__(
self.canonical_scale = canonical_scale
self.canonical_level = canonical_level

def convert_to_roi_format(self, boxes: List[Tensor]) -> Tensor:
warnings.warn("The 'convert_to_roi_format' method is deprecated since 0.12 and will be removed in 0.14.")
return _convert_to_roi_format(boxes)

def infer_scale(self, feature: Tensor, original_size: List[int]) -> float:
warnings.warn("The 'infer_scale' method is deprecated since 0.12 and will be removed in 0.14.")
return _infer_scale(feature, original_size)

def setup_setup_scales(
self,
features: List[Tensor],
image_shapes: List[Tuple[int, int]],
) -> None:
warnings.warn("The 'setup_setup_scales' method is deprecated since 0.12 and will be removed in 0.14.")
self.scales, self.map_levels = _setup_scales(features, image_shapes, self.canonical_scale, self.canonical_level)

def forward(
self,
x: Dict[str, Tensor],
Expand Down
Loading