程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式師世界 >> 編程語言 >  >> 更多編程語言 >> Python

Vacation is coming! How to realize the security system of scenic spots with Python

編輯:Python


author  | Li Qiujian

Produce | AI Technology base (ID:rgznai100)

introduction : In recent years , With the sustained and rapid development of tourism in China , The number of domestic tourists has increased year by year , Tourist attractions everywhere are full of tourists . With the rapid growth of tourism consumption demand , With more and more scenic spot management problems , There are serious hidden dangers in the public safety of scenic spots . Therefore, an intelligent system for scenic spot safety protection is designed , It has important practical significance for the safety protection and intelligent construction of scenic spots . This project aims to adopt computer vision and PC Software development technology , Carry out a series of practices around the safety of scenic spots , Finally, a set of intelligent scenic spot security system was built , It is applied to fire prevention and monitoring in scenic spots 、 Epidemic prevention and control 、 Tourist safety positioning and other work .

In this design , utilize YOLO Target detection algorithm 、Openpose Attitude recognition algorithm 、deepsort Tracking algorithm 、MSCNN The crowd density estimation algorithm realizes fire monitoring 、 Smoking monitoring 、 Behavior safety monitoring 、 Crowd density monitoring 、 Mask rate monitoring 、 Six functions of personnel positioning and monitoring . The system uses intelligent visual interaction technology , Users can operate the system through gestures , User operation is convenient and concise . Assist the security management of scenic spots from multiple angles and directions , It reduces the hidden security risks in the scenic spot , Promote the intelligent construction of scenic spots . This system realizes real-time data transmission and feedback among various functions , Ensure the effectiveness of information , It can run on the mobile terminal 、 Computer side and Internet of things platform multiple platforms , At the same time, it really realizes “ Multi-platform application ”.

A multifunctional intelligent security system designed with a variety of algorithms , It is mainly used for fire prevention and monitoring in scenic spots 、 Epidemic prevention and control 、 Tourist safety positioning, etc , It has important application value for the safety protection and intelligent construction of scenic spots .

Basic introduction

The system is based on computer multimedia technology 、 Intelligent image analysis technology 、 Based on data mining technology , Build a comprehensive security management system for tourist attractions . For personal safety in the public activity area of the scenic spot , Forest fire prevention management , Epidemic prevention and control management and other needs , It is required to build all-round 、 all-weather 、 High definition 、 Intelligent video monitoring system , To meet the safety management needs of modern tourist attractions , Realize panoramic monitoring of large scenes , Fire in scenic spots 、 Detect emergencies such as tourists' dangerous behaviors . Realize real-time personnel positioning 、 Track query , When an emergency occurs, the linkage map will flash a warning , And facilitate emergency command . At the same time, it meets the requirements of personnel management and passenger flow analysis system , It is necessary to count and analyze the passenger flow at the entrance and exit , When the scenic spot exceeds a certain passenger flow capacity, it can give a timely warning to stop tourists from entering and carry out appropriate tourist diversion disposal .

Combined with actual needs and system architecture planning of smart scenic spots , The comprehensive security system of tourist attractions consists of an intelligent monitoring system 、 Intelligent visual interaction 、 Multi angle and multi orientation 、 Multi platform application consists of four modules , Integrate fire monitoring 、 Smoking monitoring 、 Behavior safety monitoring 、 Crowd density monitoring 、 Mask rate monitoring 、 Personnel positioning monitoring heterogeneous security subsystem .

The overall design architecture of the system is shown in the figure below :

Basic function display

1、 System Overview

The development platform of this intelligent monitoring system is Pycharm, Use python Language , It is divided into six systems .

2、 Fire monitoring system

This module is monitored by real-time video , Analyze whether there is fire in the video . As shown in the picture , If there is a fire in the scenic spot , The system will send out early warning information in time , Feedback to the control room , So that the fire can be effectively controlled , Greatly improve the efficiency of fire response .

3、 Smoking monitoring system

In order to prevent fire in the scenic spot , Most areas of the scenic spot are non-smoking areas . This module is monitored by real-time video , Analyze whether the video has smoking behavior . As shown in the picture , If there are tourists who smoke , The system will send out early warning information in time , Feedback to the control room , Discover the potential safety hazards of tourists smoking at the first time , Prevent fire , Ensure the safety of the scenic spot .

4、 Behavior safety monitoring system

In the process of scenic spot tourism , Tourists' personal safety must be guaranteed . This module is monitored by real-time video , Analyze the human body movements in the video , If abnormal behavior occurs, see the figure “ Fall down ” And other dangerous behaviors can send early warning information in time . It can greatly shorten the rescue time , Reduce the losses caused by emergencies , Protect the safety of tourists' lives and property .

5、 Crowd density monitoring system

Affected by the new crown epidemic , The scenic spot needs to reasonably control the population density in the scenic spot . This module can realize the dynamic monitoring of the tourist population density in the scenic spot , Through intelligent analysis , Display the crowd density on the system page in real time , Help users manage scenic spots , Effectively protect the vast number of tourists 、 Health and life safety of employees , Maintain the overall situation of scenic spots and social stability .

6、 Mask rate monitoring system

