ResNet

class paddle.vision.models. ResNet ( block, depth, num_classes=1000, with_pool=True ) [source]

ResNet model from “Deep Residual Learning for Image Recognition”

Parameters
  • Block (BasicBlock|BottleneckBlock) – block module of model.

  • depth (int) – layers of resnet, default: 50.

  • num_classes (int) – output dim of last fc layer. If num_classes <=0, last fc layer will not be defined. Default: 1000.

  • with_pool (bool) – use pool before the last fc layer or not. Default: True.

Examples

from paddle.vision.models import ResNet
from paddle.vision.models.resnet import BottleneckBlock, BasicBlock

resnet50 = ResNet(BottleneckBlock, 50)

resnet18 = ResNet(BasicBlock, 18)
forward ( x )

Defines the computation performed at every call. Should be overridden by all subclasses.

Parameters
  • *inputs (tuple) – unpacked tuple arguments

  • **kwargs (dict) – unpacked dict arguments