mindcv.models

models init

class mindcv.models.BiT_ResNet(block, layers, wf=1, num_classes=1000, in_channels=3, groups=1, base_width=64, norm=None)[源代码]

基类:Cell

BiT_ResNet model class, based on “Big Transfer (BiT): General Visual Representation Learning”

参数
  • block (Type[Bottleneck]) – block of BiT_ResNetv2.

  • layers (List[int]) – number of layers of each stage.

  • width – width of each layer.

  • num_classes (int) – number of classification classes. Default: 1000.

  • in_channels (int) – number the channels of the input. Default: 3.

  • groups (int) – number of groups for group conv in blocks. Default: 1.

  • base_width (int) – base width of pre group hidden channel in blocks. Default: 64.

  • norm (Optional[Cell]) – normalization layer in blocks. Default: None.

  • wf (int) –

construct(x)[源代码]

Defines the computation to be performed. This method must be overridden by all subclasses.

备注

It is not supported currently that inputs contain both tuple and non-tuple types at same time.

参数
  • inputs (tuple) – Tuple of variable parameters.

  • kwargs (dict) – Dictionary of variable keyword parameters.

  • x (Tensor) –

返回

Tensor, returns the computed result.

返回类型

Tensor

forward_features(x)[源代码]

Network forward feature extraction.

参数

x (Tensor) –

返回类型

Tensor

forward_head(x)[源代码]
参数

x (Tensor) –

返回类型

Tensor

root(x)[源代码]
参数

x (Tensor) –

返回类型

Tensor

mindcv.models.BiTresnet50(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]

Get 50 layers ResNet model. Refer to the base class models.BiT_Resnet for more details.

参数
  • pretrained (bool) –

  • num_classes (int) –

class mindcv.models.ConViT(in_channels=3, num_classes=1000, image_size=224, patch_size=16, embed_dim=48, num_heads=12, drop_rate=0.0, drop_path_rate=0.1, depth=12, mlp_ratio=4.0, qkv_bias=False, attn_drop_rate=0.0, local_up_to_layer=10, use_pos_embed=True, locality_strength=1.0)[源代码]

基类:Cell

ConViT model class, based on ‘“Improving Vision Transformers with Soft Convolutional Inductive Biases” <https://arxiv.org/pdf/2103.10697.pdf>’

参数
  • in_channels (int) – number the channels of the input. Default: 3.

  • num_classes (int) – number of classification classes. Default: 1000.

  • image_size (int) – images input size. Default: 224.

  • patch_size (int) – image patch size. Default: 16.

  • embed_dim (int) – embedding dimension in all head. Default: 48.

  • num_heads (int) – number of heads. Default: 12.

  • drop_rate (float) – dropout rate. Default: 0.

  • drop_path_rate (float) – drop path rate. Default: 0.1.

  • depth (int) – model block depth. Default: 12.

  • mlp_ratio (float) – ratio of hidden features in Mlp. Default: 4.

  • qkv_bias (bool) – have bias in qkv layers or not. Default: False.

  • attn_drop_rate (float) – attention layers dropout rate. Default: 0.

  • locality_strength (float) – determines how focused each head is around its attention center. Default: 1.

  • local_up_to_layer (int) – number of GPSA layers. Default: 10.

  • use_pos_embed (bool) –

construct(x)[源代码]

Defines the computation to be performed. This method must be overridden by all subclasses.

备注

It is not supported currently that inputs contain both tuple and non-tuple types at same time.

参数
  • inputs (tuple) – Tuple of variable parameters.

  • kwargs (dict) – Dictionary of variable keyword parameters.

  • x (Tensor) –

返回

Tensor, returns the computed result.

返回类型

Tensor

forward_features(x)[源代码]
参数

x (Tensor) –

返回类型

Tensor

forward_head(x)[源代码]
参数

x (Tensor) –

返回类型

Tensor

class mindcv.models.ConvNeXt(in_channels, num_classes, depths, dims, drop_path_rate=0.0, layer_scale_init_value=1e-06, head_init_scale=1.0)[源代码]

基类:Cell

ConvNeXt model class, based on ‘“A ConvNet for the 2020s” <https://arxiv.org/abs/2201.03545>’ :param in_channels: dim of the input channel. :type in_channels: int :param num_classes: dim of the classes predicted. :type num_classes: int :param depths: the depths of each layer. :type depths: List[int] :param dims: the middle dim of each layer. :type dims: List[int] :param drop_path_rate: the rate of droppath default : 0. :type drop_path_rate: float :param layer_scale_init_value: the parameter of init for the classifier default : 1e-6. :type layer_scale_init_value: float :param head_init_scale: the parameter of init for the head default : 1. :type head_init_scale: float

参数
  • in_channels (int) –

  • num_classes (int) –

  • depths (List[int]) –

  • dims (List[int]) –

  • drop_path_rate (float) –

  • layer_scale_init_value (float) –

  • head_init_scale (float) –

construct(x)[源代码]

Defines the computation to be performed. This method must be overridden by all subclasses.

备注

It is not supported currently that inputs contain both tuple and non-tuple types at same time.

参数
  • inputs (tuple) – Tuple of variable parameters.

  • kwargs (dict) – Dictionary of variable keyword parameters.

  • x (Tensor) –

返回

Tensor, returns the computed result.

返回类型

Tensor

forward_features(x)[源代码]
参数

x (Tensor) –

返回类型

Tensor

forward_head(x)[源代码]
参数

x (Tensor) –

返回类型

Tensor

class mindcv.models.DPN(num_init_channel=64, k_r=96, g=32, k_sec=(3, 4, 20, 3), inc_sec=(16, 32, 24, 128), in_channels=3, num_classes=1000)[源代码]

基类:Cell

DPN model class, based on “Dual Path Networks”

参数
  • num_init_channel (int) – the output channel of first blocks. Default: 64.

  • k_r (int) – the first channel of each stage. Default: 96.

  • g (int) – number of group in the conv2d. Default: 32.

  • Tuple[int] (inc_sec) – multiplicative factor for number of bottleneck layers. Default: 4.

  • Tuple[int] – the first output channel in each stage. Default: (16, 32, 24, 128).

  • in_channels (int) – number of input channels. Default: 3.

  • num_classes (int) – number of classification classes. Default: 1000.

  • k_sec (Tuple[int, int, int, int]) –

  • inc_sec (Tuple[int, int, int, int]) –

construct(x)[源代码]

Defines the computation to be performed. This method must be overridden by all subclasses.

备注

It is not supported currently that inputs contain both tuple and non-tuple types at same time.

参数
  • inputs (tuple) – Tuple of variable parameters.

  • kwargs (dict) – Dictionary of variable keyword parameters.

  • x (Tensor) –

返回

Tensor, returns the computed result.

返回类型

Tensor

forward_feature(x)[源代码]
参数

x (Tensor) –

返回类型

Tensor

forward_head(x)[源代码]
参数

x (Tensor) –

返回类型

Tensor

class mindcv.models.DenseNet(growth_rate=32, block_config=(6, 12, 24, 16), num_init_features=64, bn_size=4, drop_rate=0.0, in_channels=3, num_classes=1000)[源代码]

基类:Cell

Densenet-BC model class, based on “Densely Connected Convolutional Networks”

参数
  • growth_rate (int) – how many filters to add each layer (k in paper). Default: 32.

  • block_config (Tuple[int, int, int, int]) – how many layers in each pooling block. Default: (6, 12, 24, 16).

  • num_init_features (int) – number of filters in the first Conv2d. Default: 64.

  • bn_size (int) – multiplicative factor for number of bottleneck layers (i.e. bn_size * k features in the bottleneck layer). Default: 4.

  • drop_rate (float) – dropout rate after each dense layer. Default: 0.

  • in_channels (int) – number of input channels. Default: 3.

  • num_classes (int) – number of classification classes. Default: 1000.

construct(x)[源代码]

Defines the computation to be performed. This method must be overridden by all subclasses.

备注

It is not supported currently that inputs contain both tuple and non-tuple types at same time.

参数
  • inputs (tuple) – Tuple of variable parameters.

  • kwargs (dict) – Dictionary of variable keyword parameters.

  • x (Tensor) –

返回

Tensor, returns the computed result.

返回类型

Tensor

forward_features(x)[源代码]
参数

x (Tensor) –

返回类型

Tensor

forward_head(x)[源代码]
参数

x (Tensor) –

返回类型

Tensor

class mindcv.models.EfficientNet(arch, dropout_rate, width_mult=1.0, depth_mult=1.0, in_channels=3, num_classes=1000, inverted_residual_setting=None, keep_prob=0.2, norm_layer=None)[源代码]

基类:Cell

EfficientNet architecture. EfficientNet: Rethinking Model Scaling for Convolutional Neural Networks.

参数
  • arch (str) – The name of the model.

  • dropout_rate (float) – The dropout rate of efficientnet.

  • width_mult (float) – The ratio of the channel. Default: 1.0.

  • depth_mult (float) – The ratio of num_layers. Default: 1.0.

  • in_channels (int) – The input channels. Default: 3.

  • num_classes (int) – The number of class. Default: 1000.

  • inverted_residual_setting (Sequence[Union[MBConvConfig, FusedMBConvConfig]], optional) – The settings of block. Default: None.

  • keep_prob (float) – The dropout rate of MBConv. Default: 0.2.

  • norm_layer (nn.Cell, optional) – The normalization layer. Default: None.

Inputs:
  • x (Tensor) - Tensor of shape \((N, C_{in}, H_{in}, W_{in})\).

Outputs:

Tensor of shape \((N, 1000)\).

construct(x)[源代码]
参数

x (Tensor) –

返回类型

Tensor

forward_features(x)[源代码]
参数

x (Tensor) –

返回类型

Tensor

forward_head(x)[源代码]
参数

x (Tensor) –

返回类型

Tensor

