提取图像中直线的直线方程的神经网络

描述:

  • 一张图片中画有一条带噪音的直线,求这条线的方程
  • 这些线的粗细,颜色等等都不一样。

做这个事情的目的有:

  • 因为可以自动产生大量的训练数据,所以方便用来研究简单的神经网络的规律
    • 大神经网络小神经网络的区别
    • 训练的规律
    • 误差函数,目标设定的规律
    • 数据的需求的规律
  • 对线的提取也是图像相关的应用中重要的能力。这类的网络后面可以用在功能更复杂的网络中

网络

  • class Net(nn.Module):
        def __init__(self):
            super(Net, self).__init__()
            # 1 input image channel, 6 output channels, 3x3 square convolution
            # kernel
            self.conv1 = nn.Conv2d(1, 6, 3)
            self.conv2 = nn.Conv2d(6, 16, 3)
            # an affine operation: y = Wx + b
            self.fc1 = nn.Linear(16 * 6 * 6, 120)  # 6*6 from image dimension
            self.fc2 = nn.Linear(120, 84)
            self.fc3 = nn.Linear(84, 3)
        def forward(self, x):
            # Max pooling over a (2, 2) window
            x = F.max_pool2d(F.relu(self.conv1(x)), (2, 2))
            # If the size is a square you can only specify a single number
            x = F.relu(self.conv2(x))
            x = F.max_pool2d(x, 2)
            x = x.view(-1, self.num_flat_features(x))
            x = F.relu(self.fc1(x))
            x = F.relu(self.fc2(x))
            x = self.fc3(x)
            return x

     

分析:

  • 训练方式
    • 每次都是不一样的图片
    • 先把一批训练好,然后换一批训练
    • 储备很大一批图片,随机抽取训练
  • batch大小
  • loss函数
  • target设置
    • 点方程归一化
    • 直线方程
    • 直线方程归一化
  • 不同的网络结构
  • leanring rate
  • loss下降规律

结论

你可能感兴趣的:(深度学习)