在很多实际作业生产场景中,出于对安全的考虑,施工作业等操作都是要求必须穿戴安全帽的,这个主要是为了保护人身安全,但是很多时候工程作业场景下因为实际种种的原因工人实际作业操作的时候很多人并没有按照要求穿戴安全帽这就给安全生产带来了危险隐患。
本文主要是考虑基于深度学习目标检测的方法来实现自动化的未穿戴安全帽检测识别从而助力安全作业生产,话不多说首先看下效果图:
![](https://i-blog.csdnimg.cn/blog_migrate/006fa39c7ce162a1eefddda851b93c8b.gif)
首先看下数据集:
![](https://i-blog.csdnimg.cn/blog_migrate/3bd4e1d5c495f601937804b731ffcdea.png)
YOLO格式的标注数据集如下:
![](https://i-blog.csdnimg.cn/blog_migrate/77baa0edd3d30462c3e7e7173798a891.png)
实例标注内容如下:
1 0.354567 0.230769 0.103365 0.120192
1 0.844952 0.356971 0.055288 0.064904
1 0.354567 0.105769 0.103365 0.120192
1 0.84375 0.007212 0.057692 0.014423
VOC格式的标注数据如下:
![](https://i-blog.csdnimg.cn/blog_migrate/ae95a3d78faef206a35564e5d0fbaee4.png)
实例标注数据如下:
<annotation>
<folder>images</folder>
<filename>0a05c09b-d87b-4ee8-bd96-a32883c6373f.jpg</filename>
<size>
<width>416</width>
<height>415</height>
<depth>3</depth>
</size>
<segmented>0</segmented>
<object>
<name>head</name>
<pose>Unspecified</pose>
<truncated>0</truncated>
<occluded>0</occluded>
<difficult>0</difficult>
<bndbox>
<xmin>20</xmin>
<ymin>148</ymin>
<xmax>38</xmax>
<ymax>172</ymax>
</bndbox>
</object>
<object>
<name>head</name>
<pose>Unspecified</pose>
<truncated>0</truncated>
<occluded>0</occluded>
<difficult>0</difficult>
<bndbox>
<xmin>64</xmin>
<ymin>152</ymin>
<xmax>81</xmax>
<ymax>176</ymax>
</bndbox>
</object>
<object>
<name>head</name>
<pose>Unspecified</pose>
<truncated>0</truncated>
<occluded>0</occluded>
<difficult>0</difficult>
<bndbox>
<xmin>99</xmin>
<ymin>134</ymin>
<xmax>127</xmax>
<ymax>173</ymax>
</bndbox>
</object>
<object>
<name>head</name>
<pose>Unspecified</pose>
<truncated>0</truncated>
<occluded>0</occluded>
<difficult>0</difficult>
<bndbox>
<xmin>156</xmin>
<ymin>149</ymin>
<xmax>179</xmax>
<ymax>174</ymax>
</bndbox>
</object>
<object>
<name>head</name>
<pose>Unspecified</pose>
<truncated>0</truncated>
<occluded>0</occluded>
<difficult>0</difficult>
<bndbox>
<xmin>197</xmin>
<ymin>139</ymin>
<xmax>226</xmax>
<ymax>172</ymax>
</bndbox>
</object>
<object>
<name>head</name>
<pose>Unspecified</pose>
<truncated>0</truncated>
<occluded>0</occluded>
<difficult>0</difficult>
<bndbox>
<xmin>251</xmin>
<ymin>124</ymin>
<xmax>279</xmax>
<ymax>156</ymax>
</bndbox>
</object>
<object>
<name>head</name>
<pose>Unspecified</pose>
<truncated>0</truncated>
<occluded>0</occluded>
<difficult>0</difficult>
<bndbox>
<xmin>304</xmin>
<ymin>146</ymin>
<xmax>333</xmax>
<ymax>180</ymax>
</bndbox>
</object>
<object>
<name>head</name>
<pose>Unspecified</pose>
<truncated>0</truncated>
<occluded>0</occluded>
<difficult>0</difficult>
<bndbox>
<xmin>359</xmin>
<ymin>138</ymin>
<xmax>390</xmax>
<ymax>176</ymax>
</bndbox>
</object>
</annotation>
yolov7官方夏目在这里,首页截图如下所示:
![](https://i-blog.csdnimg.cn/blog_migrate/b248deeac439272dd074bad0acd73463.png)
![](https://i-blog.csdnimg.cn/blog_migrate/0716afc366650fcdd4c8df8170a25b23.png)
YOLO融合Transformer在我之前的文章里面已经应用过了,感兴趣的话可以自行移步阅读:
《基于轻量级YOLOv5+Transformer的汽车车损检测识别分析系统》
这里就简单看下了:
![](https://i-blog.csdnimg.cn/blog_migrate/bd35198002b750cf1a4e033815275a27.png)
默认100次的epoch迭代计算,看下结果详情:
LABEL可视化:
![](https://i-blog.csdnimg.cn/blog_migrate/a39f1da4ad4ab8c8a3fe70bcd099cd50.png)
F1值曲线:
![](https://i-blog.csdnimg.cn/blog_migrate/b952cfbdbd0812ff18500ce9e8624050.png)
PR曲线:
![](https://i-blog.csdnimg.cn/blog_migrate/213d41962341a76e3a87a5786a6d09e3.png)
混淆矩阵:
![](https://i-blog.csdnimg.cn/blog_migrate/b207f8744319ce1d497eda82e2cf102b.png)
训练可视化:
![](https://i-blog.csdnimg.cn/blog_migrate/ded2cf20e28970515a8fe66997bc8596.png)
batch检测样例如下:
![](https://i-blog.csdnimg.cn/blog_migrate/075a661f1cba2fc22a0a305b9df3ad0c.png)
界面可视化推理如下:
![](https://i-blog.csdnimg.cn/blog_migrate/6c1ca1b9a5ab9272252607a34484f375.png)
![](https://i-blog.csdnimg.cn/blog_migrate/e7ceb22bf7a55cd9b08a53d7e1739456.png)