裸露土堆识别系统基于计算机人工智能视觉分析技术,裸露土堆识别系统利用建筑工地现场已有监控摄像头实时识别路面/建筑工的土堆裸露情况,若裸露土堆识别系统识别到监控画面中的土堆有超过40%部分没被绿色防尘网覆盖,系统则判定是裸露土堆,裸露土堆识别系统就会立即自动标注抓拍存档并反馈后台人员提醒及时处理,减少因人为因素导致的建筑工地土堆扬尘及大气污染。
Python是一门解释性脚本语言。解释性语言:解释型语言,是在运行的时候将程序翻译成机器语言;解释型语言的程序不需要在运行前编译,在运行程序的时候才翻译,专门的解释器负责在每个语句执行的时候解释程序代码,所以解释型语言每执行一次就要翻译一次,与之对应的还有编译性语言。编译性语言:编译型语言写的程序执行之前,需要一个专门的编译过程,把程序编译成为机器语言的文件,比如exe文件,以后要运行的话就不用重新翻译了,直接使用编译的结果就行了(exe文件),因为翻译只做了一次,运行时不需要翻译,所以编译型语言的程序执行效率一般来说较高。脚本语言:脚本语言又被称为扩建的语言,或者动态语言,是一种编程语言,用来控制软件应用程序,脚本通常以文本(如ASCII)保存,只在被调用时进行解释或编译。所以一般使用Python来实现特定功能而不是较为复杂的后端。
随着社会的发展和人们生活水平的提高大家更加注意环境质量卫生。经城市居民反馈,附近工地施工经常会导致满天风扬的尘土,带到城市街道及空气中,导致化境空气质量非常的差。针对这一情况,环保部门对工地进行排查,要求在城区在建工地的渣土土堆都穿上了衣裳,盖上了防尘遮阳网,并定时在防尘网上浇水,起到了很好的降尘效果。但是依旧会有不少裸露在外的土堆,导致扬尘空气环境不好。为此,裸露土堆识别系统应运而生。
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
裸露土堆识别系统通过现场已有的监控摄像头,对道路工地等土堆覆盖绿网进行7*24小时不间断全天候自动检测,如裸露土堆识别系统识别到土堆有超过40%部分没被绿色防尘网覆盖,立即抓拍同步提醒管理人员采取措施及时处理。裸露土堆识别系统极大提升了监控对裸土情况的识别,将传统被动监控转变为主动识别抓拍预警推送,大大保护了周边居民的环境空气质量。