class mindcv.models.GhostNet(cfgs, num_classes=1000, in_channels=3, width=1.0, dropout=0.2)[源代码]

基类:Cell

GhostNet model class, based on “GhostNet: More Features from Cheap Operations “

参数
  • cfgs – the config of the GhostNet.

  • num_classes (int) – number of classification classes. Default: 1000.

  • in_channels (int) – number of input channels. Default: 3.

  • width (float) – base width of hidden channel in blocks. Default: 1.0

  • droupout – the prob of the features before classification. Default: 0.2

  • dropout (float) –

construct(x)[源代码]

Defines the computation to be performed. This method must be overridden by all subclasses.

备注

It is not supported currently that inputs contain both tuple and non-tuple types at same time.

参数
  • inputs (tuple) – Tuple of variable parameters.

  • kwargs (dict) – Dictionary of variable keyword parameters.

  • x (Tensor) –

返回

Tensor, returns the computed result.

返回类型

Tensor

forward_features(x)[源代码]
参数

x (Tensor) –

返回类型

Tensor

forward_head(x)[源代码]
参数

x (Tensor) –

返回类型

Tensor

class mindcv.models.GoogLeNet(num_classes=1000, aux_logits=False, in_channels=3, drop_rate=0.2, drop_rate_aux=0.7)[源代码]

基类:Cell

GoogLeNet (Inception v1) model architecture from “Going Deeper with Convolutions”.

参数
  • num_classes (int) – number of classification classes. Default: 1000.

  • aux_logits (bool) – use auxiliary classifier or not. Default: False.

  • in_channels (int) – number the channels of the input. Default: 3.

  • drop_rate (float) – dropout rate of the layer before main classifier. Default: 0.2.

  • drop_rate_aux (float) – dropout rate of the layer before auxiliary classifier. Default: 0.7.

construct(x)[源代码]

Defines the computation to be performed. This method must be overridden by all subclasses.

备注

It is not supported currently that inputs contain both tuple and non-tuple types at same time.

参数
  • inputs (tuple) – Tuple of variable parameters.

  • kwargs (dict) – Dictionary of variable keyword parameters.

  • x (Tensor) –

返回

Tensor, returns the computed result.

返回类型

Union[Tensor, Tuple[Tensor, Tensor, Tensor]]

class mindcv.models.InceptionV3(num_classes=1000, aux_logits=True, in_channels=3, drop_rate=0.2)[源代码]

基类:Cell

Inception v3 model architecture from “Rethinking the Inception Architecture for Computer Vision”.

备注

Important: In contrast to the other models the inception_v3 expects tensors with a size of N x 3 x 299 x 299, so ensure your images are sized accordingly.

参数
  • num_classes (int) – number of classification classes. Default: 1000.

  • aux_logits (bool) – use auxiliary classifier or not. Default: False.

  • in_channels (int) – number the channels of the input. Default: 3.

  • drop_rate (float) – dropout rate of the layer before main classifier. Default: 0.2.

construct(x)[源代码]

Defines the computation to be performed. This method must be overridden by all subclasses.

备注

It is not supported currently that inputs contain both tuple and non-tuple types at same time.

参数
  • inputs (tuple) – Tuple of variable parameters.

  • kwargs (dict) – Dictionary of variable keyword parameters.

  • x (Tensor) –

返回

Tensor, returns the computed result.

返回类型

Union[Tensor, Tuple[Tensor, Tensor]]

forward_features(x)[源代码]
参数

x (Tensor) –

返回类型

Tensor

forward_postaux(x)[源代码]
参数

x (Tensor) –

返回类型

Tensor

forward_preaux(x)[源代码]
参数

x (Tensor) –

返回类型

Tensor

class mindcv.models.InceptionV4(num_classes=1000, in_channels=3, drop_rate=0.2)[源代码]

基类:Cell

Inception v4 model architecture from “Inception-v4, Inception-ResNet and the Impact of Residual Connections on Learning”.

参数
  • num_classes (int) – number of classification classes. Default: 1000.

  • in_channels (int) – number the channels of the input. Default: 3.

  • drop_rate (float) – dropout rate of the layer before main classifier. Default: 0.2.

construct(x)[源代码]

Defines the computation to be performed. This method must be overridden by all subclasses.

备注

It is not supported currently that inputs contain both tuple and non-tuple types at same time.

参数
  • inputs (tuple) – Tuple of variable parameters.

  • kwargs (dict) – Dictionary of variable keyword parameters.

  • x (Tensor) –

返回

Tensor, returns the computed result.

返回类型

Tensor

forward_features(x)[源代码]
参数

x (Tensor) –

返回类型

Tensor

forward_head(x)[源代码]
参数

x (Tensor) –

返回类型

Tensor

class mindcv.models.Mnasnet(alpha, in_channels=3, num_classes=1000, drop_rate=0.2)[源代码]

基类:Cell

MnasNet model architecture from “MnasNet: Platform-Aware Neural Architecture Search for Mobile”.

参数
  • alpha (float) – scale factor of model width.

  • in_channels (int) – number the channels of the input. Default: 3.

  • num_classes (int) – number of classification classes. Default: 1000.

  • drop_rate (float) – dropout rate of the layer before main classifier. Default: 0.2.

construct(x)[源代码]

Defines the computation to be performed. This method must be overridden by all subclasses.

备注

It is not supported currently that inputs contain both tuple and non-tuple types at same time.

参数
  • inputs (tuple) – Tuple of variable parameters.

  • kwargs (dict) – Dictionary of variable keyword parameters.

  • x (Tensor) –

返回

Tensor, returns the computed result.

返回类型

Tensor

forward_features(x)[源代码]
参数

x (Tensor) –

返回类型

Tensor

forward_head(x)[源代码]
参数

x (Tensor) –

返回类型

Tensor

class mindcv.models.MobileNetV1(alpha=1.0, in_channels=3, num_classes=1000)[源代码]

基类:Cell

MobileNetV1 model class, based on “MobileNets: Efficient Convolutional Neural Networks for Mobile Vision Applications”

参数
  • alpha (float) – scale factor of model width. Default: 1.

  • in_channels (int) – number the channels of the input. Default: 3.

  • num_classes (int) – number of classification classes. Default: 1000.

construct(x)[源代码]

Defines the computation to be performed. This method must be overridden by all subclasses.

备注

It is not supported currently that inputs contain both tuple and non-tuple types at same time.

参数
  • inputs (tuple) – Tuple of variable parameters.

  • kwargs (dict) – Dictionary of variable keyword parameters.

  • x (Tensor) –

返回

Tensor, returns the computed result.

返回类型

Tensor

forward_features(x)[源代码]
参数

x (Tensor) –

返回类型

Tensor

forward_head(x)[源代码]
参数

x (Tensor) –

返回类型

Tensor

class mindcv.models.MobileNetV2(alpha=1.0, round_nearest=8, in_channels=3, num_classes=1000)[源代码]

基类:Cell

MobileNetV2 model class, based on “MobileNetV2: Inverted Residuals and Linear Bottlenecks”

参数
  • alpha (float) – scale factor of model width. Default: 1.

  • round_nearest (int) – divisor of make divisible function. Default: 8.

  • in_channels (int) – number the channels of the input. Default: 3.

  • num_classes (int) – number of classification classes. Default: 1000.

construct(x)[源代码]

Defines the computation to be performed. This method must be overridden by all subclasses.

备注

It is not supported currently that inputs contain both tuple and non-tuple types at same time.

参数
  • inputs (tuple) – Tuple of variable parameters.

  • kwargs (dict) – Dictionary of variable keyword parameters.

  • x (Tensor) –

返回

Tensor, returns the computed result.

返回类型

Tensor

forward_features(x)[源代码]
参数

x (Tensor) –

返回类型

Tensor

forward_head(x)[源代码]
参数

x (Tensor) –

返回类型

Tensor

class mindcv.models.MobileNetV3(arch, alpha=1.0, round_nearest=8, in_channels=3, num_classes=1000)[源代码]

基类:Cell

MobileNetV3 model class, based on “Searching for MobileNetV3”

参数
  • arch (str) – size of the architecture. ‘small’ or ‘large’.

  • alpha (float) – scale factor of model width. Default: 1.

  • round_nearest (int) – divisor of make divisible function. Default: 8.

  • in_channels (int) – number the channels of the input. Default: 3.

  • num_classes (int) – number of classification classes. Default: 1000.

construct(x)[源代码]

Defines the computation to be performed. This method must be overridden by all subclasses.

备注

It is not supported currently that inputs contain both tuple and non-tuple types at same time.

参数
  • inputs (tuple) – Tuple of variable parameters.

  • kwargs (dict) – Dictionary of variable keyword parameters.

  • x (Tensor) –

返回

Tensor, returns the computed result.

返回类型

Tensor

forward_features(x)[源代码]
参数

x (Tensor) –

返回类型

Tensor

forward_head(x)[源代码]
参数

x (Tensor) –

返回类型

Tensor

class mindcv.models.NASNetAMobile(in_channels=3, num_classes=1000, stem_filters=32, penultimate_filters=1056, filters_multiplier=2)[源代码]

基类:Cell

NasNet model class, based on “Learning Transferable Architectures for Scalable Image Recognition” :param num_classes: number of classification classes. :param stem_filters: number of stem filters. Default: 32. :param penultimate_filters: number of penultimate filters. Default: 1056. :param filters_multiplier: size of filters multiplier. Default: 2.

参数
  • in_channels (int) –

  • num_classes (int) –

  • stem_filters (int) –

  • penultimate_filters (int) –

  • filters_multiplier (int) –

construct(x)[源代码]

Defines the computation to be performed. This method must be overridden by all subclasses.

备注

It is not supported currently that inputs contain both tuple and non-tuple types at same time.

