Skip to content

Commit

Permalink
完善 人、头盔、头 的权重,使用 yolov5 测试出人体,在进行对 人、头盔、头 的训练
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterH0323 committed Aug 1, 2020
1 parent 520717a commit a5c6293
Show file tree
Hide file tree
Showing 15 changed files with 20 additions and 3 deletions.
19 changes: 17 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Smart_Construction
该项目是使用 YOLOv5 来训练在智能工地安全领域中头盔目标检测的应用

![](https://github.com/PeterH0323/Smart_Construction/blob/master/doc/output_1.png?raw=true)
![](https://github.com/PeterH0323/Smart_Construction/blob/master/doc/output_1.jpg?raw=true)
![](https://github.com/PeterH0323/Smart_Construction/blob/master/doc/output_2.jpg?raw=true)
![](https://github.com/PeterH0323/Smart_Construction/blob/master/doc/output_3.jpg?raw=true)
![](https://github.com/PeterH0323/Smart_Construction/blob/master/doc/output_4.png?raw=true)
![](https://github.com/PeterH0323/Smart_Construction/blob/master/doc/output_4.jpg?raw=true)

# YOLO v5训练自己数据集教程
使用的数据集:[Safety-Helmet-Wearing-Dataset](https://github.com/njvisionpower/Safety-Helmet-Wearing-Dataset) ,感谢这位大神的开源数据集!
Expand Down Expand Up @@ -123,3 +123,18 @@ $ python detect.py --source 0 # webcam
rtsp://170.93.143.139/rtplive/470011e600ef003a004ee33696235daa # rtsp stream
http://112.50.243.8/PLTV/88888888/224/3221225900/1.m3u8 # http stream
```


## 检测危险区域内是否有人

### 危险区域标注方式
我这里使用的是 [精灵标注助手](http://www.jinglingbiaozhu.com/) 标注,生成了对应图片的 json 文件

### 执行侦测,在危险区域里面的任务会被框选出来

侦测图片会保存在 `./inferenct/output/` 文件夹下

运行命令:
```shell script
$ python area_detect.py --source ./area_dangerous --weights ./weights/pro_helmet_head_person.pt
```
Binary file added area_dangerous/1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added area_dangerous/2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions area_dangerous/area_labels/1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"path":"E:\\AI_Project\\Smart_Construction_Project\\area_dangerous\\1.jpg","outputs":{"object":[{"name":"dangerous","bndbox":{"xmin":484,"ymin":111,"xmax":620,"ymax":290}}]},"time_labeled":1596282882403,"labeled":true,"size":{"width":1023,"height":682,"depth":3}}
1 change: 1 addition & 0 deletions area_dangerous/area_labels/2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"path":"E:\\AI_Project\\Smart_Construction_Project\\area_dangerous\\2.jpg","outputs":{"object":[{"name":"dangerous","bndbox":{"xmin":265,"ymin":3,"xmax":630,"ymax":418}}]},"time_labeled":1596282897538,"labeled":true,"size":{"width":640,"height":427,"depth":3}}
2 changes: 1 addition & 1 deletion area_detect.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def detect(save_img=False):
if save_img or view_img: # Add bbox to image
label = '%s %.2f' % (names[int(cls)], conf)
if names[int(cls)] == "person":
判断是否在危险区域内
# 判断是否在危险区域内
if person_in_area_dangerous(xyxy, Path(p).name) == 1:
# 返回 1 表明是在危险区域,框住人
plot_one_box(xyxy, im0, label=label, color=colors[int(cls)], line_thickness=3)
Expand Down
Binary file added doc/output_1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed doc/output_1.png
Binary file not shown.
Binary file modified doc/output_2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified doc/output_3.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/output_4.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed doc/output_4.png
Binary file not shown.
Binary file modified doc/test_batch0_gt.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed weights/helmet_head_person.pt
Binary file not shown.
Binary file added weights/pro_helmet_head_person.pt
Binary file not shown.

0 comments on commit a5c6293

Please sign in to comment.