首页 > 其他分享 >神经网络架构参考:2-1 卷积篇

神经网络架构参考:2-1 卷积篇

时间:2024-11-14 10:57:44浏览次数:1  
标签:kernel 架构 nn 卷积 self 神经网络 3x3 Conv2d size

提示词:

给出{xxx}的网络结构表格,包含层名称、类型、输入大小(HWC),输出大小(HWC)、核尺寸、步长、参数数量

AlexNet

层名称 类型 输入大小(HWC) 输出大小(HWC) 核尺寸 步长 参数数量
输入层 输入 227x227x3 - - - 0
Conv1 卷积层 227x227x3 55x55x96 11x11 4 961111*3 + 96 = 34944
MaxPool1 最大池化层 55x55x96 27x27x96 3x3 2 0
LRN1 局部响应归一化 27x27x96 27x27x96 - - -
Conv2 卷积层 27x27x96 27x27x256 5x5 1 25655*96 + 256 = 614656
MaxPool2 最大池化层 27x27x256 13x13x256 3x3 2 0
LRN2 局部响应归一化 13x13x256 13x13x256 - - -
Conv3 卷积层 13x13x256 13x13x384 3x3 1 38433*256 + 384 = 885120
Conv4 卷积层 13x13x384 13x13x384 3x3 1 38433*384 + 384 = 1327488
Conv5 卷积层 13x13x384 13x13x256 3x3 1 25633*384 + 256 = 884992
MaxPool3 最大池化层 13x13x256 6x6x256 3x3 2 0
FC6 全连接层 6x6x256 4096 - - 66256*4096 + 4096 = 37752832
FC7 全连接层 4096 4096 - - 4096*4096 + 4096 = 16781312
FC8 全连接层 4096 1000 - - 4096*1000 + 1000 = 4194304

PyTorch 源码

import torch
import torch.nn as nn
import torch.nn.functional as F
class AlexNet(nn.Module):
    def __init__(self, num_classes=1000):
        super(AlexNet, self).__init__()
        self.features = nn.Sequential(
            nn.Conv2d(3, 96, kernel_size=11, stride=4, padding=2),  # Conv1
            nn.ReLU(inplace=True),
            nn.MaxPool2d(kernel_size=3, stride=2),  # MaxPool1
            nn.LocalResponseNorm(size=5, alpha=0.0001, beta=0.75, k=2),  # LRN1
            nn.Conv2d(96, 256, kernel_size=5, padding=2),  # Conv2
            nn.ReLU(inplace=True),
            nn.MaxPool2d(kernel_size=3, stride=2),  # MaxPool2
            nn.LocalResponseNorm(size=5, alpha=0.0001, beta=0.75, k=2),  # LRN2
            nn.Conv2d(256, 384, kernel_size=3, padding=1),  # Conv3
            nn.ReLU(inplace=True),
            nn.Conv2d(384, 384, kernel_size=3, padding=1),  # Conv4
            nn.ReLU(inplace=True),
            nn.Conv2d(384, 256, kernel_size=3, padding=1),  # Conv5
            nn.ReLU(inplace=True),
            nn.MaxPool2d(kernel_size=3, stride=2),  # MaxPool3
        )
        self.classifier = nn.Sequential(
            nn.Dropout(),
            nn.Linear(256 * 6 * 6, 4096),  # FC6
            nn.ReLU(inplace=True),
            nn.Dropout(),
            nn.Linear(4096, 4096),  # FC7
            nn.ReLU(inplace=True),
            nn.Linear(4096, num_classes),  # FC8
        )
    def forward(self, x):
        x = self.features(x)
        x = x.view(x.size(0), 256 * 6 * 6)
        x = self.classifier(x)
        return x
# 创建AlexNet模型实例
model = AlexNet(num_classes=1000)
print(model)

LENET5

网络结构

