占道经营流动商贩识别检测系统对道路情况进行实时监控,当识别到流动商贩占道经营时,占道经营流动商贩识别检测系统立即报警并提示相关人员妥善处理。占道经营流动商贩识别检测系统将报警截图和违规视频保存到本地,方便事后查询确认。占道经营流动商贩识别检测系统提高城市道路的监管效率,产生强大的威慑作用,提升效率。
在CNN出现之前,对于图像的处理一直都是一个很大的问题,一方面因为图像处理的数据量太大,比如一张512 x 512的灰度图,它的输入参数就已经达到了252144个,更别说1024x1024x3之类的彩色图,这也导致了它的处理成本十分昂贵且效率极低。另一方面,图像在数字化的过程中很难保证原有的特征,这也导致了图像处理的准确率不高。
而CNN网络能够很好的解决以上两个问题。对于第一个问题,CNN网络它能够很好的将复杂的问题简单化,将大量的参数降维成少量的参数再做处理。也就是说,在大部分的场景下,我们使用降维不会影响结果。比如在日常生活中,我们用一张1024x1024x3表示鸟的彩色图和一张100x100x3表示鸟的彩色图,我们基本上都能够用肉眼辨别出这是一只鸟而不是一只狗。这也是卷积神经网络在图像分类里的一个重要应用。
占道经营流动商贩危害公路交通,大多数流动商贩是在繁忙的道路、工厂大门、学校大门、社区大门和其他人流量多的地方,以及大多数交通高峰期。某种程度上会影响城市形象。随着城市规划建设步伐的不断加快,大城市的基础设施越来越完善,对城市形象及整洁程度提出了更高的要求。
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__()
= nc # number of classes
self.no = nc + 5 # number of outputs per anchor
self.nl = len(anchors) # number of detection layers
= 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 * , 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.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:///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, , ny, nx, 2)).float()
anchor_grid = (self.anchors[i].clone() * self.stride[i]) \
.view((1, , 1, 1, 2)).expand((1, , ny, nx, 2)).float()
return grid, anchor_grid
占道经营流动商贩识别检测系统对城市道路进行实时检测,当系统发现违规摆摊行为时,占道经营流动商贩识别检测系统可以根据违规抓拍的时间、违规视频和违规截图查询,大大提高了监控区域的率。占道经营流动商贩识别检测系统充分提前及时预警违规行为信息,合理填补城市道路传统监控的不足。