## 图像识别的流程

### 网络结构

import paddle

# 单层线性网络
model=nn.Linear(in_features=1*28*28, out_features=10)  # 定义线性网络

---------------------------------------------------------------------------
Layer (type)       Input Shape          Output Shape         Param #
===========================================================================
Linear-3           [[784]]                [10]              7,850
===========================================================================
Total params: 7,850
Trainable params: 7,850
Non-trainable params: 0
---------------------------------------------------------------------------
Input size (MB): 0.00
Forward/backward pass size (MB): 0.00
Params size (MB): 0.03
Estimated Total Size (MB): 0.03
---------------------------------------------------------------------------

{'total_params': 7850, 'trainable_params': 7850}

# DNN
def __init__(self):
super(MyDNN,self).__init__()
self.hidden1 = Linear(28,100)
self.hidden2 = Linear(100,100)
self.hidden3 = Linear(100,28)
self.hidden4 = Linear(1*28*28,10)

def forward(self,input):
# print(input.shape)
x = self.hidden1(input)
x =F.relu(x)
# print(x.shape)
x = self.hidden2(x)
x = F.relu(x)
# print(x.shape)
x = self.hidden3(x)
x = F.relu(x)
# print(x.shape)
x = self.hidden4(x)
y = F.softmax(x)
# print(y.shape)
return y

network = MyDNN()

---------------------------------------------------------------------------
Layer (type)       Input Shape          Output Shape         Param #
===========================================================================
Linear-8        [[1, 28, 28]]         [1, 28, 100]          2,900
Linear-9        [[1, 28, 100]]        [1, 28, 100]         10,100
Linear-10       [[1, 28, 100]]        [1, 28, 28]           2,828
Linear-11         [[1, 784]]            [1, 10]             7,850
===========================================================================
Total params: 23,678
Trainable params: 23,678
Non-trainable params: 0
---------------------------------------------------------------------------
Input size (MB): 0.00
Forward/backward pass size (MB): 0.05
Params size (MB): 0.09
Estimated Total Size (MB): 0.14
---------------------------------------------------------------------------

{'total_params': 23678, 'trainable_params': 23678}


### CNN说明

network = nn.Sequential(
nn.Conv2D(in_channels=1, out_channels=6, kernel_size=3, stride=1, padding=1),  # 卷积
nn.ReLU(),  # 激活函数
nn.MaxPool2D(kernel_size=2, stride=2),  # 最大池化
nn.ReLU(),
nn.MaxPool2D(kernel_size=2, stride=2),
nn.Flatten(),
nn.Linear(in_features=400, out_features=120),  # 400 = 5x5x16，输入形状为32x32， 输入形状为28x28时调整为256
nn.Linear(in_features=120, out_features=84),
nn.Linear(in_features=84, out_features=10)
)

---------------------------------------------------------------------------
Layer (type)       Input Shape          Output Shape         Param #
===========================================================================
Conv2D-12      [[1, 1, 28, 28]]      [1, 6, 28, 28]          60
ReLU-3        [[1, 6, 28, 28]]      [1, 6, 28, 28]           0
MaxPool2D-3     [[1, 6, 28, 28]]      [1, 6, 14, 14]           0
Conv2D-13      [[1, 6, 14, 14]]     [1, 16, 10, 10]         2,416
ReLU-4       [[1, 16, 10, 10]]     [1, 16, 10, 10]           0
MaxPool2D-4    [[1, 16, 10, 10]]      [1, 16, 5, 5]            0
Flatten-5      [[1, 16, 5, 5]]          [1, 400]              0
Linear-21         [[1, 400]]            [1, 120]           48,120
Linear-22         [[1, 120]]            [1, 84]            10,164
Linear-23         [[1, 84]]             [1, 10]              850
===========================================================================
Total params: 61,610
Trainable params: 61,610
Non-trainable params: 0
---------------------------------------------------------------------------
Input size (MB): 0.00
Forward/backward pass size (MB): 0.11
Params size (MB): 0.24
Estimated Total Size (MB): 0.35
---------------------------------------------------------------------------

{'total_params': 61610, 'trainable_params': 61610}

# api已有网络