层名称 类型 输入大小 (HWC) 输出大小 (HWC) 核尺寸 步长 参数数量
输入层 输入 32x32x1 32x32x1 - - 0
C1 卷积层 32x32x1 28x28x6 5x5 1 (5x5x1+1)x6 = 156
S2 下采样层 28x28x6 14x14x6 2x2 2 0
C3 卷积层 14x14x6 10x10x16 5x5 1 (5x5x6+1)x16 = 2416
S4 下采样层 10x10x16 5x5x16 2x2 2 0
C5 卷积层 5x5x16 1x1x120 5x5 1 (5x5x16+1)x120 = 48120
F6 全连接层 1x1x120 1x1x84 - - 120x84 + 84 = 10164
输出层 全连接层 1x1x84 1x1x10 - - 84x10 + 10 = 850

PyTorch 代码

import torch
import torch.nn as nn
import torch.nn.functional as F
class LeNet5(nn.Module):
    def __init__(self, num_classes=10):
        super(LeNet5, self).__init__()
        # Convolutional layer (C1)
        self.conv1 = nn.Conv2d(in_channels=1, out_channels=6, kernel_size=5, padding=2)
        # Subsampling layer (S2)
        self.pool1 = nn.AvgPool2d(kernel_size=2, stride=2)
        # Convolutional layer (C3)
        self.conv2 = nn.Conv2d(in_channels=6, out_channels=16, kernel_size=5)
        # Subsampling layer (S4)
        self.pool2 = nn.AvgPool2d(kernel_size=2, stride=2)
        # Convolutional layer (C5)
        self.conv3 = nn.Conv2d(in_channels=16, out_channels=120, kernel_size=5)
        # Fully connected layer (F6)
        self.fc1 = nn.Linear(in_features=120, out_features=84)
        # Output layer
        self.fc2 = nn.Linear(in_features=84, out_features=num_classes)
    def forward(self, x):
        # C1
        x = self.conv1(x)
        x = F.relu(x)
        # S2
        x = self.pool1(x)
        # C3
        x = self.conv2(x)
        x = F.relu(x)
        # S4
        x = self.pool2(x)
        # C5
        x = self.conv3(x)
        x = F.relu(x)
        # Flatten the output for the fully connected layer
        x = x.view(-1, self.num_flat_features(x))
        # F6
        x = self.fc1(x)
        x = F.relu(x)
        # Output layer
        x = self.fc2(x)
        return x
    def num_flat_features(self, x):
        size = x.size()[1:]  # all dimensions except the batch dimension
        num_features = 1
        for s in size:
            num_features *= s
        return num_features
# Example of creating the LeNet5 model
model = LeNet5(num_classes=10)
print(model)
# Example input tensor (batch size of 1, 1 channel, 32x32 image)
input_tensor = torch.randn(1, 1, 32, 32)
# Forward pass through the model
output = model(input_tensor)
print(output)

VGG16

层名称 类型 输入大小 (HWC) 输出大小 (HWC) 核尺寸 步长 参数数量
Input - 224x224x3 - - - 0
Conv1_1 Conv2D 224x224x3 224x224x64 3x3 1 1792
Conv1_2 Conv2D 224x224x64 224x224x64 3x3 1 36928
MaxPool1 MaxPooling2D 224x224x64 112x112x64 2x2 2 0
Conv2_1 Conv2D 112x112x64 112x112x128 3x3 1 73856
Conv2_2 Conv2D 112x112x128 112x112x128 3x3 1 147584
MaxPool2 MaxPooling2D 112x112x128 56x56x128 2x2 2 0
Conv3_1 Conv2D 56x56x128 56x56x256 3x3 1 295168
Conv3_2 Conv2D 56x56x256 56x56x256 3x3 1 590080
Conv3_3 Conv2D 56x56x256 56x56x256 3x3 1 590080
MaxPool3 MaxPooling2D 56x56x256 28x28x256 2x2 2 0
Conv4_1 Conv2D 28x28x256 28x28x512 3x3 1 1180160
Conv4_2 Conv2D 28x28x512 28x28x512 3x3 1 2359808
Conv4_3 Conv2D 28x28x512 28x28x512 3x3 1 2359808
MaxPool4 MaxPooling2D 28x28x512 14x14x512 2x2 2 0
Conv5_1 Conv2D 14x14x512 14x14x512 3x3 1 2359808
Conv5_2 Conv2D 14x14x512 14x14x512 3x3 1 2359808
Conv5_3 Conv2D 14x14x512 14x14x512 3x3 1 2359808
MaxPool5 MaxPooling2D 14x14x512 7x7x512 2x2 2 0
Flatten Flatten 7x7x512 25088 - - 0
FC6 Dense 25088 4096 - - 102760448
FC7 Dense 4096 4096 - -