参数
  • inputs (tuple) – Tuple of variable parameters.

  • kwargs (dict) – Dictionary of variable keyword parameters.

  • x (Tensor) –

返回

Tensor, returns the computed result.

返回类型

Tensor

forward_features(x)[源代码]

Network forward feature extraction.

参数

x (Tensor) –

返回类型

Tensor

forward_head(x)[源代码]
参数

x (Tensor) –

返回类型

Tensor

class mindcv.models.Pnasnet(in_channels=3, num_classes=1000)[源代码]

基类:Cell

PNasNet model class, based on “Progressive Neural Architecture Search” :param number of input channels. Default:

参数
  • num_classes (int) – number of classification classes. Default: 1000.

  • in_channels (int) –

construct(x)[源代码]

Defines the computation to be performed. This method must be overridden by all subclasses.

备注

It is not supported currently that inputs contain both tuple and non-tuple types at same time.

参数
  • inputs (tuple) – Tuple of variable parameters.

  • kwargs (dict) – Dictionary of variable keyword parameters.

  • x (Tensor) –

返回

Tensor, returns the computed result.

返回类型

Tensor

forward_features(x)[源代码]
参数

x (Tensor) –

返回类型

Tensor

forward_head(x)[源代码]
参数

x (Tensor) –

返回类型

Tensor

class mindcv.models.RepVGG(num_blocks, num_classes=1000, in_channels=3, width_multiplier=None, override_group_map=None, deploy=False, use_se=False)[源代码]

基类:Cell

RepVGG model class, based on “RepVGGBlock: An all-MLP Architecture for Vision”

参数
  • num_blocks (list) – number of RepVGGBlocks

  • num_classes (int) – number of classification classes. Default: 1000.

  • in_channels (in_channels) – number the channels of the input. Default: 3.

  • width_multiplier (list) – the numbers of MLP Architecture.

  • override_group_map (dict) – the numbers of MLP Architecture.

  • deploy (bool) – use rbr_reparam block or not. Default: False

  • use_se (bool) – use se_block or not. Default: False

construct(x)[源代码]

Defines the computation to be performed. This method must be overridden by all subclasses.

备注

It is not supported currently that inputs contain both tuple and non-tuple types at same time.

参数
  • inputs (tuple) – Tuple of variable parameters.

  • kwargs (dict) – Dictionary of variable keyword parameters.

返回

Tensor, returns the computed result.

class mindcv.models.Res2Net(block, layer_nums, version='res2net', num_classes=1000, in_channels=3, groups=1, base_width=26, scale=4, norm=None)[源代码]

基类:Cell

Res2Net model class, based on “Res2Net: A New Multi-scale Backbone Architecture”

参数
  • block (Type[Cell]) – block of resnet.

  • layer_nums (List[int]) – number of layers of each stage.

  • version (str) – variety of Res2Net, ‘res2net’ or ‘res2net_v1b’. Default: ‘res2net’.

  • num_classes (int) – number of classification classes. Default: 1000.

  • in_channels (int) – number the channels of the input. Default: 3.

  • groups (int) – number of groups for group conv in blocks. Default: 1.

  • base_width (int) – base width of pre group hidden channel in blocks. Default: 26.

  • scale – scale factor of Bottle2neck. Default: 4.

  • norm (Optional[Cell]) – normalization layer in blocks. Default: None.

construct(x)[源代码]

Defines the computation to be performed. This method must be overridden by all subclasses.

备注

It is not supported currently that inputs contain both tuple and non-tuple types at same time.

参数
  • inputs (tuple) – Tuple of variable parameters.

  • kwargs (dict) – Dictionary of variable keyword parameters.

  • x (Tensor) –

返回

Tensor, returns the computed result.

返回类型

Tensor

forward_features(x)[源代码]
参数

x (Tensor) –

返回类型

Tensor

forward_head(x)[源代码]
参数

x (Tensor) –

返回类型

Tensor

class mindcv.models.ResNet(block, layers, num_classes=1000, in_channels=3, groups=1, base_width=64, norm=None)[源代码]

基类:Cell

ResNet model class, based on “Deep Residual Learning for Image Recognition”

参数
  • block (Type[Union[BasicBlock, Bottleneck]]) – block of resnet.

  • layers (List[int]) – number of layers of each stage.

  • num_classes (int) – number of classification classes. Default: 1000.

  • in_channels (int) – number the channels of the input. Default: 3.

  • groups (int) – number of groups for group conv in blocks. Default: 1.

  • base_width (int) – base width of pre group hidden channel in blocks. Default: 64.

  • norm (Optional[Cell]) – normalization layer in blocks. Default: None.

construct(x)[源代码]

Defines the computation to be performed. This method must be overridden by all subclasses.

备注

It is not supported currently that inputs contain both tuple and non-tuple types at same time.

参数
  • inputs (tuple) – Tuple of variable parameters.

  • kwargs (dict) – Dictionary of variable keyword parameters.

  • x (Tensor) –

返回

Tensor, returns the computed result.

返回类型

Tensor

forward_features(x)[源代码]

Network forward feature extraction.

参数

x (Tensor) –

返回类型

Tensor

forward_head(x)[源代码]
参数

x (Tensor) –

返回类型

Tensor

class mindcv.models.SKNet(block, layers, num_classes=1000, in_channels=3, groups=1, base_width=64, norm=None, sk_kwargs=None)[源代码]

基类:ResNet

SKNet model class, based on “Selective Kernel Networks”

参数
  • block (Type[Cell]) – block of sknet.

  • layers (List[int]) – number of layers of each stage.

  • num_classes (int) – number of classification classes. Default: 1000.

  • in_channels (int) – number the channels of the input. Default: 3.

  • groups (int) – number of groups for group conv in blocks. Default: 1.

  • base_width (int) – base width of pre group hidden channel in blocks. Default: 64.

  • norm (Optional[Cell]) – normalization layer in blocks. Default: None.

  • sk_kwargs (Optional[Dict]) – kwargs of selective kernel. Default: None.

class mindcv.models.ShuffleNetV1(num_classes=1000, in_channels=3, model_size='2.0x', group=3)[源代码]

基类:Cell

ShuffleNetV1 model class, based on “ShuffleNet: An Extremely Efficient Convolutional Neural Network for Mobile Devices”

参数
  • num_classes (int) – number of classification classes. Default: 1000.

  • in_channels (int) – number of input channels. Default: 3.

  • model_size (str) – scale factor which controls the number of channels. Default: ‘2.0x’.

  • group (int) – number of group for group convolution. Default: 3.

construct(x)[源代码]

Defines the computation to be performed. This method must be overridden by all subclasses.

备注

It is not supported currently that inputs contain both tuple and non-tuple types at same time.

参数
  • inputs (tuple) – Tuple of variable parameters.

  • kwargs (dict) – Dictionary of variable keyword parameters.

  • x (Tensor) –

返回

Tensor, returns the computed result.

返回类型

Tensor

forward_features(x)[源代码]
参数

x (Tensor) –

返回类型

Tensor

forward_head(x)[源代码]
参数

x (Tensor) –

返回类型

Tensor

class mindcv.models.ShuffleNetV2(num_classes=1000, in_channels=3, model_size='1.5x')[源代码]

基类:Cell

ShuffleNetV2 model class, based on “ShuffleNet V2: Practical Guidelines for Efficient CNN Architecture Design”

参数
  • num_classes (int) – number of classification classes. Default: 1000.

  • in_channels (int) – number of input channels. Default: 3.

  • model_size (str) – scale factor which controls the number of channels. Default: ‘1.5x’.

construct(x)[源代码]

Defines the computation to be performed. This method must be overridden by all subclasses.

备注

It is not supported currently that inputs contain both tuple and non-tuple types at same time.

参数
  • inputs (tuple) – Tuple of variable parameters.

  • kwargs (dict) – Dictionary of variable keyword parameters.

  • x (Tensor) –

返回

Tensor, returns the computed result.

返回类型

Tensor

forward_features(x)[源代码]
参数

x (Tensor) –

返回类型

Tensor

forward_head(x)[源代码]
参数

x (Tensor) –

返回类型

Tensor

class mindcv.models.SqueezeNet(version='1_0', num_classes=1000, drop_rate=0.5, in_channels=3)[源代码]

基类:Cell

SqueezeNet model class, based on “SqueezeNet: AlexNet-level accuracy with 50x fewer parameters and <0.5MB model size”

备注

Important: In contrast to the other models the inception_v3 expects tensors with a size of N x 3 x 227 x 227, so ensure your images are sized accordingly.

参数
  • version (str) – version of the architecture, ‘1_0’ or ‘1_1’. Default: ‘1_0’.

  • num_classes (int) – number of classification classes. Default: 1000.

  • drop_rate (float) – dropout rate of the classifier. Default: 0.5.

  • in_channels (int) – number the channels of the input. Default: 3.

construct(x)[源代码]

Defines the computation to be performed. This method must be overridden by all subclasses.

备注

It is not supported currently that inputs contain both tuple and non-tuple types at same time.

参数
  • inputs (tuple) – Tuple of variable parameters.

  • kwargs (dict) – Dictionary of variable keyword parameters.

  • x (Tensor) –

返回

Tensor, returns the computed result.

返回类型

Tensor

forward_features(x)[源代码]
参数

x (Tensor) –

返回类型

Tensor

forward_head(x)[源代码]
参数

x (Tensor) –

返回类型

Tensor

class mindcv.models.SwinTransformer(image_size=224, patch_size=4, in_chans=3, num_classes=1000, embed_dim=96, depths=None, num_heads=None, window_size=7, mlp_ratio=4.0, qkv_bias=True, qk_scale=None, drop_rate=0.0, attn_drop_rate=0.0, drop_path_rate=0.1, norm_layer=<class 'mindspore.nn.layer.normalization.LayerNorm'>, ape=False, patch_norm=True)[源代码]

基类:Cell

