From 7536e2987b13f02d40d064f57a5f417a7b560909 Mon Sep 17 00:00:00 2001 From: Ben Weinstein Date: Thu, 7 Jan 2021 13:52:33 -0800 Subject: [PATCH] Remove unused imports after manual review (#3229) * remove unused imports after manual review * Update torchvision/datasets/voc.py Co-authored-by: Vasilis Vryniotis * remove two more instances Co-authored-by: Ben Weinstein Co-authored-by: Vasilis Vryniotis --- references/classification/train_quantization.py | 1 - references/detection/train.py | 1 - references/detection/transforms.py | 1 - references/similarity/model.py | 1 - torchvision/datasets/cityscapes.py | 1 - torchvision/datasets/omniglot.py | 1 - torchvision/datasets/ucf101.py | 1 - torchvision/datasets/utils.py | 1 - torchvision/datasets/video_utils.py | 1 - torchvision/datasets/voc.py | 4 ++-- torchvision/models/detection/mask_rcnn.py | 3 --- torchvision/models/detection/transform.py | 1 - torchvision/models/video/resnet.py | 1 - 13 files changed, 2 insertions(+), 16 deletions(-) diff --git a/references/classification/train_quantization.py b/references/classification/train_quantization.py index a054dbda91c..b0452a9426e 100644 --- a/references/classification/train_quantization.py +++ b/references/classification/train_quantization.py @@ -1,7 +1,6 @@ import datetime import os import time -import sys import copy import torch diff --git a/references/detection/train.py b/references/detection/train.py index 00d94fd1636..d46e832a2ff 100644 --- a/references/detection/train.py +++ b/references/detection/train.py @@ -23,7 +23,6 @@ import torch import torch.utils.data -from torch import nn import torchvision import torchvision.models.detection import torchvision.models.detection.mask_rcnn diff --git a/references/detection/transforms.py b/references/detection/transforms.py index 73efc92bdef..937ae3c07fc 100644 --- a/references/detection/transforms.py +++ b/references/detection/transforms.py @@ -1,5 +1,4 @@ import random -import torch from torchvision.transforms import functional as F diff --git a/references/similarity/model.py b/references/similarity/model.py index 797ad41a48b..3b39c0ec0dc 100644 --- a/references/similarity/model.py +++ b/references/similarity/model.py @@ -1,4 +1,3 @@ -import torch import torch.nn as nn import torchvision.models as models diff --git a/torchvision/datasets/cityscapes.py b/torchvision/datasets/cityscapes.py index 918fda5f3a6..bed7524ac4f 100644 --- a/torchvision/datasets/cityscapes.py +++ b/torchvision/datasets/cityscapes.py @@ -1,7 +1,6 @@ import json import os from collections import namedtuple -import zipfile from typing import Any, Callable, Dict, List, Optional, Union, Tuple from .utils import extract_archive, verify_str_arg, iterable_to_str diff --git a/torchvision/datasets/omniglot.py b/torchvision/datasets/omniglot.py index 167fc4e6d0e..20eee3b38ae 100644 --- a/torchvision/datasets/omniglot.py +++ b/torchvision/datasets/omniglot.py @@ -1,6 +1,5 @@ from PIL import Image from os.path import join -import os from typing import Any, Callable, List, Optional, Tuple from .vision import VisionDataset from .utils import download_and_extract_archive, check_integrity, list_dir, list_files diff --git a/torchvision/datasets/ucf101.py b/torchvision/datasets/ucf101.py index ce614f75f07..2c10d739427 100644 --- a/torchvision/datasets/ucf101.py +++ b/torchvision/datasets/ucf101.py @@ -1,4 +1,3 @@ -import glob import os from .utils import list_dir diff --git a/torchvision/datasets/utils.py b/torchvision/datasets/utils.py index 77d868a1e2b..6a32cc07fd5 100644 --- a/torchvision/datasets/utils.py +++ b/torchvision/datasets/utils.py @@ -2,7 +2,6 @@ import os.path import hashlib import gzip -import errno import tarfile from typing import Any, Callable, List, Iterable, Optional, TypeVar import zipfile diff --git a/torchvision/datasets/video_utils.py b/torchvision/datasets/video_utils.py index 71c9446a1e6..0a7fbe94928 100644 --- a/torchvision/datasets/video_utils.py +++ b/torchvision/datasets/video_utils.py @@ -8,7 +8,6 @@ from torchvision.io import ( _probe_video_from_file, _read_video_from_file, - _read_video_timestamps_from_file, read_video, read_video_timestamps, ) diff --git a/torchvision/datasets/voc.py b/torchvision/datasets/voc.py index b39032da383..666bd01b5c2 100644 --- a/torchvision/datasets/voc.py +++ b/torchvision/datasets/voc.py @@ -4,8 +4,8 @@ from .vision import VisionDataset import xml.etree.ElementTree as ET from PIL import Image -from typing import Any, Callable, Dict, List, Optional, Tuple, Union -from .utils import download_url, check_integrity, verify_str_arg +from typing import Any, Callable, Dict, Optional, Tuple +from .utils import download_url, verify_str_arg DATASET_YEAR_DICT = { '2012': { diff --git a/torchvision/models/detection/mask_rcnn.py b/torchvision/models/detection/mask_rcnn.py index bf207467790..4710198c43a 100644 --- a/torchvision/models/detection/mask_rcnn.py +++ b/torchvision/models/detection/mask_rcnn.py @@ -1,10 +1,7 @@ from collections import OrderedDict -import torch from torch import nn -import torch.nn.functional as F -from torchvision.ops import misc as misc_nn_ops from torchvision.ops import MultiScaleRoIAlign from ._utils import overwrite_eps diff --git a/torchvision/models/detection/transform.py b/torchvision/models/detection/transform.py index 8b91d536621..0d95361eedb 100644 --- a/torchvision/models/detection/transform.py +++ b/torchvision/models/detection/transform.py @@ -1,4 +1,3 @@ -import random import math import torch from torch import nn, Tensor diff --git a/torchvision/models/video/resnet.py b/torchvision/models/video/resnet.py index a9e59a149c0..fbdaf3d555a 100644 --- a/torchvision/models/video/resnet.py +++ b/torchvision/models/video/resnet.py @@ -1,4 +1,3 @@ -import torch import torch.nn as nn from ..utils import load_state_dict_from_url