PyTorch 代码

import torch
import torch.nn as nn
class VGG16(nn.Module):
    def __init__(self, num_classes=1000):
        super(VGG16, self).__init__()
        self.features = nn.Sequential(
            # Conv1
            nn.Conv2d(3, 64, kernel_size=3, padding=1),
            nn.ReLU(inplace=True),
            nn.Conv2d(64, 64, kernel_size=3, padding=1),
            nn.ReLU(inplace=True),
            nn.MaxPool2d(kernel_size=2, stride=2),
            
            # Conv2
            nn.Conv2d(64, 128, kernel_size=3, padding=1),
            nn.ReLU(inplace=True),
            nn.Conv2d(128, 128, kernel_size=3, padding=1),
            nn.ReLU(inplace=True),
            nn.MaxPool2d(kernel_size=2, stride=2),
            
            # Conv3
            nn.Conv2d(128, 256, kernel_size=3, padding=1),
            nn.ReLU(inplace=True),
            nn.Conv2d(256, 256, kernel_size=3, padding=1),
            nn.ReLU(inplace=True),
            nn.Conv2d(256, 256, kernel_size=3, padding=1),
            nn.ReLU(inplace=True),
            nn.MaxPool2d(kernel_size=2, stride=2),
            
            # Conv4
            nn.Conv2d(256, 512, kernel_size=3, padding=1),
            nn.ReLU(inplace=True),
            nn.Conv2d(512, 512, kernel_size=3, padding=1),
            nn.ReLU(inplace=True),
            nn.Conv2d(512, 512, kernel_size=3, padding=1),
            nn.ReLU(inplace=True),
            nn.MaxPool2d(kernel_size=2, stride=2),
            
            # Conv5
            nn.Conv2d(512, 512, kernel_size=3, padding=1),
            nn.ReLU(inplace=True),
            nn.Conv2d(512, 512, kernel_size=3, padding=1),
            nn.ReLU(inplace=True),
            nn.Conv2d(512, 512, kernel_size=3, padding=1),
            nn.ReLU(inplace=True),
            nn.MaxPool2d(kernel_size=2, stride=2)
        )
        
        self.classifier = nn.Sequential(
            nn.Linear(512 * 7 * 7, 4096),
            nn.ReLU(inplace=True),
            nn.Dropout(),
            nn.Linear(4096, 4096),
            nn.ReLU(inplace=True),
            nn.Dropout(),
            nn.Linear(4096, num_classes)
        )
        
    def forward(self, x):
        x = self.features(x)
        x = torch.flatten(x, 1)
        x = self.classifier(x)
        return x
# 实例化模型
model = VGG16(num_classes=1000)
print(model)

Inception

层名称 类型 输入大小(HWC) 输出大小(HWC) 核尺寸 步长 参数数量
Conv2d_1a_3x3 卷积层 299x299x3 149x149x32 3x3 2 864
Conv2d_2a_3x3 卷积层 149x149x32 147x147x32 3x3 1 9216
Conv2d_2b_3x3 卷积层 147x147x32 147x147x64 3x3 1 18432
MaxPool_3a_3x3 最大池化层 147x147x64 73x73x64 3x3 2 0
Conv2d_3b_1x1 卷积层 73x73x64 73x73x80 1x1 1 5120
Conv2d_4a_3x3 卷积层 73x73x80 71x71x192 3x3 1 138240
MaxPool_5a_3x3 最大池化层 71x71x192 35x35x192 3x3 2 0
Mixed_5b Inception模块 35x35x192 35x35x256 - - -
Mixed_5c Inception模块 35x35x256 35x35x288 - - -
Mixed_5d Inception模块 35x35x288 35x35x288 - - -
Mixed_6a Inception模块 35x35x288 17x17x768 - 2 -
Mixed_6b Inception模块 17x17x768 17x17x768 - - -
Mixed_6c Inception模块 17x17x768 17x17x768 - - -
Mixed_6d Inception模块 17x17x768 17x17x768 - - -
Mixed_6e Inception模块 17x17x768 17x17x768 - - -
Mixed_7a Inception模块 17x17x768 8x8x1280 - 2 -
Mixed_7b Inception模块 8x8x1280 8x8x2048 - - -
Mixed_7c Inception模块 8x8x2048 8x8x2048 - - -