SwinTransformer model class, based on “Swin Transformer: Hierarchical Vision Transformer using Shifted Windows”

参数
  • image_size (int | tuple(int)) – Input image size. Default 224

  • patch_size (int | tuple(int)) – Patch size. Default: 4

  • in_chans (int) – Number of input image channels. Default: 3

  • num_classes (int) – Number of classes for classification head. Default: 1000

  • embed_dim (int) – Patch embedding dimension. Default: 96

  • depths (tuple(int)) – Depth of each Swin Transformer layer.

  • num_heads (tuple(int)) – Number of attention heads in different layers.

  • window_size (int) – Window size. Default: 7

  • mlp_ratio (float) – Ratio of mlp hidden dim to embedding dim. Default: 4

  • qkv_bias (bool) – If True, add a learnable bias to query, key, value. Default: True

  • qk_scale (float) – Override default qk scale of head_dim ** -0.5 if set. Default: None

  • drop_rate (float) – Dropout rate. Default: 0

  • attn_drop_rate (float) – Attention dropout rate. Default: 0

  • drop_path_rate (float) – Stochastic depth rate. Default: 0.1

  • norm_layer (nn.Cell) – Normalization layer. Default: nn.LayerNorm.

  • ape (bool) – If True, add absolute position embedding to the patch embedding. Default: False

  • patch_norm (bool) – If True, add normalization after patch embedding. Default: True

construct(x)[源代码]

Defines the computation to be performed. This method must be overridden by all subclasses.

备注

It is not supported currently that inputs contain both tuple and non-tuple types at same time.

参数
  • inputs (tuple) – Tuple of variable parameters.

  • kwargs (dict) – Dictionary of variable keyword parameters.

  • x (Tensor) –

返回

Tensor, returns the computed result.

返回类型

Tensor

forward_features(x)[源代码]
参数

x (Tensor) –

返回类型

Tensor

forward_head(x)[源代码]
参数

x (Tensor) –

返回类型

Tensor

no_weight_decay()[源代码]
返回类型

None

no_weight_decay_keywords()[源代码]
返回类型

None

class mindcv.models.Swish[源代码]

基类:Cell

Swish activation function: x * sigmoid(x).

参数

None

返回

Tensor

示例

>>> x = Tensor(((20, 16), (50, 50)), mindspore.float32)
>>> Swish()(x)
construct(x)[源代码]

Defines the computation to be performed. This method must be overridden by all subclasses.

备注

It is not supported currently that inputs contain both tuple and non-tuple types at same time.

参数
  • inputs (tuple) – Tuple of variable parameters.

  • kwargs (dict) – Dictionary of variable keyword parameters.

返回

Tensor, returns the computed result.

class mindcv.models.VGG(model_name, batch_norm=False, num_classes=1000, in_channels=3, drop_rate=0.5)[源代码]

基类:Cell

VGGNet model class, based on “Very Deep Convolutional Networks for Large-Scale Image Recognition”

参数
  • model_name (str) – name of the architecture. ‘vgg11’, ‘vgg13’, ‘vgg16’ or ‘vgg19’.

  • batch_norm (bool) – use batch normalization or not. Default: False.

  • num_classes (int) – number of classification classes. Default: 1000.

  • in_channels (int) – number the channels of the input. Default: 3.

  • drop_rate (float) – dropout rate of the classifier. Default: 0.5.

construct(x)[源代码]

Defines the computation to be performed. This method must be overridden by all subclasses.

备注

It is not supported currently that inputs contain both tuple and non-tuple types at same time.

参数
  • inputs (tuple) – Tuple of variable parameters.

  • kwargs (dict) – Dictionary of variable keyword parameters.

  • x (Tensor) –

返回

Tensor, returns the computed result.

返回类型

Tensor

forward_features(x)[源代码]
参数

x (Tensor) –

返回类型

Tensor

forward_head(x)[源代码]
参数

x (Tensor) –

返回类型

Tensor

class mindcv.models.ViT(image_size=224, input_channels=3, patch_size=16, embed_dim=768, num_layers=12, num_heads=12, mlp_dim=3072, keep_prob=1.0, attention_keep_prob=1.0, drop_path_keep_prob=1.0, activation=<class 'mindspore.nn.layer.activation.GELU'>, norm=<class 'mindspore.nn.layer.normalization.LayerNorm'>, pool='cls')[源代码]

基类:Cell

Vision Transformer architecture implementation.

参数
  • image_size (int) – Input image size. Default: 224.

  • input_channels (int) – The number of input channel. Default: 3.

  • patch_size (int) – Patch size of image. Default: 16.

  • embed_dim (int) – The dimension of embedding. Default: 768.

  • num_layers (int) – The depth of transformer. Default: 12.

  • num_heads (int) – The number of attention heads. Default: 12.

  • mlp_dim (int) – The dimension of MLP hidden layer. Default: 3072.

  • keep_prob (float) – The keep rate, greater than 0 and less equal than 1. Default: 1.0.

  • attention_keep_prob (float) – The keep rate for attention layer. Default: 1.0.

  • drop_path_keep_prob (float) – The keep rate for drop path. Default: 1.0.

  • activation (nn.Cell) – Activation function which will be stacked on top of the normalization layer (if not None), otherwise on top of the conv layer. Default: nn.GELU.

  • norm (nn.Cell, optional) – Norm layer that will be stacked on top of the convolution layer. Default: nn.LayerNorm.

  • pool (str) – The method of pooling. Default: ‘cls’.

Inputs:
  • x (Tensor) - Tensor of shape \((N, C_{in}, H_{in}, W_{in})\).

Outputs:

Tensor of shape \((N, 768)\)

抛出

ValueError – If split is not ‘train’, “test or ‘infer’.

参数
  • image_size (int) –

  • input_channels (int) –

  • patch_size (int) –

  • embed_dim (int) –

  • num_layers (int) –

  • num_heads (int) –

  • mlp_dim (int) –

  • keep_prob (float) –

  • attention_keep_prob (float) –

  • drop_path_keep_prob (float) –

  • activation (Cell) –

  • norm (Optional[Cell]) –

  • pool (str) –

Supported Platforms:

GPU

示例

>>> net = ViT()
>>> x = ms.Tensor(np.ones([1, 3, 224, 224]), ms.float32)
>>> output = net(x)
>>> print(output.shape)
(1, 768)

About ViT:

Vision Transformer (ViT) shows that a pure transformer applied directly to sequences of image patches can perform very well on image classification tasks. When pre-trained on large amounts of data and transferred to multiple mid-sized or small image recognition benchmarks (ImageNet, CIFAR-100, VTAB, etc.), Vision Transformer (ViT) attains excellent results compared to state-of-the-art convolutional networks while requiring substantially fewer computational resources to train.

Citation:

@article{2020An,
title={An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale},
author={Dosovitskiy, A. and Beyer, L. and Kolesnikov, A. and Weissenborn, D. and Houlsby, N.},
year={2020},
}
construct(x)[源代码]

ViT construct.

class mindcv.models.Xception(num_classes=1000, in_channels=3)[源代码]

基类:Cell

Xception model architecture from “Deep Learning with Depthwise Separable Convolutions”.

参数
  • num_classes (int) – number of classification classes. Default: 1000.

  • in_channels (int) – number the channels of the input. Default: 3.

construct(x)[源代码]

Defines the computation to be performed. This method must be overridden by all subclasses.

备注

It is not supported currently that inputs contain both tuple and non-tuple types at same time.

参数
  • inputs (tuple) – Tuple of variable parameters.

  • kwargs (dict) – Dictionary of variable keyword parameters.

  • x (Tensor) –

返回

Tensor, returns the computed result.

返回类型

Tensor

forward_features(x)[源代码]

forward the backbone of Xception

参数

x (Tensor) –

返回类型

Tensor

forward_head(x)[源代码]
参数

x (Tensor) –

返回类型

Tensor

mindcv.models.convit_base(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]

Get ConViT base model Refer to the base class “models.ConViT” for more details.

参数
  • pretrained (bool) –

  • num_classes (int) –

  • in_channels (int) –

返回类型

ConViT

mindcv.models.convit_base_plus(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]

Get ConViT base+ model Refer to the base class “models.ConViT” for more details.

参数
  • pretrained (bool) –

  • num_classes (int) –

  • in_channels (int) –

返回类型

ConViT

mindcv.models.convit_small(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]

Get ConViT small model Refer to the base class “models.ConViT” for more details.

参数
  • pretrained (bool) –

  • num_classes (int) –

  • in_channels (int) –

返回类型

ConViT

mindcv.models.convit_small_plus(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]

Get ConViT small+ model Refer to the base class “models.ConViT” for more details.

参数
  • pretrained (bool) –

  • num_classes (int) –

  • in_channels (int) –

返回类型

ConViT

mindcv.models.convit_tiny(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]

Get ConViT tiny model Refer to the base class “models.ConViT” for more details.

参数
  • pretrained (bool) –

  • num_classes (int) –

  • in_channels (int) –

返回类型

ConViT

mindcv.models.convit_tiny_plus(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]

Get ConViT tiny+ model Refer to the base class “models.ConViT” for more details.

参数
  • pretrained (bool) –

  • num_classes (int) –

  • in_channels (int) –

返回类型

ConViT

mindcv.models.convnext_base(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]

Get ConvNeXt base model. Refer to the base class ‘models.ConvNeXt’ for more details.

参数
  • pretrained (bool) –

  • num_classes (int) –

返回类型

ConvNeXt

mindcv.models.convnext_large(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]

Get ConvNeXt large model. Refer to the base class ‘models.ConvNeXt’ for more details.

参数
  • pretrained (bool) –

  • num_classes (int) –

返回类型

ConvNeXt

mindcv.models.convnext_small(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]

Get ConvNeXt small model. Refer to the base class ‘models.ConvNeXt’ for more details.

