未验证 提交 a83a368f 编写于 作者: Z zhiboniu 提交者: GitHub

reverse paddle.vision.xxx import (#34432)

上级 0b2e510f
......@@ -425,7 +425,6 @@ __all__ = [ # noqa
'exp',
'expm1',
'bernoulli',
'summary',
'sinh',
'round',
'DataParallel',
......
......@@ -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))
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册