以Mixed_5b为例,列出其内部结构。

层名称 类型 输入大小(HWC) 输出大小(HWC) 核尺寸 步长 参数数量
Mixed_5b/1x1 卷积层 35x35x192 35x35x64 1x1 1 12288
Mixed_5b/3x3/1x1 卷积层 35x35x192 35x35x64 1x1 1 12288
Mixed_5b/3x3/3x3 卷积层 35x35x64 35x35x96 3x3 1 63360
Mixed_5b/5x5/1x1 卷积层 35x35x192 35x35x16 1x1 1 3072
Mixed_5b/5x5/5x5 卷积层 35x35x16 35x35x16 5x5 1 3072
Mixed_5b/pool 池化层 35x35x192 35x35x32 - 1 0
Mixed_5b/output Concatenate - 35x35x256 - - -

PyTorch 源码

以下是使用PyTorch构建InceptionV3模型的一部分源码。这个源码展示了如何定义Inception模块和一些辅助函数,但不包括整个网络的所有细节。完整的InceptionV3模型定义会更长,这里只提供了核心部分。

import torch
import torch.nn as nn
import torch.nn.functional as F
class InceptionA(nn.Module):
    def __init__(self, in_channels):
        super(InceptionA, self).__init__()
        self.branch1x1 = BasicConv2d(in_channels, 64, kernel_size=1)
        self.branch5x5_1 = BasicConv2d(in_channels, 48, kernel_size=1)
        self.branch5x5_2 = BasicConv2d(48, 64, kernel_size=5, padding=2)
        self.branch3x3dbl_1 = BasicConv2d(in_channels, 64, kernel_size=1)
        self.branch3x3dbl_2 = BasicConv2d(64, 96, kernel_size=3, padding=1)
        self.branch3x3dbl_3 = BasicConv2d(96, 96, kernel_size=3, padding=1)
        self.branch_pool = BasicConv2d(in_channels, 32, kernel_size=1)
    def forward(self, x):
        branch1x1 = self.branch1x1(x)
        branch5x5 = self.branch5x5_1(x)
        branch5x5 = self.branch5x5_2(branch5x5)
        branch3x3dbl = self.branch3x3dbl_1(x)
        branch3x3dbl = self.branch3x3dbl_2(branch3x3dbl)
        branch3x3dbl = self.branch3x3dbl_3(branch3x3dbl)
        branch_pool = F.avg_pool2d(x, kernel_size=3, stride=1, padding=1)
        branch_pool = self.branch_pool(branch_pool)
        outputs = [branch1x1, branch5x5, branch3x3dbl, branch_pool]
        return torch.cat(outputs, 1)
class BasicConv2d(nn.Module):
    def __init__(self, in_channels, out_channels, **kwargs):
        super(BasicConv2d, self).__init__()
        self.conv = nn.Conv2d(in_channels, out_channels, bias=False, **kwargs)
        self.bn = nn.BatchNorm2d(out_channels, eps=0.001)
    def forward(self, x):
        x = self.conv(x)
        x = self.bn(x)
        return F.relu(x, inplace=True)