参数
  • pretrained (bool) –

  • num_classes (int) –

返回类型

ConvNeXt

mindcv.models.convnext_tiny(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]

Get ConvNeXt tiny model. Refer to the base class ‘models.ConvNeXt’ for more details.

参数
  • pretrained (bool) –

  • num_classes (int) –

返回类型

ConvNeXt

mindcv.models.convnext_xlarge(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]

Get ConvNeXt xlarge model. Refer to the base class ‘models.ConvNeXt’ for more details.

参数
  • pretrained (bool) –

  • num_classes (int) –

返回类型

ConvNeXt

mindcv.models.create_model(model_name, num_classes=1000, pretrained=False, in_channels=3, checkpoint_path='', use_ema=False, **kwargs)[源代码]

Creates model by name.

参数
  • model_name (str) – The name of model.

  • num_classes (int) – The number of classes. Default: 1000.

  • pretrained (bool) – Whether to load the pretrained model. Default: False.

  • in_channels (int) – The input channels. Default: 3.

  • checkpoint_path (str) – The path of checkpoint files. Default: “”.

mindcv.models.densenet121(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]

Get 121 layers DenseNet model. Refer to the base class models.DenseNet for more details.

参数
  • pretrained (bool) –

  • num_classes (int) –

返回类型

DenseNet

mindcv.models.densenet161(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]

Get 161 layers DenseNet model. Refer to the base class models.DenseNet for more details.

参数
  • pretrained (bool) –

  • num_classes (int) –

返回类型

DenseNet

mindcv.models.densenet169(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]

Get 169 layers DenseNet model. Refer to the base class models.DenseNet for more details.

参数
  • pretrained (bool) –

  • num_classes (int) –

返回类型

DenseNet

mindcv.models.densenet201(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]

Get 201 layers DenseNet model. Refer to the base class models.DenseNet for more details.

参数
  • pretrained (bool) –

  • num_classes (int) –

返回类型

DenseNet

mindcv.models.dpn107(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]

Get 107 layers DPN model. Refer to the base class models.DPN for more details.

参数
  • pretrained (bool) –

  • num_classes (int) –

返回类型

DPN

mindcv.models.dpn131(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]

Get 131 layers DPN model. Refer to the base class models.DPN for more details.

参数
  • pretrained (bool) –

  • num_classes (int) –

返回类型

DPN

mindcv.models.dpn92(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]

Get 92 layers DPN model. Refer to the base class models.DPN for more details.

参数
  • pretrained (bool) –

  • num_classes (int) –

返回类型

DPN

mindcv.models.dpn98(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]

Get 98 layers DPN model. Refer to the base class models.DPN for more details.

参数
  • pretrained (bool) –

  • num_classes (int) –

返回类型

DPN

mindcv.models.efficientnet_b0(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]

Constructs a EfficientNet B0 architecture from EfficientNet: Rethinking Model Scaling for Convolutional Neural Networks.

参数
  • pretrained (bool) – If True, returns a model pretrained on IMAGENET. Default: False.

  • num_classes (int) – The numbers of classes. Default: 1000.

  • in_channels (int) – The input channels. Default: 1000.

返回类型

EfficientNet

Inputs:
  • x (Tensor) - Tensor of shape \((N, C_{in}, H_{in}, W_{in})\).

Outputs:

Tensor of shape \((N, CLASSES_{out})\).

mindcv.models.efficientnet_b1(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]

Constructs a EfficientNet B1 architecture from EfficientNet: Rethinking Model Scaling for Convolutional Neural Networks.

参数
  • pretrained (bool) – If True, returns a model pretrained on IMAGENET. Default: False.

  • num_classes (int) – The numbers of classes. Default: 1000.

  • in_channels (int) – The input channels. Default: 1000.

返回类型

EfficientNet

Inputs:
  • x (Tensor) - Tensor of shape \((N, C_{in}, H_{in}, W_{in})\).

Outputs:

Tensor of shape \((N, CLASSES_{out})\).

mindcv.models.efficientnet_b2(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]

Constructs a EfficientNet B2 architecture from EfficientNet: Rethinking Model Scaling for Convolutional Neural Networks.

参数
  • pretrained (bool) – If True, returns a model pretrained on IMAGENET. Default: False.

  • num_classes (int) – The numbers of classes. Default: 1000.

  • in_channels (int) – The input channels. Default: 1000.

返回类型

EfficientNet

Inputs:
  • x (Tensor) - Tensor of shape \((N, C_{in}, H_{in}, W_{in})\).

Outputs:

Tensor of shape \((N, CLASSES_{out})\).

mindcv.models.efficientnet_b3(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]

Constructs a EfficientNet B3 architecture from EfficientNet: Rethinking Model Scaling for Convolutional Neural Networks.

参数
  • pretrained (bool) – If True, returns a model pretrained on IMAGENET. Default: False.

  • num_classes (int) – The numbers of classes. Default: 1000.

  • in_channels (int) – The input channels. Default: 1000.

返回类型

EfficientNet

Inputs:
  • x (Tensor) - Tensor of shape \((N, C_{in}, H_{in}, W_{in})\).

Outputs:

Tensor of shape \((N, CLASSES_{out})\).

mindcv.models.efficientnet_b4(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]

Constructs a EfficientNet B4 architecture from EfficientNet: Rethinking Model Scaling for Convolutional Neural Networks.

参数
  • pretrained (bool) – If True, returns a model pretrained on IMAGENET. Default: False.

  • num_classes (int) – The numbers of classes. Default: 1000.

  • in_channels (int) – The input channels. Default: 1000.

返回类型

EfficientNet

Inputs:
  • x (Tensor) - Tensor of shape \((N, C_{in}, H_{in}, W_{in})\).

Outputs:

Tensor of shape \((N, CLASSES_{out})\).

mindcv.models.efficientnet_b5(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]

Constructs a EfficientNet B5 architecture from EfficientNet: Rethinking Model Scaling for Convolutional Neural Networks.

参数
  • pretrained (bool) – If True, returns a model pretrained on IMAGENET. Default: False.

  • num_classes (int) – The numbers of classes. Default: 1000.

  • in_channels (int) – The input channels. Default: 1000.

返回类型

EfficientNet

Inputs:
  • x (Tensor) - Tensor of shape \((N, C_{in}, H_{in}, W_{in})\).

Outputs:

Tensor of shape \((N, CLASSES_{out})\).

mindcv.models.efficientnet_b6(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]

Constructs a EfficientNet B6 architecture from EfficientNet: Rethinking Model Scaling for Convolutional Neural Networks.

参数
  • pretrained (bool) – If True, returns a model pretrained on IMAGENET. Default: False.

  • num_classes (int) – The numbers of classes. Default: 1000.

  • in_channels (int) – The input channels. Default: 1000.

返回类型

EfficientNet

Inputs:
  • x (Tensor) - Tensor of shape \((N, C_{in}, H_{in}, W_{in})\).

Outputs:

Tensor of shape \((N, CLASSES_{out})\).

mindcv.models.efficientnet_b7(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]

Constructs a EfficientNet B7 architecture from EfficientNet: Rethinking Model Scaling for Convolutional Neural Networks.

参数
  • pretrained (bool) – If True, returns a model pretrained on IMAGENET. Default: False.

  • num_classes (int) – The numbers of classes. Default: 1000.

  • in_channels (int) – The input channels. Default: 1000.

返回类型

EfficientNet

Inputs:
  • x (Tensor) - Tensor of shape \((N, C_{in}, H_{in}, W_{in})\).

Outputs:

Tensor of shape \((N, CLASSES_{out})\).

mindcv.models.efficientnet_v2_l(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]

Constructs a EfficientNet B4 architecture from EfficientNet: Rethinking Model Scaling for Convolutional Neural Networks.

参数
  • pretrained (bool) – If True, returns a model pretrained on IMAGENET. Default: False.

  • num_classes (int) – The numbers of classes. Default: 1000.

  • in_channels (int) – The input channels. Default: 1000.

返回类型

EfficientNet

Inputs:
  • x (Tensor) - Tensor of shape \((N, C_{in}, H_{in}, W_{in})\).

Outputs:

Tensor of shape \((N, CLASSES_{out})\).

mindcv.models.efficientnet_v2_m(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]

Constructs a EfficientNet B4 architecture from EfficientNet: Rethinking Model Scaling for Convolutional Neural Networks.

参数
  • pretrained (bool) – If True, returns a model pretrained on IMAGENET. Default: False.

  • num_classes (int) – The numbers of classes. Default: 1000.

  • in_channels (int) – The input channels. Default: 1000.

返回类型

EfficientNet

Inputs:
  • x (Tensor) - Tensor of shape \((N, C_{in}, H_{in}, W_{in})\).

Outputs:

Tensor of shape \((N, CLASSES_{out})\).

mindcv.models.efficientnet_v2_s(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]

Constructs a EfficientNet B4 architecture from EfficientNet: Rethinking Model Scaling for Convolutional Neural Networks.

参数
  • pretrained (bool) – If True, returns a model pretrained on IMAGENET. Default: False.

  • num_classes (int) – The numbers of classes. Default: 1000.

  • in_channels (int) – The input channels. Default: 1000.

返回类型

EfficientNet

Inputs:
  • x (Tensor) - Tensor of shape \((N, C_{in}, H_{in}, W_{in})\).

Outputs:

Tensor of shape \((N, CLASSES_{out})\).

mindcv.models.efficientnet_v2_xl(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]

Constructs a EfficientNet B4 architecture from EfficientNet: Rethinking Model Scaling for Convolutional Neural Networks.

参数
  • pretrained (bool) – If True, returns a model pretrained on IMAGENET. Default: False.

  • num_classes (int) – The numbers of classes. Default: 1000.

  • in_channels (int) – The input channels. Default: 1000.

返回类型

EfficientNet

