水位标尺智能识别系统 CNN

水位标尺智能识别系统通过AI视频分析技术,水位标尺智能识别系统对河道湖泊水库等水位进行7*24小时实时自动监测,当水位标尺智能识别系统监测到河道湖泊水库水位到达警戒线时,立即抓拍存档告警,并同步回传后台提醒后台值班人员及时处理。水位标尺智能识别系统通过智能视频分析技术,可全天候自动及时掌握水位变化情况,充分发挥水位实时监测预警的作用,在避免经济和人员损失等方面有着重要意义。

在CNN中,我们就是通过不断的改变卷积核矩阵的值来关注不同的细节,提取不同的特征。也就是说,在我们初始化卷积核的矩阵值(即权重参数)后,我们通过梯度下降不断降低loss来获得最好的权重参数,整个过程都是自动调整的。由前述可知,在CNN中,卷积操作只是加权求和的线性操作。若神经网络中只用卷积层,那么无论有多少层,输出都是输入的线性组合,网络的表达能力有限,无法学习到非线性函数。因此CNN引入激活函数,激活函数是个非线性函数,常用于卷积层和全连接层输出的每个神经元,给神经元引入了非线性因素,使网络的表达能力更强,几乎可以逼近任意函数,这样的神经网络就可应用到众多的非线性模型中。

随着社会的发展和人们生活水平的快速提高,大家对于水域安全,人身和环境安全越来越重视。为了预防水灾,实时准确地监测江河湖泊水库水位是非常重要的,及时为防汛决策提供大量数据,因为我国是一个水灾多发的国家,警戒水位是我国防汛部门规定的,这对水位监测数据的及时性和有效性提出了较高的要求。近年来,随着AI视觉技术的应用,江河堤防的防洪能力将得到彻底提高,传统的人工测量方式得到变革加强,各江河堤防需要处于防守戒备状态的水位。

class Detect(nn.Module):
    stride = None  # strides computed during build
    onnx_dynamic = False  # ONNX export parameter

    def __init__(self, nc=80, anchors=(), ch=(), inplace=True):  # detection layer
        super().__init__()
        self.nc = nc  # number of classes
        self.no = nc + 5  # number of outputs per anchor
        self.nl = len(anchors)  # number of detection layers
        self.na = len(anchors[0]) // 2  # number of anchors
        self.grid = [torch.zeros(1)] * self.nl  # init grid
        self.anchor_grid = [torch.zeros(1)] * self.nl  # init anchor grid
        self.register_buffer('anchors', torch.tensor(anchors).float().view(self.nl, -1, 2))  # shape(nl,na,2)
        self.m = nn.ModuleList(nn.Conv2d(x, self.no * self.na, 1) for x in ch)  # output conv
        self.inplace = inplace  # use in-place ops (e.g. slice assignment)

    def forward(self, x):
        z = []  # inference output
        for i in range(self.nl):
            x[i] = self.m[i](x[i])  # conv
            bs, _, ny, nx = x[i].shape  # x(bs,255,20,20) to x(bs,3,20,20,85)
            x[i] = x[i].view(bs, self.na, self.no, ny, nx).permute(0, 1, 3, 4, 2).contiguous()

            if not self.training:  # inference
                if self.onnx_dynamic or self.grid[i].shape[2:4] != x[i].shape[2:4]:
                    self.grid[i], self.anchor_grid[i] = self._make_grid(nx, ny, i)

                y = x[i].sigmoid()
                if self.inplace:
                    y[..., 0:2] = (y[..., 0:2] * 2 - 0.5 + self.grid[i]) * self.stride[i]  # xy
                    y[..., 2:4] = (y[..., 2:4] * 2) ** 2 * self.anchor_grid[i]  # wh
                else:  # for YOLOv5 on AWS Inferentia https://github.com/ultralytics/yolov5/pull/2953
                    xy = (y[..., 0:2] * 2 - 0.5 + self.grid[i]) * self.stride[i]  # xy
                    wh = (y[..., 2:4] * 2) ** 2 * self.anchor_grid[i]  # wh
                    y = torch.cat((xy, wh, y[..., 4:]), -1)
                z.append(y.view(bs, -1, self.no))

        return x if self.training else (torch.cat(z, 1), x)

    def _make_grid(self, nx=20, ny=20, i=0):
        d = self.anchors[i].device
        if check_version(torch.__version__, '1.10.0'):  # torch>=1.10.0 meshgrid workaround for torch>=0.7 compatibility
            yv, xv = torch.meshgrid([torch.arange(ny).to(d), torch.arange(nx).to(d)], indexing='ij')
        else:
            yv, xv = torch.meshgrid([torch.arange(ny).to(d), torch.arange(nx).to(d)])
        grid = torch.stack((xv, yv), 2).expand((1, self.na, ny, nx, 2)).float()
        anchor_grid = (self.anchors[i].clone() * self.stride[i]) \
            .view((1, self.na, 1, 1, 2)).expand((1, self.na, ny, nx, 2)).float()
        return grid, anchor_grid

水位标尺智能识别系统基于智能视频分析,水位标尺智能识别系统自动对河道水面水尺进行分析识别,发现水尺水位信息达到警戒线无需人工干预水位标尺智能识别系统自动抓拍告警;水位标尺智能识别系统监测到湖泊河道水位达到警戒水位时,及时进行预警。随着科技的进步水位标尺智能识别系统有效的协助管理人员处理,发挥水位实时监测和预警的作用。

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值