class InceptionV3(nn.Module):
    def __init__(self, num_classes=1000):
        super(InceptionV3, self).__init__()
        # Stem
        self.Conv2d_1a_3x3 = BasicConv2d(3, 32, kernel_size=3, stride=2)
        self.Conv2d_2a_3x3 = BasicConv2d(32, 32, kernel_size=3)
        self.Conv2d_2b_3x3 = BasicConv2d(32, 64, kernel_size=3, padding=1)
        # ... additional stem layers ...
        # Inception modules
        self.Mixed_5b = InceptionA(256)
        self.Mixed_5c = InceptionA(288)
        # ... additional Inception modules ...
        # Auxiliary Logits
        self.AuxLogits = None
        # ... auxiliary logits layers ...
        # Final Logits
        self.Mixed_7c = InceptionA(768)
        # ... additional final layers ...
        self.fc = nn.Linear(2048, num_classes)
    def forward(self, x):
        # Stem
        x = self.Conv2d_1a_3x3(x)
        x = self.Conv2d_2a_3x3(x)
        x = self.Conv2d_2b_3x3(x)
        # ... additional stem layers ...
        # Inception modules
        x = self.Mixed_5b(x)
        x = self.Mixed_5c(x)
        # ... additional Inception modules ...
        # Auxiliary Logits
        if self.AuxLogits is not None:
            aux = self.AuxLogits(x)
        else:
            aux = None
        # Final Logits
        x = self.Mixed_7c(x)
        # ... additional final layers ...
        x = F.adaptive_avg_pool2d(x, (1, 1))
        x = torch.flatten(x, 1)
        x = self.fc(x)
        return x, aux
# Example usage:
# model = InceptionV3(num_classes=1000)

Resnet18

层名称 类型 输入大小(HWC) 输出大小(HWC) 核尺寸 步长 参数数量
Conv1 卷积层 224x224x3 112x112x64 7x7 2 9472
BatchNorm1 批归一化层 112x112x64 112x112x64 - - 256
ReLU1 激活层 112x112x64 112x112x64 - - 0
MaxPool1 最大池化层 112x112x64 56x56x64 3x3 2 0
ResidualBlock1_1 残差块 56x56x64 56x56x64 - - 8448
ResidualBlock1_2 残差块 56x56x64 56x56x64 - - 8448
ResidualBlock2_1 残差块 56x56x64 28x28x128 - 2 43008
ResidualBlock2_2 残差块 28x28x128 28x28x128 - - 43008
ResidualBlock3_1 残差块 28x28x128 14x14x256 - 2 172448
ResidualBlock3_2 残差块 14x14x256 14x14x256 - - 172448
AvgPool 平均池化层 14x14x256 7x7x256 7x7 2 0
Flatten 展平层 7x7x256 12544 - - 0
FC 全连接层 12544 1000 - - 12545000
Softmax Softmax层 1000 1000 - - 0

每个残差块的结构:

阶段 残差块 层名称 类型 输入大小(HWC) 输出大小(HWC) 核尺寸 步长 参数数量
1 1 conv1 卷积 224x224x64 112x112x64 7x7 2 9408
conv2 卷积 112x112x64 112x112x64 3x3 1 18432
skip1 卷积 224x224x64 112x112x64 1x1 2 256
1 2 conv1 卷积 112x112x64 112x112x64 3x3 1 18432
conv2 卷积 112x112x64 112x112x64 3x3 1 18432
2 1 conv1 卷积 112x112x64 56x56x128 3x3 2 73984
conv2 卷积 56x56x128 56x56x128 3x3 1 147584
skip1 卷积 112x112x64 56x56x128 1x1 2 832
2 2 conv1 卷积 56x56x128 56x56x128 3x3 1 147584
conv2 卷积 56x56x128 56x56x128 3x3 1 147584
3 1 conv1 卷积 56x56x128 28x28x256 3x3 2 295168
conv2 卷积 28x28x256 28x28x256 3x3 1 589824
skip1 卷积 56x56x128 28x28x256 1x1 2 3328
3 2 conv1 卷积 28x28x256 28x28x256 3x3 1 589824
conv2 卷积 28x28x256 28x28x256 3x3 1 589824
4 1 conv1 卷积 28x28x256 14x14x512 3x3 2 1180928
conv2 卷积 14x14x512 14x14x512 3x3 1 2359296

PyTorch 代码