Inputs:
  • x (Tensor) - Tensor of shape \((N, C_{in}, H_{in}, W_{in})\).

Outputs:

Tensor of shape \((N, CLASSES_{out})\).

mindcv.models.ghostnet_1x(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]

Get GhostNet model. Refer to the base class ‘models.GhostNet’ for more details.

参数
  • pretrained (bool) –

  • num_classes (int) –

  • in_channels (int) –

返回类型

GhostNet

mindcv.models.ghostnet_nose_1x(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]

Get GhostNet model without SEModule. Refer to the base class ‘models.GhostNet’ for more details.

参数
  • pretrained (bool) –

  • num_classes (int) –

  • in_channels (int) –

返回类型

GhostNet

mindcv.models.googlenet(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]

Get GoogLeNet model. Refer to the base class models.GoogLeNet for more details.

参数
  • pretrained (bool) –

  • num_classes (int) –

返回类型

GoogLeNet

mindcv.models.inception_v3(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]

Get InceptionV3 model. Refer to the base class models.InceptionV3 for more details.

参数
  • pretrained (bool) –

  • num_classes (int) –

返回类型

InceptionV3

mindcv.models.inception_v4(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]

Get InceptionV4 model. Refer to the base class models.InceptionV4 for more details.

参数
  • pretrained (bool) –

  • num_classes (int) –

返回类型

InceptionV4

mindcv.models.is_model(model_name)[源代码]

Check if a model name exists

mindcv.models.is_model_in_modules(model_name, module_names)[源代码]

Check if a model exists within a subset of modules :param model_name: :type model_name: str :param module_names: :type module_names: tuple, list, set

mindcv.models.is_model_pretrained(model_name)[源代码]
mindcv.models.list_models(filter='', module='', pretrained=False, exclude_filters='')[源代码]
mindcv.models.list_modules()[源代码]

Return list of module names that contain models / model entrypoints

mindcv.models.mnasnet0_5(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]

Get MnasNet model with width scaled by 0.5. Refer to the base class models.Mnasnet for more details.

参数
  • pretrained (bool) –

  • num_classes (int) –

返回类型

Mnasnet

mindcv.models.mnasnet0_75(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]

Get MnasNet model with width scaled by 0.75. Refer to the base class models.Mnasnet for more details.

参数
  • pretrained (bool) –

  • num_classes (int) –

返回类型

Mnasnet

mindcv.models.mnasnet1_0(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]

Get MnasNet model with width scaled by 1.0. Refer to the base class models.Mnasnet for more details.

参数
  • pretrained (bool) –

  • num_classes (int) –

返回类型

Mnasnet

mindcv.models.mnasnet1_3(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]

Get MnasNet model with width scaled by 1.3. Refer to the base class models.Mnasnet for more details.

参数
  • pretrained (bool) –

  • num_classes (int) –

返回类型

Mnasnet

mindcv.models.mnasnet1_4(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]

Get MnasNet model with width scaled by 1.4. Refer to the base class models.Mnasnet for more details.

参数
  • pretrained (bool) –

  • num_classes (int) –

返回类型

Mnasnet

mindcv.models.mobilenet_v1_025_224(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]

Get MobileNetV1 model with width scaled by 0.25. Refer to the base class models.MobileNetV1 for more details.

参数
  • pretrained (bool) –

  • num_classes (int) –

返回类型

MobileNetV1

mindcv.models.mobilenet_v1_050_224(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]

Get MobileNetV1 model with width scaled by 0.5. Refer to the base class models.MobileNetV1 for more details.

参数
  • pretrained (bool) –

  • num_classes (int) –

返回类型

MobileNetV1

mindcv.models.mobilenet_v1_075_224(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]

Get MobileNetV1 model with width scaled by 0.75. Refer to the base class models.MobileNetV1 for more details.

参数
  • pretrained (bool) –

  • num_classes (int) –

返回类型

MobileNetV1

mindcv.models.mobilenet_v1_100_224(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]

Get MobileNetV1 model without width scaling. Refer to the base class models.MobileNetV1 for more details.

参数
  • pretrained (bool) –

  • num_classes (int) –

返回类型

MobileNetV1

mindcv.models.mobilenet_v2_035_128(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]

Get MobileNetV2 model with width scaled by 0.35 and input image size of 128. Refer to the base class models.MobileNetV2 for more details.

参数
  • pretrained (bool) –

  • num_classes (int) –

返回类型

MobileNetV2

mindcv.models.mobilenet_v2_035_160(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]

Get MobileNetV2 model with width scaled by 0.35 and input image size of 160. Refer to the base class models.MobileNetV2 for more details.

参数
  • pretrained (bool) –

  • num_classes (int) –

返回类型

MobileNetV2

mindcv.models.mobilenet_v2_035_192(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]

Get MobileNetV2 model with width scaled by 0.35 and input image size of 192. Refer to the base class models.MobileNetV2 for more details.

参数
  • pretrained (bool) –

  • num_classes (int) –

返回类型

MobileNetV2

mindcv.models.mobilenet_v2_035_224(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]

Get MobileNetV2 model with width scaled by 0.35 and input image size of 224. Refer to the base class models.MobileNetV2 for more details.

参数
  • pretrained (bool) –

  • num_classes (int) –

返回类型

MobileNetV2

mindcv.models.mobilenet_v2_035_96(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]

Get MobileNetV2 model with width scaled by 0.35 and input image size of 96. Refer to the base class models.MobileNetV2 for more details.

参数
  • pretrained (bool) –

  • num_classes (int) –

返回类型

MobileNetV2

mindcv.models.mobilenet_v2_050_128(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]

Get MobileNetV2 model with width scaled by 0.5 and input image size of 128. Refer to the base class models.MobileNetV2 for more details.

参数
  • pretrained (bool) –

  • num_classes (int) –

返回类型

MobileNetV2

mindcv.models.mobilenet_v2_050_160(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]

Get MobileNetV2 model with width scaled by 0.5 and input image size of 160. Refer to the base class models.MobileNetV2 for more details.

参数
  • pretrained (bool) –

  • num_classes (int) –

返回类型

MobileNetV2

mindcv.models.mobilenet_v2_050_192(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]

Get MobileNetV2 model with width scaled by 0.5 and input image size of 192. Refer to the base class models.MobileNetV2 for more details.

参数
  • pretrained (bool) –

  • num_classes (int) –

返回类型

MobileNetV2

mindcv.models.mobilenet_v2_050_224(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]

Get MobileNetV2 model with width scaled by 0.5 and input image size of 224. Refer to the base class models.MobileNetV2 for more details.

参数
  • pretrained (bool) –

  • num_classes (int) –

返回类型

MobileNetV2

mindcv.models.mobilenet_v2_050_96(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]

Get MobileNetV2 model with width scaled by 0.5 and input image size of 96. Refer to the base class models.MobileNetV2 for more details.

参数
  • pretrained (bool) –

  • num_classes (int) –

返回类型

MobileNetV2

mindcv.models.mobilenet_v2_075_128(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]

Get MobileNetV2 model with width scaled by 0.75 and input image size of 128. Refer to the base class models.MobileNetV2 for more details.

参数
  • pretrained (bool) –

  • num_classes (int) –

返回类型

MobileNetV2

mindcv.models.mobilenet_v2_075_160(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]

Get MobileNetV2 model with width scaled by 0.75 and input image size of 160. Refer to the base class models.MobileNetV2 for more details.

参数
  • pretrained (bool) –

  • num_classes (int) –

返回类型

MobileNetV2

mindcv.models.mobilenet_v2_075_192(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]

Get MobileNetV2 model with width scaled by 0.75 and input image size of 192. Refer to the base class models.MobileNetV2 for more details.

参数
  • pretrained (bool) –

  • num_classes (int) –

返回类型

MobileNetV2

mindcv.models.mobilenet_v2_075_224(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]

Get MobileNetV2 model with width scaled by 0.75 and input image size of 224. Refer to the base class models.MobileNetV2 for more details.

参数
  • pretrained (bool) –

  • num_classes (int) –

返回类型

MobileNetV2

mindcv.models.mobilenet_v2_075_96(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]

Get MobileNetV2 model with width scaled by 0.75 and input image size of 96. Refer to the base class models.MobileNetV2 for more details.

参数
  • pretrained (bool) –

  • num_classes (int) –

返回类型

MobileNetV2

mindcv.models.mobilenet_v2_100_128(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]

Get MobileNetV2 model without width scaling and input image size of 128. Refer to the base class models.MobileNetV2 for more details.

参数
  • pretrained (bool) –

  • num_classes (int) –

返回类型

MobileNetV2

mindcv.models.mobilenet_v2_100_160(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]

Get MobileNetV2 model without width scaling and input image size of 160. Refer to the base class models.MobileNetV2 for more details.

参数
  • pretrained (bool) –

  • num_classes (int) –

返回类型

MobileNetV2

mindcv.models.mobilenet_v2_100_192(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]

Get MobileNetV2 model without width scaling and input image size of 192. Refer to the base class models.MobileNetV2 for more details.

参数
  • pretrained (bool) –

  • num_classes (int) –

返回类型

MobileNetV2

mindcv.models.mobilenet_v2_100_224(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]

Get MobileNetV2 model without width scaling and input image size of 224. Refer to the base class models.MobileNetV2 for more details.

参数
  • pretrained (bool) –

  • num_classes (int) –

返回类型

MobileNetV2

mindcv.models.mobilenet_v2_100_96(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]

Get MobileNetV2 model without width scaling and input image size of 96. Refer to the base class models.MobileNetV2 for more details.

参数
  • pretrained (bool) –

  • num_classes (int) –

返回类型

MobileNetV2

mindcv.models.mobilenet_v2_130_224(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]

Get MobileNetV2 model with width scaled by 1.3 and input image size of 224. Refer to the base class models.MobileNetV2 for more details.

