From e04b66f2d272d68f77dcd94cb2956938475411d8 Mon Sep 17 00:00:00 2001 From: zhiboniu <31800336+zhiboniu@users.noreply.github.com> Date: Fri, 30 Jul 2021 09:26:28 +0800 Subject: [PATCH] reverse paddle.vision.xxx import (#34489) --- python/paddle/__init__.py | 1 - python/paddle/vision/__init__.py | 99 ++++++++++++++++++-------------- 2 files changed, 56 insertions(+), 44 deletions(-) diff --git a/python/paddle/__init__.py b/python/paddle/__init__.py index e4cca3d459..44982eb3be 100755 --- a/python/paddle/__init__.py +++ b/python/paddle/__init__.py @@ -404,7 +404,6 @@ __all__ = [ # noqa 'logical_xor', 'exp', 'bernoulli', - 'summary', 'sinh', 'round', 'DataParallel', diff --git a/python/paddle/vision/__init__.py b/python/paddle/vision/__init__.py index 79fb7844dd..76393865de 100644 --- a/python/paddle/vision/__init__.py +++ b/python/paddle/vision/__init__.py @@ -20,50 +20,63 @@ from . import ops # noqa: F401 from .image import set_image_backend # noqa: F401 from .image import get_image_backend # noqa: F401 from .image import image_load # noqa: F401 -from .models import LeNet as models_LeNet -import paddle.utils.deprecated as deprecated +from .datasets import DatasetFolder # noqa: F401 +from .datasets import ImageFolder # noqa: F401 +from .datasets import MNIST # noqa: F401 +from .datasets import FashionMNIST # noqa: F401 +from .datasets import Flowers # noqa: F401 +from .datasets import Cifar10 # noqa: F401 +from .datasets import Cifar100 # noqa: F401 +from .datasets import VOC2012 # noqa: F401 +from .models import ResNet # noqa: F401 +from .models import resnet18 # noqa: F401 +from .models import resnet34 # noqa: F401 +from .models import resnet50 # noqa: F401 +from .models import resnet101 # noqa: F401 +from .models import resnet152 # noqa: F401 +from .models import MobileNetV1 # noqa: F401 +from .models import mobilenet_v1 # noqa: F401 +from .models import MobileNetV2 # noqa: F401 +from .models import mobilenet_v2 # noqa: F401 +from .models import VGG # noqa: F401 +from .models import vgg11 # noqa: F401 +from .models import vgg13 # noqa: F401 +from .models import vgg16 # noqa: F401 +from .models import vgg19 # noqa: F401 +from .models import LeNet # noqa: F401 +from .transforms import BaseTransform # noqa: F401 +from .transforms import Compose # noqa: F401 +from .transforms import Resize # noqa: F401 +from .transforms import RandomResizedCrop # noqa: F401 +from .transforms import CenterCrop # noqa: F401 +from .transforms import RandomHorizontalFlip # noqa: F401 +from .transforms import RandomVerticalFlip # noqa: F401 +from .transforms import Transpose # noqa: F401 +from .transforms import Normalize # noqa: F401 +from .transforms import BrightnessTransform # noqa: F401 +from .transforms import SaturationTransform # noqa: F401 +from .transforms import ContrastTransform # noqa: F401 +from .transforms import HueTransform # noqa: F401 +from .transforms import ColorJitter # noqa: F401 +from .transforms import RandomCrop # noqa: F401 +from .transforms import Pad # noqa: F401 +from .transforms import RandomRotation # noqa: F401 +from .transforms import Grayscale # noqa: F401 +from .transforms import ToTensor # noqa: F401 +from .transforms import to_tensor # noqa: F401 +from .transforms import hflip # noqa: F401 +from .transforms import vflip # noqa: F401 +from .transforms import resize # noqa: F401 +from .transforms import pad # noqa: F401 +from .transforms import rotate # noqa: F401 +from .transforms import to_grayscale # noqa: F401 +from .transforms import crop # noqa: F401 +from .transforms import center_crop # noqa: F401 +from .transforms import adjust_brightness # noqa: F401 +from .transforms import adjust_contrast # noqa: F401 +from .transforms import adjust_hue # noqa: F401 +from .transforms import normalize # noqa: F401 __all__ = [ #noqa 'set_image_backend', 'get_image_backend', 'image_load' ] - - -class LeNet(models_LeNet): - """LeNet model from - `"LeCun Y, Bottou L, Bengio Y, et al. Gradient-based learning applied to document recognition[J]. Proceedings of the IEEE, 1998, 86(11): 2278-2324.`_ - - Args: - num_classes (int): output dim of last fc layer. If num_classes <=0, last fc layer - will not be defined. Default: 10. - - Examples: - .. code-block:: python - - from paddle.vision.models import LeNet - - model = LeNet() - """ - - @deprecated( - since="2.0.0", - update_to="paddle.vision.models.LeNet", - level=1, - reason="Please use new API in models, paddle.vision.LeNet will be removed in future" - ) - def __init__(self, num_classes=10): - super(LeNet, self).__init__(num_classes=10) - self.num_classes = num_classes - self.features = nn.Sequential( - nn.Conv2D( - 1, 6, 3, stride=1, padding=1), - nn.ReLU(), - nn.MaxPool2D(2, 2), - nn.Conv2D( - 6, 16, 5, stride=1, padding=0), - nn.ReLU(), - nn.MaxPool2D(2, 2)) - - if num_classes > 0: - self.fc = nn.Sequential( - nn.Linear(400, 120), - nn.Linear(120, 84), nn.Linear(84, num_classes)) -- GitLab