-------------------------------------------------------------------------------
Layer (type)         Input Shape          Output Shape         Param #
===============================================================================
Conv2D-123       [[1, 3, 224, 224]]   [1, 64, 112, 112]        9,408
BatchNorm2D-105   [[1, 64, 112, 112]]   [1, 64, 112, 112]         256
ReLU-43       [[1, 64, 112, 112]]   [1, 64, 112, 112]          0
MaxPool2D-8     [[1, 64, 112, 112]]    [1, 64, 56, 56]           0
Conv2D-125       [[1, 64, 56, 56]]     [1, 64, 56, 56]         4,096
BatchNorm2D-107    [[1, 64, 56, 56]]     [1, 64, 56, 56]          256
ReLU-44        [[1, 256, 56, 56]]    [1, 256, 56, 56]          0
Conv2D-126       [[1, 64, 56, 56]]     [1, 64, 56, 56]        36,864
BatchNorm2D-108    [[1, 64, 56, 56]]     [1, 64, 56, 56]          256
Conv2D-127       [[1, 64, 56, 56]]     [1, 256, 56, 56]       16,384
BatchNorm2D-109    [[1, 256, 56, 56]]    [1, 256, 56, 56]        1,024
Conv2D-124       [[1, 64, 56, 56]]     [1, 256, 56, 56]       16,384
BatchNorm2D-106    [[1, 256, 56, 56]]    [1, 256, 56, 56]        1,024
BottleneckBlock-34   [[1, 64, 56, 56]]     [1, 256, 56, 56]          0
Conv2D-128       [[1, 256, 56, 56]]    [1, 64, 56, 56]        16,384
BatchNorm2D-110    [[1, 64, 56, 56]]     [1, 64, 56, 56]          256
ReLU-45        [[1, 256, 56, 56]]    [1, 256, 56, 56]          0
Conv2D-129       [[1, 64, 56, 56]]     [1, 64, 56, 56]        36,864
BatchNorm2D-111    [[1, 64, 56, 56]]     [1, 64, 56, 56]          256
Conv2D-130       [[1, 64, 56, 56]]     [1, 256, 56, 56]       16,384
BatchNorm2D-112    [[1, 256, 56, 56]]    [1, 256, 56, 56]        1,024
BottleneckBlock-35   [[1, 256, 56, 56]]    [1, 256, 56, 56]          0
Conv2D-131       [[1, 256, 56, 56]]    [1, 64, 56, 56]        16,384
BatchNorm2D-113    [[1, 64, 56, 56]]     [1, 64, 56, 56]          256
ReLU-46        [[1, 256, 56, 56]]    [1, 256, 56, 56]          0
Conv2D-132       [[1, 64, 56, 56]]     [1, 64, 56, 56]        36,864
BatchNorm2D-114    [[1, 64, 56, 56]]     [1, 64, 56, 56]          256
Conv2D-133       [[1, 64, 56, 56]]     [1, 256, 56, 56]       16,384
BatchNorm2D-115    [[1, 256, 56, 56]]    [1, 256, 56, 56]        1,024
BottleneckBlock-36   [[1, 256, 56, 56]]    [1, 256, 56, 56]          0
Conv2D-135       [[1, 256, 56, 56]]    [1, 128, 56, 56]       32,768
BatchNorm2D-117    [[1, 128, 56, 56]]    [1, 128, 56, 56]         512
ReLU-47        [[1, 512, 28, 28]]    [1, 512, 28, 28]          0
Conv2D-136       [[1, 128, 56, 56]]    [1, 128, 28, 28]       147,456
BatchNorm2D-118    [[1, 128, 28, 28]]    [1, 128, 28, 28]         512
Conv2D-137       [[1, 128, 28, 28]]    [1, 512, 28, 28]       65,536
BatchNorm2D-119    [[1, 512, 28, 28]]    [1, 512, 28, 28]        2,048
Conv2D-134       [[1, 256, 56, 56]]    [1, 512, 28, 28]       131,072
BatchNorm2D-116    [[1, 512, 28, 28]]    [1, 512, 28, 28]        2,048
BottleneckBlock-37   [[1, 256, 56, 56]]    [1, 512, 28, 28]          0
Conv2D-138       [[1, 512, 28, 28]]    [1, 128, 28, 28]       65,536
BatchNorm2D-120    [[1, 128, 28, 28]]    [1, 128, 28, 28]         512
ReLU-48        [[1, 512, 28, 28]]    [1, 512, 28, 28]          0
Conv2D-139       [[1, 128, 28, 28]]    [1, 128, 28, 28]       147,456
BatchNorm2D-121    [[1, 128, 28, 28]]    [1, 128, 28, 28]         512
Conv2D-140       [[1, 128, 28, 28]]    [1, 512, 28, 28]       65,536
BatchNorm2D-122    [[1, 512, 28, 28]]    [1, 512, 28, 28]        2,048
BottleneckBlock-38   [[1, 512, 28, 28]]    [1, 512, 28, 28]          0
Conv2D-141       [[1, 512, 28, 28]]    [1, 128, 28, 28]       65,536
BatchNorm2D-123    [[1, 128, 28, 28]]    [1, 128, 28, 28]         512
ReLU-49        [[1, 512, 28, 28]]    [1, 512, 28, 28]          0
Conv2D-142       [[1, 128, 28, 28]]    [1, 128, 28, 28]       147,456
BatchNorm2D-124    [[1, 128, 28, 28]]    [1, 128, 28, 28]         512
Conv2D-143       [[1, 128, 28, 28]]    [1, 512, 28, 28]       65,536
BatchNorm2D-125    [[1, 512, 28, 28]]    [1, 512, 28, 28]        2,048
BottleneckBlock-39   [[1, 512, 28, 28]]    [1, 512, 28, 28]          0
Conv2D-144       [[1, 512, 28, 28]]    [1, 128, 28, 28]       65,536
BatchNorm2D-126    [[1, 128, 28, 28]]    [1, 128, 28, 28]         512
ReLU-50        [[1, 512, 28, 28]]    [1, 512, 28, 28]          0
Conv2D-145       [[1, 128, 28, 28]]    [1, 128, 28, 28]       147,456
BatchNorm2D-127    [[1, 128, 28, 28]]    [1, 128, 28, 28]         512
Conv2D-146       [[1, 128, 28, 28]]    [1, 512, 28, 28]       65,536
BatchNorm2D-128    [[1, 512, 28, 28]]    [1, 512, 28, 28]        2,048
BottleneckBlock-40   [[1, 512, 28, 28]]    [1, 512, 28, 28]          0
Conv2D-148       [[1, 512, 28, 28]]    [1, 256, 28, 28]       131,072
BatchNorm2D-130    [[1, 256, 28, 28]]    [1, 256, 28, 28]        1,024
ReLU-51       [[1, 1024, 14, 14]]   [1, 1024, 14, 14]          0
Conv2D-149       [[1, 256, 28, 28]]    [1, 256, 14, 14]       589,824
BatchNorm2D-131    [[1, 256, 14, 14]]    [1, 256, 14, 14]        1,024
Conv2D-150       [[1, 256, 14, 14]]   [1, 1024, 14, 14]       262,144
BatchNorm2D-132   [[1, 1024, 14, 14]]   [1, 1024, 14, 14]        4,096
Conv2D-147       [[1, 512, 28, 28]]   [1, 1024, 14, 14]       524,288
BatchNorm2D-129   [[1, 1024, 14, 14]]   [1, 1024, 14, 14]        4,096
BottleneckBlock-41   [[1, 512, 28, 28]]   [1, 1024, 14, 14]          0
Conv2D-151      [[1, 1024, 14, 14]]    [1, 256, 14, 14]       262,144
BatchNorm2D-133    [[1, 256, 14, 14]]    [1, 256, 14, 14]        1,024
ReLU-52       [[1, 1024, 14, 14]]   [1, 1024, 14, 14]          0
Conv2D-152       [[1, 256, 14, 14]]    [1, 256, 14, 14]       589,824
BatchNorm2D-134    [[1, 256, 14, 14]]    [1, 256, 14, 14]        1,024
Conv2D-153       [[1, 256, 14, 14]]   [1, 1024, 14, 14]       262,144
BatchNorm2D-135   [[1, 1024, 14, 14]]   [1, 1024, 14, 14]        4,096
BottleneckBlock-42  [[1, 1024, 14, 14]]   [1, 1024, 14, 14]          0
Conv2D-154      [[1, 1024, 14, 14]]    [1, 256, 14, 14]       262,144
BatchNorm2D-136    [[1, 256, 14, 14]]    [1, 256, 14, 14]        1,024
ReLU-53       [[1, 1024, 14, 14]]   [1, 1024, 14, 14]          0
Conv2D-155       [[1, 256, 14, 14]]    [1, 256, 14, 14]       589,824
BatchNorm2D-137    [[1, 256, 14, 14]]    [1, 256, 14, 14]        1,024
Conv2D-156       [[1, 256, 14, 14]]   [1, 1024, 14, 14]       262,144
BatchNorm2D-138   [[1, 1024, 14, 14]]   [1, 1024, 14, 14]        4,096
BottleneckBlock-43  [[1, 1024, 14, 14]]   [1, 1024, 14, 14]          0
Conv2D-157      [[1, 1024, 14, 14]]    [1, 256, 14, 14]       262,144
BatchNorm2D-139    [[1, 256, 14, 14]]    [1, 256, 14, 14]        1,024
ReLU-54       [[1, 1024, 14, 14]]   [1, 1024, 14, 14]          0
Conv2D-158       [[1, 256, 14, 14]]    [1, 256, 14, 14]       589,824
BatchNorm2D-140    [[1, 256, 14, 14]]    [1, 256, 14, 14]        1,024
Conv2D-159       [[1, 256, 14, 14]]   [1, 1024, 14, 14]       262,144
BatchNorm2D-141   [[1, 1024, 14, 14]]   [1, 1024, 14, 14]        4,096
BottleneckBlock-44  [[1, 1024, 14, 14]]   [1, 1024, 14, 14]          0
Conv2D-160      [[1, 1024, 14, 14]]    [1, 256, 14, 14]       262,144
BatchNorm2D-142    [[1, 256, 14, 14]]    [1, 256, 14, 14]        1,024
ReLU-55       [[1, 1024, 14, 14]]   [1, 1024, 14, 14]          0
Conv2D-161       [[1, 256, 14, 14]]    [1, 256, 14, 14]       589,824
BatchNorm2D-143    [[1, 256, 14, 14]]    [1, 256, 14, 14]        1,024
Conv2D-162       [[1, 256, 14, 14]]   [1, 1024, 14, 14]       262,144
BatchNorm2D-144   [[1, 1024, 14, 14]]   [1, 1024, 14, 14]        4,096
BottleneckBlock-45  [[1, 1024, 14, 14]]   [1, 1024, 14, 14]          0
Conv2D-163      [[1, 1024, 14, 14]]    [1, 256, 14, 14]       262,144
BatchNorm2D-145    [[1, 256, 14, 14]]    [1, 256, 14, 14]        1,024
ReLU-56       [[1, 1024, 14, 14]]   [1, 1024, 14, 14]          0
Conv2D-164       [[1, 256, 14, 14]]    [1, 256, 14, 14]       589,824
BatchNorm2D-146    [[1, 256, 14, 14]]    [1, 256, 14, 14]        1,024
Conv2D-165       [[1, 256, 14, 14]]   [1, 1024, 14, 14]       262,144
BatchNorm2D-147   [[1, 1024, 14, 14]]   [1, 1024, 14, 14]        4,096
BottleneckBlock-46  [[1, 1024, 14, 14]]   [1, 1024, 14, 14]          0
Conv2D-166      [[1, 1024, 14, 14]]    [1, 256, 14, 14]       262,144
BatchNorm2D-148    [[1, 256, 14, 14]]    [1, 256, 14, 14]        1,024
ReLU-57       [[1, 1024, 14, 14]]   [1, 1024, 14, 14]          0
Conv2D-167       [[1, 256, 14, 14]]    [1, 256, 14, 14]       589,824
BatchNorm2D-149    [[1, 256, 14, 14]]    [1, 256, 14, 14]        1,024
Conv2D-168       [[1, 256, 14, 14]]   [1, 1024, 14, 14]       262,144
BatchNorm2D-150   [[1, 1024, 14, 14]]   [1, 1024, 14, 14]        4,096
BottleneckBlock-47  [[1, 1024, 14, 14]]   [1, 1024, 14, 14]          0
Conv2D-169      [[1, 1024, 14, 14]]    [1, 256, 14, 14]       262,144
BatchNorm2D-151    [[1, 256, 14, 14]]    [1, 256, 14, 14]        1,024
ReLU-58       [[1, 1024, 14, 14]]   [1, 1024, 14, 14]          0
Conv2D-170       [[1, 256, 14, 14]]    [1, 256, 14, 14]       589,824
BatchNorm2D-152    [[1, 256, 14, 14]]    [1, 256, 14, 14]        1,024
Conv2D-171       [[1, 256, 14, 14]]   [1, 1024, 14, 14]       262,144
BatchNorm2D-153   [[1, 1024, 14, 14]]   [1, 1024, 14, 14]        4,096
BottleneckBlock-48  [[1, 1024, 14, 14]]   [1, 1024, 14, 14]          0
Conv2D-172      [[1, 1024, 14, 14]]    [1, 256, 14, 14]       262,144
BatchNorm2D-154    [[1, 256, 14, 14]]    [1, 256, 14, 14]        1,024
ReLU-59       [[1, 1024, 14, 14]]   [1, 1024, 14, 14]          0
Conv2D-173       [[1, 256, 14, 14]]    [1, 256, 14, 14]       589,824
BatchNorm2D-155    [[1, 256, 14, 14]]    [1, 256, 14, 14]        1,024
Conv2D-174       [[1, 256, 14, 14]]   [1, 1024, 14, 14]       262,144
BatchNorm2D-156   [[1, 1024, 14, 14]]   [1, 1024, 14, 14]        4,096
BottleneckBlock-49  [[1, 1024, 14, 14]]   [1, 1024, 14, 14]          0
Conv2D-175      [[1, 1024, 14, 14]]    [1, 256, 14, 14]       262,144
BatchNorm2D-157    [[1, 256, 14, 14]]    [1, 256, 14, 14]        1,024
ReLU-60       [[1, 1024, 14, 14]]   [1, 1024, 14, 14]          0
Conv2D-176       [[1, 256, 14, 14]]    [1, 256, 14, 14]       589,824
BatchNorm2D-158    [[1, 256, 14, 14]]    [1, 256, 14, 14]        1,024
Conv2D-177       [[1, 256, 14, 14]]   [1, 1024, 14, 14]       262,144
BatchNorm2D-159   [[1, 1024, 14, 14]]   [1, 1024, 14, 14]        4,096
BottleneckBlock-50  [[1, 1024, 14, 14]]   [1, 1024, 14, 14]          0
Conv2D-178      [[1, 1024, 14, 14]]    [1, 256, 14, 14]       262,144
BatchNorm2D-160    [[1, 256, 14, 14]]    [1, 256, 14, 14]        1,024
ReLU-61       [[1, 1024, 14, 14]]   [1, 1024, 14, 14]          0
Conv2D-179       [[1, 256, 14, 14]]    [1, 256, 14, 14]       589,824
BatchNorm2D-161    [[1, 256, 14, 14]]    [1, 256, 14, 14]        1,024
Conv2D-180       [[1, 256, 14, 14]]   [1, 1024, 14, 14]       262,144
BatchNorm2D-162   [[1, 1024, 14, 14]]   [1, 1024, 14, 14]        4,096
BottleneckBlock-51  [[1, 1024, 14, 14]]   [1, 1024, 14, 14]          0
Conv2D-181      [[1, 1024, 14, 14]]    [1, 256, 14, 14]       262,144
BatchNorm2D-163    [[1, 256, 14, 14]]    [1, 256, 14, 14]        1,024
ReLU-62       [[1, 1024, 14, 14]]   [1, 1024, 14, 14]          0
Conv2D-182       [[1, 256, 14, 14]]    [1, 256, 14, 14]       589,824
BatchNorm2D-164    [[1, 256, 14, 14]]    [1, 256, 14, 14]        1,024
Conv2D-183       [[1, 256, 14, 14]]   [1, 1024, 14, 14]       262,144
BatchNorm2D-165   [[1, 1024, 14, 14]]   [1, 1024, 14, 14]        4,096
BottleneckBlock-52  [[1, 1024, 14, 14]]   [1, 1024, 14, 14]          0
Conv2D-184      [[1, 1024, 14, 14]]    [1, 256, 14, 14]       262,144
BatchNorm2D-166    [[1, 256, 14, 14]]    [1, 256, 14, 14]        1,024
ReLU-63       [[1, 1024, 14, 14]]   [1, 1024, 14, 14]          0
Conv2D-185       [[1, 256, 14, 14]]    [1, 256, 14, 14]       589,824
BatchNorm2D-167    [[1, 256, 14, 14]]    [1, 256, 14, 14]        1,024
Conv2D-186       [[1, 256, 14, 14]]   [1, 1024, 14, 14]       262,144
BatchNorm2D-168   [[1, 1024, 14, 14]]   [1, 1024, 14, 14]        4,096
BottleneckBlock-53  [[1, 1024, 14, 14]]   [1, 1024, 14, 14]          0
Conv2D-187      [[1, 1024, 14, 14]]    [1, 256, 14, 14]       262,144
BatchNorm2D-169    [[1, 256, 14, 14]]    [1, 256, 14, 14]        1,024
ReLU-64       [[1, 1024, 14, 14]]   [1, 1024, 14, 14]          0
Conv2D-188       [[1, 256, 14, 14]]    [1, 256, 14, 14]       589,824
BatchNorm2D-170    [[1, 256, 14, 14]]    [1, 256, 14, 14]        1,024
Conv2D-189       [[1, 256, 14, 14]]   [1, 1024, 14, 14]       262,144
BatchNorm2D-171   [[1, 1024, 14, 14]]   [1, 1024, 14, 14]        4,096
BottleneckBlock-54  [[1, 1024, 14, 14]]   [1, 1024, 14, 14]          0
Conv2D-190      [[1, 1024, 14, 14]]    [1, 256, 14, 14]       262,144
BatchNorm2D-172    [[1, 256, 14, 14]]    [1, 256, 14, 14]        1,024
ReLU-65       [[1, 1024, 14, 14]]   [1, 1024, 14, 14]          0
Conv2D-191       [[1, 256, 14, 14]]    [1, 256, 14, 14]       589,824
BatchNorm2D-173    [[1, 256, 14, 14]]    [1, 256, 14, 14]        1,024
Conv2D-192       [[1, 256, 14, 14]]   [1, 1024, 14, 14]       262,144
BatchNorm2D-174   [[1, 1024, 14, 14]]   [1, 1024, 14, 14]        4,096
BottleneckBlock-55  [[1, 1024, 14, 14]]   [1, 1024, 14, 14]          0
Conv2D-193      [[1, 1024, 14, 14]]    [1, 256, 14, 14]       262,144
BatchNorm2D-175    [[1, 256, 14, 14]]    [1, 256, 14, 14]        1,024
ReLU-66       [[1, 1024, 14, 14]]   [1, 1024, 14, 14]          0
Conv2D-194       [[1, 256, 14, 14]]    [1, 256, 14, 14]       589,824
BatchNorm2D-176    [[1, 256, 14, 14]]    [1, 256, 14, 14]        1,024
Conv2D-195       [[1, 256, 14, 14]]   [1, 1024, 14, 14]       262,144
BatchNorm2D-177   [[1, 1024, 14, 14]]   [1, 1024, 14, 14]        4,096
BottleneckBlock-56  [[1, 1024, 14, 14]]   [1, 1024, 14, 14]          0
Conv2D-196      [[1, 1024, 14, 14]]    [1, 256, 14, 14]       262,144
BatchNorm2D-178    [[1, 256, 14, 14]]    [1, 256, 14, 14]        1,024
ReLU-67       [[1, 1024, 14, 14]]   [1, 1024, 14, 14]          0
Conv2D-197       [[1, 256, 14, 14]]    [1, 256, 14, 14]       589,824
BatchNorm2D-179    [[1, 256, 14, 14]]    [1, 256, 14, 14]        1,024
Conv2D-198       [[1, 256, 14, 14]]   [1, 1024, 14, 14]       262,144
BatchNorm2D-180   [[1, 1024, 14, 14]]   [1, 1024, 14, 14]        4,096
BottleneckBlock-57  [[1, 1024, 14, 14]]   [1, 1024, 14, 14]          0
Conv2D-199      [[1, 1024, 14, 14]]    [1, 256, 14, 14]       262,144
BatchNorm2D-181    [[1, 256, 14, 14]]    [1, 256, 14, 14]        1,024
ReLU-68       [[1, 1024, 14, 14]]   [1, 1024, 14, 14]          0
Conv2D-200       [[1, 256, 14, 14]]    [1, 256, 14, 14]       589,824
BatchNorm2D-182    [[1, 256, 14, 14]]    [1, 256, 14, 14]        1,024
Conv2D-201       [[1, 256, 14, 14]]   [1, 1024, 14, 14]       262,144
BatchNorm2D-183   [[1, 1024, 14, 14]]   [1, 1024, 14, 14]        4,096
BottleneckBlock-58  [[1, 1024, 14, 14]]   [1, 1024, 14, 14]          0
Conv2D-202      [[1, 1024, 14, 14]]    [1, 256, 14, 14]       262,144
BatchNorm2D-184    [[1, 256, 14, 14]]    [1, 256, 14, 14]        1,024
ReLU-69       [[1, 1024, 14, 14]]   [1, 1024, 14, 14]          0
Conv2D-203       [[1, 256, 14, 14]]    [1, 256, 14, 14]       589,824
BatchNorm2D-185    [[1, 256, 14, 14]]    [1, 256, 14, 14]        1,024
Conv2D-204       [[1, 256, 14, 14]]   [1, 1024, 14, 14]       262,144
BatchNorm2D-186   [[1, 1024, 14, 14]]   [1, 1024, 14, 14]        4,096
BottleneckBlock-59  [[1, 1024, 14, 14]]   [1, 1024, 14, 14]          0
Conv2D-205      [[1, 1024, 14, 14]]    [1, 256, 14, 14]       262,144
BatchNorm2D-187    [[1, 256, 14, 14]]    [1, 256, 14, 14]        1,024
ReLU-70       [[1, 1024, 14, 14]]   [1, 1024, 14, 14]          0
Conv2D-206       [[1, 256, 14, 14]]    [1, 256, 14, 14]       589,824
BatchNorm2D-188    [[1, 256, 14, 14]]    [1, 256, 14, 14]        1,024
Conv2D-207       [[1, 256, 14, 14]]   [1, 1024, 14, 14]       262,144
BatchNorm2D-189   [[1, 1024, 14, 14]]   [1, 1024, 14, 14]        4,096
BottleneckBlock-60  [[1, 1024, 14, 14]]   [1, 1024, 14, 14]          0
Conv2D-208      [[1, 1024, 14, 14]]    [1, 256, 14, 14]       262,144
BatchNorm2D-190    [[1, 256, 14, 14]]    [1, 256, 14, 14]        1,024
ReLU-71       [[1, 1024, 14, 14]]   [1, 1024, 14, 14]          0
Conv2D-209       [[1, 256, 14, 14]]    [1, 256, 14, 14]       589,824
BatchNorm2D-191    [[1, 256, 14, 14]]    [1, 256, 14, 14]        1,024
Conv2D-210       [[1, 256, 14, 14]]   [1, 1024, 14, 14]       262,144
BatchNorm2D-192   [[1, 1024, 14, 14]]   [1, 1024, 14, 14]        4,096
BottleneckBlock-61  [[1, 1024, 14, 14]]   [1, 1024, 14, 14]          0
Conv2D-211      [[1, 1024, 14, 14]]    [1, 256, 14, 14]       262,144
BatchNorm2D-193    [[1, 256, 14, 14]]    [1, 256, 14, 14]        1,024
ReLU-72       [[1, 1024, 14, 14]]   [1, 1024, 14, 14]          0
Conv2D-212       [[1, 256, 14, 14]]    [1, 256, 14, 14]       589,824
BatchNorm2D-194    [[1, 256, 14, 14]]    [1, 256, 14, 14]        1,024
Conv2D-213       [[1, 256, 14, 14]]   [1, 1024, 14, 14]       262,144
BatchNorm2D-195   [[1, 1024, 14, 14]]   [1, 1024, 14, 14]        4,096
BottleneckBlock-62  [[1, 1024, 14, 14]]   [1, 1024, 14, 14]          0
Conv2D-214      [[1, 1024, 14, 14]]    [1, 256, 14, 14]       262,144
BatchNorm2D-196    [[1, 256, 14, 14]]    [1, 256, 14, 14]        1,024
ReLU-73       [[1, 1024, 14, 14]]   [1, 1024, 14, 14]          0
Conv2D-215       [[1, 256, 14, 14]]    [1, 256, 14, 14]       589,824
BatchNorm2D-197    [[1, 256, 14, 14]]    [1, 256, 14, 14]        1,024
Conv2D-216       [[1, 256, 14, 14]]   [1, 1024, 14, 14]       262,144
BatchNorm2D-198   [[1, 1024, 14, 14]]   [1, 1024, 14, 14]        4,096
BottleneckBlock-63  [[1, 1024, 14, 14]]   [1, 1024, 14, 14]          0
Conv2D-218      [[1, 1024, 14, 14]]    [1, 512, 14, 14]       524,288
BatchNorm2D-200    [[1, 512, 14, 14]]    [1, 512, 14, 14]        2,048
ReLU-74        [[1, 2048, 7, 7]]     [1, 2048, 7, 7]           0
Conv2D-219       [[1, 512, 14, 14]]     [1, 512, 7, 7]       2,359,296
BatchNorm2D-201     [[1, 512, 7, 7]]      [1, 512, 7, 7]         2,048
Conv2D-220        [[1, 512, 7, 7]]     [1, 2048, 7, 7]       1,048,576
BatchNorm2D-202    [[1, 2048, 7, 7]]     [1, 2048, 7, 7]         8,192
Conv2D-217      [[1, 1024, 14, 14]]    [1, 2048, 7, 7]       2,097,152
BatchNorm2D-199    [[1, 2048, 7, 7]]     [1, 2048, 7, 7]         8,192
BottleneckBlock-64  [[1, 1024, 14, 14]]    [1, 2048, 7, 7]           0
Conv2D-221       [[1, 2048, 7, 7]]      [1, 512, 7, 7]       1,048,576
BatchNorm2D-203     [[1, 512, 7, 7]]      [1, 512, 7, 7]         2,048
ReLU-75        [[1, 2048, 7, 7]]     [1, 2048, 7, 7]           0
Conv2D-222        [[1, 512, 7, 7]]      [1, 512, 7, 7]       2,359,296
BatchNorm2D-204     [[1, 512, 7, 7]]      [1, 512, 7, 7]         2,048
Conv2D-223        [[1, 512, 7, 7]]     [1, 2048, 7, 7]       1,048,576
BatchNorm2D-205    [[1, 2048, 7, 7]]     [1, 2048, 7, 7]         8,192
BottleneckBlock-65   [[1, 2048, 7, 7]]     [1, 2048, 7, 7]           0
Conv2D-224       [[1, 2048, 7, 7]]      [1, 512, 7, 7]       1,048,576
BatchNorm2D-206     [[1, 512, 7, 7]]      [1, 512, 7, 7]         2,048
ReLU-76        [[1, 2048, 7, 7]]     [1, 2048, 7, 7]           0
Conv2D-225        [[1, 512, 7, 7]]      [1, 512, 7, 7]       2,359,296
BatchNorm2D-207     [[1, 512, 7, 7]]      [1, 512, 7, 7]         2,048
Conv2D-226        [[1, 512, 7, 7]]     [1, 2048, 7, 7]       1,048,576
BatchNorm2D-208    [[1, 2048, 7, 7]]     [1, 2048, 7, 7]         8,192
BottleneckBlock-66   [[1, 2048, 7, 7]]     [1, 2048, 7, 7]           0
AdaptiveAvgPool2D-3  [[1, 2048, 7, 7]]     [1, 2048, 1, 1]           0
Linear-33          [[1, 2048]]            [1, 10]            20,490
===============================================================================
Total params: 42,625,994
Trainable params: 42,415,306
Non-trainable params: 210,688
-------------------------------------------------------------------------------
Input size (MB): 0.57
Forward/backward pass size (MB): 391.63
Params size (MB): 162.61
Estimated Total Size (MB): 554.81
-------------------------------------------------------------------------------

{'total_params': 42625994, 'trainable_params': 42415306}


### 梯度下降

# 随机梯度下降算法的优化器
# loss计算


### 训练模块

model.prepare(paddle.optimizer.Adam(learning_rate=0.001, parameters=model.parameters()),
model.fit(train_dataset, # 训练数据集
val_dataset,  # 测试数据集
epochs=2, # 训练的总轮次
batch_size=64, # 训练使用的批大小
verbose=1)  # 日志展示形式

model.evaluate(test_dataset,batch_size=64,verbose=1)  # 评估


### 作者简介

csdn地址：https://blog.csdn.net/weixin_45623093/article/list/3

• 点赞
• 评论
• 分享
x

海报分享

扫一扫，分享海报

• 收藏
• 打赏

打赏

三岁学编程

感谢支持，更好的作品会继续努力

C币 余额
2C币 4C币 6C币 10C币 20C币 50C币
• 举报
• 一键三连

点赞Mark关注该博主, 随时了解TA的最新博文

07-20 1万+
03-09 251
04-01 660
03-07 224
02-23 40
12-10 82
04-05 1万+
12-31
01-17 4056
11-03 4134
11-02 8万+
05-10 2222