参数
  • pretrained (bool) –

  • num_classes (int) –

返回类型

MobileNetV2

mindcv.models.mobilenet_v2_140_224(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]

Get MobileNetV2 model with width scaled by 1.4 and input image size of 224. Refer to the base class models.MobileNetV2 for more details.

参数
  • pretrained (bool) –

  • num_classes (int) –

返回类型

MobileNetV2

mindcv.models.mobilenet_v3_large_075(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]

Get large MobileNetV3 model with width scaled by 0.75. Refer to the base class models.MobileNetV3 for more details.

参数
  • pretrained (bool) –

  • num_classes (int) –

返回类型

MobileNetV3

mindcv.models.mobilenet_v3_large_100(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]

Get large MobileNetV3 model without width scaling. Refer to the base class models.MobileNetV3 for more details.

参数
  • pretrained (bool) –

  • num_classes (int) –

返回类型

MobileNetV3

mindcv.models.mobilenet_v3_small_075(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]

Get small MobileNetV3 model with width scaled by 0.75. Refer to the base class models.MobileNetV3 for more details.

参数
  • pretrained (bool) –

  • num_classes (int) –

返回类型

MobileNetV3

mindcv.models.mobilenet_v3_small_100(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]

Get small MobileNetV3 model without width scaling. Refer to the base class models.MobileNetV3 for more details.

参数
  • pretrained (bool) –

  • num_classes (int) –

返回类型

MobileNetV3

mindcv.models.model_entrypoint(model_name)[源代码]

Fetch a model entrypoint for specified model name

mindcv.models.nasnet(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]

Get NasNet model. Refer to the base class models.NASNetAMobile for more details.

参数
  • pretrained (bool) –

  • num_classes (int) –

  • in_channels (int) –

返回类型

NASNetAMobile

mindcv.models.pnasnet(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]

Get Pnasnet model. Refer to the base class models.Pnasnet for more details.

参数
  • pretrained (bool) –

  • num_classes (int) –

  • in_channels (int) –

返回类型

Pnasnet

mindcv.models.regnet_x_12gf(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]
参数
  • pretrained (bool) –

  • num_classes (int) –

mindcv.models.regnet_x_16gf(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]
参数
  • pretrained (bool) –

  • num_classes (int) –

mindcv.models.regnet_x_1_6gf(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]
参数
  • pretrained (bool) –

  • num_classes (int) –

mindcv.models.regnet_x_200mf(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]
参数
  • pretrained (bool) –

  • num_classes (int) –

mindcv.models.regnet_x_32gf(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]
参数
  • pretrained (bool) –

  • num_classes (int) –

mindcv.models.regnet_x_3_2gf(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]
参数
  • pretrained (bool) –

  • num_classes (int) –

mindcv.models.regnet_x_400mf(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]
参数
  • pretrained (bool) –

  • num_classes (int) –

mindcv.models.regnet_x_4_0gf(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]
参数
  • pretrained (bool) –

  • num_classes (int) –

mindcv.models.regnet_x_600mf(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]
参数
  • pretrained (bool) –

  • num_classes (int) –

mindcv.models.regnet_x_6_4gf(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]
参数
  • pretrained (bool) –

  • num_classes (int) –

mindcv.models.regnet_x_800mf(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]
参数
  • pretrained (bool) –

  • num_classes (int) –

mindcv.models.regnet_x_8_0gf(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]
参数
  • pretrained (bool) –

  • num_classes (int) –

mindcv.models.regnet_y_12gf(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]
参数
  • pretrained (bool) –

  • num_classes (int) –

mindcv.models.regnet_y_16gf(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]
参数
  • pretrained (bool) –

  • num_classes (int) –

mindcv.models.regnet_y_1_6gf(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]
参数
  • pretrained (bool) –

  • num_classes (int) –

mindcv.models.regnet_y_200mf(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]
参数
  • pretrained (bool) –

  • num_classes (int) –

mindcv.models.regnet_y_32gf(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]
参数
  • pretrained (bool) –

  • num_classes (int) –

mindcv.models.regnet_y_3_2gf(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]
参数
  • pretrained (bool) –

  • num_classes (int) –

mindcv.models.regnet_y_400mf(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]
参数
  • pretrained (bool) –

  • num_classes (int) –

mindcv.models.regnet_y_4_0gf(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]
参数
  • pretrained (bool) –

  • num_classes (int) –

mindcv.models.regnet_y_600mf(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]
参数
  • pretrained (bool) –

  • num_classes (int) –

mindcv.models.regnet_y_6_4gf(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]
参数
  • pretrained (bool) –

  • num_classes (int) –

mindcv.models.regnet_y_800mf(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]
参数
  • pretrained (bool) –

  • num_classes (int) –

mindcv.models.regnet_y_8_0gf(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]
参数
  • pretrained (bool) –

  • num_classes (int) –

mindcv.models.repvgg(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]

Get RepVGG model with num_blocks=[2, 4, 14, 1], width_multiplier=[0.75, 0.75, 0.75, 2.5]. Refer to the base class models.RepVGG for more details.

参数
  • pretrained (bool) –

  • num_classes (int) –

返回类型

RepVGG

mindcv.models.res2net101(pretrained=False, num_classes=1001, in_channels=3, **kwargs)[源代码]

Get 101 layers Res2Net model. Refer to the base class models.Res2Net for more details.

参数
  • pretrained (bool) –

  • num_classes (int) –

mindcv.models.res2net101_v1b(pretrained=False, num_classes=1001, in_channels=3, **kwargs)[源代码]
参数
  • pretrained (bool) –

  • num_classes (int) –

mindcv.models.res2net152(pretrained=False, num_classes=1001, in_channels=3, **kwargs)[源代码]

Get 152 layers Res2Net model. Refer to the base class models.Res2Net for more details.

参数
  • pretrained (bool) –

  • num_classes (int) –

mindcv.models.res2net152_v1b(pretrained=False, num_classes=1001, in_channels=3, **kwargs)[源代码]
参数
  • pretrained (bool) –

  • num_classes (int) –

mindcv.models.res2net50(pretrained=False, num_classes=1001, in_channels=3, **kwargs)[源代码]

Get 50 layers Res2Net model. Refer to the base class models.Res2Net for more details.

参数
  • pretrained (bool) –

  • num_classes (int) –

mindcv.models.res2net50_v1b(pretrained=False, num_classes=1001, in_channels=3, **kwargs)[源代码]
参数
  • pretrained (bool) –

  • num_classes (int) –

mindcv.models.resnet101(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]

Get 101 layers ResNet model. Refer to the base class models.ResNet for more details.

参数
  • pretrained (bool) –

  • num_classes (int) –

mindcv.models.resnet152(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]

Get 152 layers ResNet model. Refer to the base class models.ResNet for more details.

参数
  • pretrained (bool) –

  • num_classes (int) –

mindcv.models.resnet18(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]

Get 18 layers ResNet model. Refer to the base class models.ResNet for more details.

参数
  • pretrained (bool) –

  • num_classes (int) –

mindcv.models.resnet34(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]

Get 34 layers ResNet model. Refer to the base class models.ResNet for more details.

参数
  • pretrained (bool) –

  • num_classes (int) –

mindcv.models.resnet50(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]

Get 50 layers ResNet model. Refer to the base class models.ResNet for more details.

参数
  • pretrained (bool) –

  • num_classes (int) –

mindcv.models.resnext101_32x4d(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]

Get 101 layers ResNeXt model with 32 groups of GPConv. Refer to the base class models.ResNet for more details.

参数
  • pretrained (bool) –

  • num_classes (int) –

mindcv.models.resnext101_64x4d(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]

Get 101 layers ResNeXt model with 64 groups of GPConv. Refer to the base class models.ResNet for more details.

参数
  • pretrained (bool) –

  • num_classes (int) –

mindcv.models.resnext152_64x4d(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]
参数
  • pretrained (bool) –

  • num_classes (int) –

mindcv.models.resnext50_32x4d(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]

Get 50 layers ResNeXt model with 32 groups of GPConv. Refer to the base class models.ResNet for more details.

参数
  • pretrained (bool) –

  • num_classes (int) –

mindcv.models.rexnet_x09(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]

Get ReXNet model with width multiplier of 0.9. Refer to the base class models.ReXNetV1 for more details.

参数
  • pretrained (bool) –

  • num_classes (int) –

返回类型

ReXNetV1

mindcv.models.rexnet_x10(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]

Get ReXNet model with width multiplier of 1.0. Refer to the base class models.ReXNetV1 for more details.

参数
  • pretrained (bool) –

  • num_classes (int) –

返回类型

ReXNetV1

mindcv.models.rexnet_x13(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]

Get ReXNet model with width multiplier of 1.3. Refer to the base class models.ReXNetV1 for more details.

参数
  • pretrained (bool) –

  • num_classes (int) –

返回类型

ReXNetV1

mindcv.models.rexnet_x15(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]

Get ReXNet model with width multiplier of 1.5. Refer to the base class models.ReXNetV1 for more details.

参数
  • pretrained (bool) –

  • num_classes (int) –

返回类型

ReXNetV1

mindcv.models.rexnet_x20(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]

Get ReXNet model with width multiplier of 2.0. Refer to the base class models.ReXNetV1 for more details.

参数
  • pretrained (bool) –

  • num_classes (int) –

返回类型

ReXNetV1

mindcv.models.shufflenet_v1_g3_x0_5(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]

Get ShuffleNetV1 model with width scaled by 0.5 and 3 groups of GPConv. Refer to the base class models.ShuffleNetV1 for more details.

参数
  • pretrained (bool) –

  • num_classes (int) –

返回类型

ShuffleNetV1

mindcv.models.shufflenet_v1_g3_x1_0(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]

Get ShuffleNetV1 model with width scaled by 1.0 and 3 groups of GPConv. Refer to the base class models.ShuffleNetV1 for more details.