import torch
import torch.nn as nn
import torch.nn.functional as F
# 定义基本残差块
class BasicBlock(nn.Module):
    expansion = 1
    def __init__(self, in_channels, out_channels, stride=1, downsample=None):
        super(BasicBlock, self).__init__()
        self.conv1 = nn.Conv2d(in_channels, out_channels, kernel_size=3, 
                               stride=stride, padding=1, bias=False)
        self.bn1 = nn.BatchNorm2d(out_channels)
        self.relu = nn.ReLU(inplace=True)
        self.conv2 = nn.Conv2d(out_channels, out_channels, kernel_size=3, 
                               stride=1, padding=1, bias=False)
        self.bn2 = nn.BatchNorm2d(out_channels)
        self.downsample = downsample
    def forward(self, x):
        identity = x
        out = self.conv1(x)
        out = self.bn1(out)
        out = self.relu(out)
        out = self.conv2(out)
        out = self.bn2(out)
        if self.downsample is not None:
            identity = self.downsample(x)
        out += identity
        out = self.relu(out)
        return out
# 定义ResNet网络
class ResNet(nn.Module):
    def __init__(self, block, layers, num_classes=1000):
        super(ResNet, self).__init__()
        self.in_channels = 64
        self.conv1 = nn.Conv2d(3, 64, kernel_size=7, stride=2, padding=3,
                               bias=False)
        self.bn1 = nn.BatchNorm2d(64)
        self.relu = nn.ReLU(inplace=True)
        self.maxpool = nn.MaxPool2d(kernel_size=3, stride=2, padding=1)
        self.layer1 = self._make_layer(block, 64, layers[0])
        self.layer2 = self._make_layer(block, 128, layers[1], stride=2)
        self.layer3 = self._make_layer(block, 256, layers[2], stride=2)
        self.layer4 = self._make_layer(block, 512, layers[3], stride=2)
        self.avgpool = nn.AdaptiveAvgPool2d((1, 1))
        self.fc = nn.Linear(512 * block.expansion, num_classes)
        # 初始化权重
        for m in self.modules():
            if isinstance(m, nn.Conv2d):
                nn.init.kaiming_normal_(m.weight, mode='fan_out', nonlinearity='relu')
            elif isinstance(m, nn.BatchNorm2d):
                nn.init.constant_(m.weight, 1)
                nn.init.constant_(m.bias, 0)
    def _make_layer(self, block, out_channels, blocks, stride=1):
        downsample = None
        if stride != 1 or self.in_channels != out_channels * block.expansion:
            downsample = nn.Sequential(
                nn.Conv2d(self.in_channels, out_channels * block.expansion,
                          kernel_size=1, stride=stride, bias=False),
                nn.BatchNorm2d(out_channels * block.expansion),
            )
        layers = []
        layers.append(block(self.in_channels, out_channels, stride, downsample))
        self.in_channels = out_channels * block.expansion
        for _ in range(1, blocks):
            layers.append(block(self.in_channels, out_channels))
        return nn.Sequential(*layers)
    def forward(self, x):
        x = self.conv1(x)
        x = self.bn1(x)
        x = self.relu(x)
        x = self.maxpool(x)
        x = self.layer1(x)
        x = self.layer2(x)
        x = self.layer3(x)
        x = self.layer4(x)
        x = self.avgpool(x)
        x = torch.flatten(x, 1)
        x = self.fc(x)
        return x
# 实例化ResNet-16模型
def resnet16(pretrained=False, **kwargs):
    model = ResNet(BasicBlock, [2, 2, 2, 2], **kwargs)
    if pretrained:
        # 这里没有预训练权重,如果需要预训练,可以在这里加载
        pass
    return model
# 创建模型实例
model = resnet16()
print(model)

标签:kernel,架构,nn,卷积,self,神经网络,3x3,Conv2d,size
From: https://www.cnblogs.com/apachecn/p/18545568