To prevent the spread of novel coronavirus , According to the relevant regulations of the scenic spot , Passengers need to be confirmed before entering the scenic spot . This module is monitored by real-time video , Analyze whether tourists wear masks in the video , Whether each tourist wears a mask will be marked , Display the results on the system , And display the wearing rate of masks in real time . It is used for epidemic prevention in scenic spots , Protect tourists , Protect scenic spots .

7、 Personnel tracking, positioning and monitoring

This module carries out real-time video monitoring of scenic spots , Analyze and identify tourists in the video , Automatically generate identification labels , Record the position of the tourist tag in the scene in real time , And display in the system page , And it can monitor the number of people in the scene , It is dynamically displayed on the left side of the system page . Assist users to manage scenic spots .

8、 Intelligent visual interaction

This system can replace the traditional method of mouse click module application , Users can complete the information interaction with the system without using input devices such as mouse . Users can complete the selection of modules through body movements , The system operation is more concise , It's more user-friendly .( Only the fire detection function is designed here , Other functions can be written according to the code reference .)

It's about algorithms

1、 Target detection algorithm

The target detection algorithm used in this project is mainly YOLO Algorithm , Respectively applied to fire monitoring 、 Smoking behavior monitoring 、 Personnel location tracking and mask rate monitoring .YOLO The target detection algorithm takes into account the low detection efficiency of the two-stage target detection algorithm , Therefore, some scholars have proposed single-stage target detection . from JosephRedmon Et al. 2016 in .

2、 Target tracking algorithm

This project uses in the personnel positioning and tracking system deepsort Target tracking algorithm . The process tracked by this system is as follows :

(1) Using convolutional neural network to detect and track pedestrians in video .

(2) After video frame input, enter YOLOv3 Target detection network , after Darknet-53 The extracted features ;

(3) secondly , Upsampling and feature fusion , Then carry out regression analysis ;

(4) Again , Input the obtained prediction box information SORT Algorithm for target feature modeling , Match and track ;

(5) Last , Output results . The following figure shows the flow chart of location tracking algorithm :

3、 Crowd density estimation algorithm

Crowd density counting refers to estimating the number of people in an image or video 、 Density or distribution , It is a key problem and research hotspot in the field of intelligent video surveillance and analysis , It is also the follow-up behavior analysis 、 Congestion analysis 、 The foundation of advanced video processing tasks such as anomaly detection and event detection .

This project has estimated the number of people by using the deep learning method to obtain the population density map , Use python Language construction MSCNN The network realizes the real-time generation of population density map to estimate the number of people .

4、 Attitude estimation algorithm

This project uses Openpose Human posture recognition algorithm . adopt Openpose The posture recognition technology of builds a classification algorithm for the coordination relationship between different limbs , And through the comparison of different classification algorithms , Choose the optimal model to build a multi-objective classification method , It can realize the posture display of multiple targets 、 Real time display of target detection and classification .

Some interface operation codes are as follows :

cap = cv2.VideoCapture(0)
cap.set(3, 1280)
cap.set(4, 720)
detector = HandDetector(detectionCon=0.8)
keys = [[" Fire detection ", " Smoking test ", " Behavior safety monitoring ", " Crowd density monitoring ", " Mask rate detection ", " Pedestrian location tracking "]]
finalText = ""
while True:
success, img = cap.read()
img = detector.findHands(img)
lmList, bboxInfo = detector.findPosition(img)
img = drawAll(img, buttonList)
if lmList:
for button in buttonList:
x, y = button.pos
w, h = button.size
if x < lmList[8][0] < x + w and y < lmList[8][1] < y + h:
cv2.rectangle(img, (x - 5, y - 5), (x + w + 5, y + h + 5), (175, 0, 175), cv2.FILLED)
if l < 30:
if press_state:
cv2.rectangle(img, button.pos, (x + w, y + h), (0, 255, 0), cv2.FILLED)
cv2.putText(img, "start", (x + 20, y + 65),cv2.FONT_HERSHEY_PLAIN, 4, (255, 255, 255), 4)
finalText += button.text
sleep(0.15)
press_state=False
state=True
print(button.text)
text=button.text
else:
press_state=True
if state:
if os.path.exists("img.txt"):
try:
img2 = cv2.imread("img.jpg")
img2 = cv2.resize(img2, (img.shape[1], img.shape[0]))
img = cv2.addWeighted(img, alpha, img2, beta, gamma)
except:
pass
if state:
img = Image.fromarray(cv2.cvtColor(img, cv2.COLOR_BGR2RGB))
draw = ImageDraw.Draw(img)
myfont0 = ImageFont.truetype(r'./HGDH_CNKI.TTF', 50)
for button in buttonList:
x, y = button.pos
w, h = button.size
draw.text((500, 180), text, font=myfont0, fill=(0, 0, 0))
img = cv2.cvtColor(np.asarray(img), cv2.COLOR_RGB2BGR)
cv2.imshow("Image", img)
cv2.waitKey(1)

Complete code :

https://download.csdn.net/download/qq_42279468/85833771

Li Qiujian ,CSDN Blogger ,CSDN Author of talent course . Master's degree in China University of mining and Technology , Development has taptap Competition awards, etc .

Looking back

NLP Exploration and practice of class problem modeling scheme

Python Common encryption algorithms in crawlers !

2D Transformation 3D, Look at NVIDIA's AI“ new ” magic !

Get it done Python Several common data structures !

 Share
Point collection
A little bit of praise
Click to see 

  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式師世界 All Rights Reserved