参数
  • pretrained (bool) –

  • num_classes (int) –

返回类型

ShuffleNetV1

mindcv.models.shufflenet_v1_g3_x1_5(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]

Get ShuffleNetV1 model with width scaled by 1.5 and 3 groups of GPConv. Refer to the base class models.ShuffleNetV1 for more details.

参数
  • pretrained (bool) –

  • num_classes (int) –

返回类型

ShuffleNetV1

mindcv.models.shufflenet_v1_g3_x2_0(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]

Get ShuffleNetV1 model with width scaled by 2.0 and 3 groups of GPConv. Refer to the base class models.ShuffleNetV1 for more details.

参数
  • pretrained (bool) –

  • num_classes (int) –

返回类型

ShuffleNetV1

mindcv.models.shufflenet_v1_g8_x0_5(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]

Get ShuffleNetV1 model with width scaled by 0.5 and 8 groups of GPConv. Refer to the base class models.ShuffleNetV1 for more details.

参数
  • pretrained (bool) –

  • num_classes (int) –

返回类型

ShuffleNetV1

mindcv.models.shufflenet_v1_g8_x1_0(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]

Get ShuffleNetV1 model with width scaled by 1.0 and 8 groups of GPConv. Refer to the base class models.ShuffleNetV1 for more details.

参数
  • pretrained (bool) –

  • num_classes (int) –

返回类型

ShuffleNetV1

mindcv.models.shufflenet_v1_g8_x1_5(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]

Get ShuffleNetV1 model with width scaled by 1.5 and 8 groups of GPConv. Refer to the base class models.ShuffleNetV1 for more details.

参数
  • pretrained (bool) –

  • num_classes (int) –

返回类型

ShuffleNetV1

mindcv.models.shufflenet_v1_g8_x2_0(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]

Get ShuffleNetV1 model with width scaled by 2.0 and 8 groups of GPConv. Refer to the base class models.ShuffleNetV1 for more details.

参数
  • pretrained (bool) –

  • num_classes (int) –

返回类型

ShuffleNetV1

mindcv.models.shufflenet_v2_x0_5(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]

Get ShuffleNetV2 model with width scaled by 0.5. Refer to the base class models.ShuffleNetV2 for more details.

参数
  • pretrained (bool) –

  • num_classes (int) –

返回类型

ShuffleNetV2

mindcv.models.shufflenet_v2_x1_0(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]

Get ShuffleNetV2 model with width scaled by 1.0. Refer to the base class models.ShuffleNetV2 for more details.

参数
  • pretrained (bool) –

  • num_classes (int) –

返回类型

ShuffleNetV2

mindcv.models.shufflenet_v2_x1_5(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]

Get ShuffleNetV2 model with width scaled by 1.5. Refer to the base class models.ShuffleNetV2 for more details.

参数
  • pretrained (bool) –

  • num_classes (int) –

返回类型

ShuffleNetV2

mindcv.models.shufflenet_v2_x2_0(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]

Get ShuffleNetV2 model with width scaled by 2.0. Refer to the base class models.ShuffleNetV2 for more details.

参数
  • pretrained (bool) –

  • num_classes (int) –

返回类型

ShuffleNetV2

mindcv.models.sk_resnet18(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]

Get 18 layers SKNet model. Refer to the base class models.SKNet for more details.

参数
  • pretrained (bool) –

  • num_classes (int) –

返回类型

ResNet

mindcv.models.sk_resnet34(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]

Get 34 layers SKNet model. Refer to the base class models.SKNet for more details.

参数
  • pretrained (bool) –

  • num_classes (int) –

返回类型

ResNet

mindcv.models.sk_resnet50(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]

Get 50 layers SKNet model. Refer to the base class models.SKNet for more details.

参数
  • pretrained (bool) –

  • num_classes (int) –

返回类型

ResNet

mindcv.models.sk_resnext50_32x4d(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]

Get 50 layers SKNeXt model with 32 groups of GPConv. Refer to the base class models.SKNet for more details.

参数
  • pretrained (bool) –

  • num_classes (int) –

返回类型

ResNet

mindcv.models.squeezenet1_0(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]

Get SqueezeNet model of version 1.0. Refer to the base class models.SqueezeNet for more details.

参数
  • pretrained (bool) –

  • num_classes (int) –

返回类型

SqueezeNet

mindcv.models.squeezenet1_1(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]

Get SqueezeNet model of version 1.1. Refer to the base class models.SqueezeNet for more details.

参数
  • pretrained (bool) –

  • num_classes (int) –

返回类型

SqueezeNet

mindcv.models.swin_tiny(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]

Get SwinTransformer tiny model. Refer to the base class ‘models.SwinTransformer’ for more details.

参数
  • pretrained (bool) –

  • num_classes (int) –

返回类型

SwinTransformer

mindcv.models.vgg11(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]

Get 11 layers VGG model. Refer to the base class models.VGG for more details.

参数
  • pretrained (bool) –

  • num_classes (int) –

返回类型

VGG

mindcv.models.vgg13(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]

Get 13 layers VGG model. Refer to the base class models.VGG for more details.

参数
  • pretrained (bool) –

  • num_classes (int) –

返回类型

VGG

mindcv.models.vgg16(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]

Get 16 layers VGG model. Refer to the base class models.VGG for more details.

参数
  • pretrained (bool) –

  • num_classes (int) –

返回类型

VGG

mindcv.models.vgg19(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]

Get 19 layers VGG model. Refer to the base class models.VGG for more details.

参数
  • pretrained (bool) –

  • num_classes (int) –

返回类型

VGG

mindcv.models.vit_b_16_224(pretrained=False, num_classes=1000, in_channels=3, image_size=224, has_logits=False, drop_rate=0.0, drop_path_rate=0.0)[源代码]

Constructs a vit_b_16 architecture from An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale.

参数
  • image_size (int) – The input image size. Default: 224 for ImageNet.

  • num_classes (int) – The number of classification. Default: 1000.

  • has_logits (bool) – Whether has logits or not. Default: False.

  • pretrained (bool) – Whether to download and load the pre-trained model. Default: False.

  • drop_rate (float) – The drop out rate. Default: 0.0.

  • attention_dropout (float) – The attention dropout rate. Default: 0.0.

  • drop_path_rate (float) – The stochastic depth rate. Default: 0.0.

  • in_channels (int) –

返回

ViT network, MindSpore.nn.Cell

返回类型

ViT

Inputs:
  • x (Tensor) - Tensor of shape \((N, C_{in}, H_{in}, W_{in})\).

示例

>>> net = vit_b_16_224()
>>> x = ms.Tensor(np.ones([1, 3, 224, 224]), ms.float32)
>>> output = net(x)
>>> print(output.shape)
(1, 1000)
Outputs:

Tensor of shape \((N, CLASSES_{out})\)

Supported Platforms:

GPU

mindcv.models.vit_b_16_384(pretrained=False, num_classes=1000, in_channels=3, image_size=384, has_logits=False, drop_rate=0.0, drop_path_rate=0.0)[源代码]

construct and return a ViT network

参数
  • pretrained (bool) –

  • num_classes (int) –

  • in_channels (int) –

  • image_size (int) –

  • has_logits (bool) –

  • drop_rate (float) –

  • drop_path_rate (float) –

返回类型

ViT

mindcv.models.vit_b_32_224(pretrained=False, num_classes=1000, in_channels=3, image_size=224, has_logits=False, drop_rate=0.0, drop_path_rate=0.0)[源代码]

construct and return a ViT network

参数
  • pretrained (bool) –

  • num_classes (int) –

  • in_channels (int) –

  • image_size (int) –

  • has_logits (bool) –

  • drop_rate (float) –

  • drop_path_rate (float) –

返回类型

ViT

mindcv.models.vit_b_32_384(pretrained=False, num_classes=1000, in_channels=3, image_size=384, has_logits=False, drop_rate=0.0, drop_path_rate=0.0)[源代码]

construct and return a ViT network

参数
  • pretrained (bool) –

  • num_classes (int) –

  • in_channels (int) –

  • image_size (int) –

  • has_logits (bool) –

  • drop_rate (float) –

  • drop_path_rate (float) –

返回类型

ViT

mindcv.models.vit_l_16_224(pretrained=False, num_classes=1000, in_channels=3, image_size=224, has_logits=False, drop_rate=0.0, drop_path_rate=0.0)[源代码]

construct and return a ViT network

参数
  • pretrained (bool) –

  • num_classes (int) –

  • in_channels (int) –

  • image_size (int) –

  • has_logits (bool) –

  • drop_rate (float) –

  • drop_path_rate (float) –

返回类型

ViT

mindcv.models.vit_l_16_384(pretrained=False, num_classes=1000, in_channels=3, image_size=384, has_logits=False, drop_rate=0.0, drop_path_rate=0.0)[源代码]

construct and return a ViT network

参数
  • pretrained (bool) –

  • num_classes (int) –

  • in_channels (int) –

  • image_size (int) –

  • has_logits (bool) –

  • drop_rate (float) –

  • drop_path_rate (float) –

返回类型

ViT

mindcv.models.vit_l_32_224(pretrained=False, num_classes=1000, in_channels=3, image_size=224, has_logits=False, drop_rate=0.0, drop_path_rate=0.0)[源代码]

construct and return a ViT network

参数
  • pretrained (bool) –

  • num_classes (int) –

  • in_channels (int) –

  • image_size (int) –

  • has_logits (bool) –

  • drop_rate (float) –

  • drop_path_rate (float) –

返回类型

ViT

mindcv.models.xception(pretrained=False, num_classes=1000, in_channels=3, **kwargs)[源代码]

Get Xception model. Refer to the base class models.Xception for more details.

参数
  • pretrained (bool) –

  • num_classes (int) –

  • in_channels (int) –

返回类型

Xception