相关文章

  • 为什么卷积现在不火了:CNN研究热度降温的深层原因分析
    在深度学习领域,卷积神经网络(CNN)曾经是计算机视觉的代名词。自2012年AlexNet在ImageNet竞赛中取得突破性成功以来,CNN在图像识别、目标检测等领域掀起了一场革命。然而,纵观近年的顶会论文和研究热点,我们不得不承认一个现实:CNN相关的研究论文正在减少,曾经的"主角"似乎正逐渐淡出研究......
  • MySQL 中常见的几种高可用架构部署方案
    MySQL中的集群部署方案前言MySQLReplicationInnoDBClusterInnoDBClusterSetInnoDBReplicaSetMMMMHAGaleraClusterMySQLClusterMySQLFabric参考MySQL中的集群部署方案前言这里来聊聊,MySQL中常用的部署方案。MySQLReplicationMySQLReplication 是......
  • 软考之面向服务架构SOA
    面向服务架构(SOA)与单体架构的比较一、引言在软件开发的历史进程中,架构设计一直是影响系统性能、可维护性和扩展性的关键因素。单体架构和面向服务架构(Service-OrientedArchitecture,SOA)是两种常见的架构设计模式,分别代表了不同的设计理念和实践。单体架构以其简单和直观......
  • 【打破传统授信模型:基于深度神经网络 DNN模型的精确授信额度计算方法】-附完整python
    打破传统授信模型:基于深度神经网络DNN模型的精确额度计算方法模型结构概览数据预处理1.导入必要的库2.加载数据3.数据预处理4.构建深度神经网络模型5.模型训练与调参6.模型评估7.可视化训练过程9.完整代码深度神经网络(DeepNeuralNetwork,DNN),该模型通过K......
  • 架构与思维:微服务架构的思想本质
    架构与思维:微服务架构的思想本质 我们为什么需要微服务架构,它一定是为了解决我们某些问题才出现了。这篇文章我们讨论下微服务架构模式所解决的问题,带来的挑战,以及他的核心思想本质。1早期的服务架构上图是一个典型的服务分层架构:Client: 调用方是browserweb或者App应用......
  • DNS在架构中的使用
    DNS在架构中的使用 1介绍DNS(DomainNameSystem,域名系统)是一种服务,它是域名和IP地址相互映射的一个分布式数据库,能够使人更方便的访问互联网,而不用去记住能够被机器直接读取的IP地址数串。简单来说,DNS就是一个将我们输入的网址(比如www.baidu.com)转换成对应的IP地址(比如192......
  • 弹性伸缩:高可用架构利器(架构+算法+思维)
    弹性伸缩:高可用架构利器(架构+算法+思维) 1介绍云计算资源弹性伸缩是一种根据业务需求动态调整计算资源规模的技术。它可以根据系统的性能指标(如CPU使用率、内存占用率、磁盘IO、网卡读写率、请求响应时间等)或者预定义的规则(如时间周期、业务事件等),自动增加或减少计算资源的......
  • 微架构
    在硬件加速器中,微架构(Microarchitecture)指的是计算设备(如CPU、GPU、TPU等)内部的硬件设计和组织结构,它定义了硬件组件之间的具体布局、操作方式以及彼此如何交互。微架构可以视为硬件在逻辑层面的实现方式,确定了如何实现指令集架构(ISA)的细节。在微架构中,典型的组成部分包括:指令流......
  • 架构师之路-学渣到学霸历程-58
    Nginx的反向代理实验今天分享的实验其实就是一个变形;变形uri看看nginx的配置有什么区别;这个就更加绕,是比较不同的配置路径会有什么的区别?来看看这个变形会得出什么的效果1.首先配置后端服务器的资源首页资源–>192.168.75.73的配置如下#设置别名-->偷懒而已[root@Lin......
  • AI 产品的四层架构:开启智能未来的密码
    在人工智能飞速发展的今天,AI产品正逐渐渗透到我们生活的方方面面,从智能助手到自动驾驶,AI的应用正不断拓宽我们的想象边界。但构建一个成功的AI产品并非易事,它需要深入理解AI产品的架构和开发流程。AI对我们来说已经不算是新鲜词了,尤其是ChatGPT发布后,关于AI、大模型的讨论......