


The holidays are coming! How technicians use Python to implement scenic spot security systems
In this design, the YOLO target detection algorithm, Openpose gesture recognition algorithm, deepsort tracking algorithm, and MSCNN crowd density estimation algorithm are used to implement fire monitoring, smoking monitoring, behavioral safety monitoring, crowd density monitoring, mask rate monitoring, and personnel positioning. Monitor six major functions. The system uses intelligent visual interaction technology, and users can operate the system through gestures, making the operation convenient and concise. Assisting the security management of scenic spots from multiple angles and aspects, reducing hidden safety hazards in scenic spots and promoting the intelligent construction of scenic spots. The various functions of this system realize real-time transmission and feedback of data, ensuring the validity of the information. It can run on multiple platforms such as mobile phones, computers and Internet of Things platforms. It also realizes "multi-platform" in the true sense. application".
A multifunctional intelligent security system designed with a variety of algorithms. It is mainly used in fire prevention and monitoring, epidemic prevention and control, tourist safety positioning, etc. in scenic spots. It is very important for the safety of scenic spots. Protection and intelligent construction of scenic spots have important application value.
Basic introduction
This system is based on computer multimedia technology, intelligent image analysis technology, data mining technology, etc., to build a comprehensive security management system for tourist attractions. In response to the needs of personal safety, forest fire prevention management, epidemic prevention and control management in public activity areas in scenic spots, it is required to build an all-round, all-weather, high-definition, and intelligent video surveillance system to meet the needs of modern tourist attraction safety management and realize large-scale scenarios Panoramic monitoring detects emergencies such as fires in scenic spots and dangerous behaviors of tourists. It can realize real-time positioning and trajectory query of personnel, and link the map to flash warnings when an emergency occurs, and facilitate emergency command. At the same time, it meets the 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 diversion of tourists. Combined with the actual needs and the system architecture planning of smart scenic spots, the comprehensive security system of tourist attractions consists of four modules: intelligent monitoring system, intelligent visual interaction, multi-angle and multi-directional, and multi-platform applications. It integrates fire monitoring, smoking monitoring, behavioral safety monitoring, and crowd monitoring. Density monitoring, mask rate monitoring, and personnel positioning monitoring heterogeneous security subsystems. The overall design architecture of the system is as follows:
5. Crowd density monitoring system
Affected by the new coronavirus epidemic, scenic spots need to reasonably control the population density in the scenic spot. Through this module, the dynamic monitoring of the tourist population density in scenic spots can be realized. Through intelligent analysis, the crowd density can be displayed on the system page in real time to help users manage the scenic spots, effectively protect the health and life safety of tourists and employees, and maintain the scenic spots and overall social stability.
6. Mask rate monitoring system
In order to prevent the spread of the new coronavirus, according to the relevant regulations of the scenic spot, passengers need to be identified before entering the scenic spot. This module uses real-time video monitoring to analyze whether tourists in the video are wearing masks, will mark whether each tourist is wearing a mask, display the results on the system, and display the scene mask wearing rate in real time. Used for epidemic prevention work in scenic spots, to protect tourists and scenic spots.
7. Personnel tracking and positioning monitoring
This module conducts real-time video monitoring of the scenic spot, analyzes and identifies tourists in the video, and automatically generates identification tags to The position of the tourist tag in the scene is recorded in real time and displayed on the system page. The number of people in the scene can be monitored and 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 mouse click module application method, and users do not need to use input devices such as a mouse. Complete information interaction with the system. Users can complete module selection through body movements, making the system operation simpler and more convenient for users to use. (Only the fire detection function is designed here, other functions can be written according to the code reference.)
Involving algorithm
1. Target detection algorithm
The target detection algorithm used in this project is mainly the YOLO algorithm, which is used in fire monitoring, smoking behavior monitoring, personnel positioning tracking and mask rate monitoring. The YOLO target detection algorithm considers that the detection efficiency of the two-stage target detection algorithm is relatively low, so some scholars have proposed single-stage target detection. Proposed by Joseph Redmon et al. in 2016.
2. Target tracking algorithm
This project uses the deepsort target tracking algorithm in the personnel positioning and tracking system. The tracking process of this system is as follows:
(1) Use convolutional neural network to detect and track pedestrians in the video.
(2) After the video frame is input, it first enters the YOLOv3 target detection network and extracts features through Darknet-53;
(3) Secondly, upsampling and feature fusion are performed, and then regression analysis is performed. ;
(4) Again, input the obtained prediction box information into the SORT algorithm for target feature modeling, matching and tracking;
(5) Finally, output the result. The following figure is the flow chart of the positioning 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 issue and research hotspot in the field of intelligent video surveillance analysis, and is also the basis for advanced video processing tasks such as subsequent behavior analysis, congestion analysis, anomaly detection, and event detection. This project uses deep learning methods to obtain crowd density maps to estimate the number of crowds, and uses python language to build an MSCNN network to generate crowd density maps in real time to estimate the number of crowds.
4. Posture estimation algorithm
This project uses Openpose’s human posture recognition algorithm on the human behavior safety monitoring system. Use Openpose's posture recognition technology to build a classification algorithm for the coordination relationship between different limbs, and compare different classification algorithms to select the optimal model to build a multi-target classification method, which can achieve posture display and target detection of multiple targets. and real-time display of categories.
Part of the interface operation code is as follows:
cap = cv2.VideoCapture(0) cap.set(3, 1280) cap.set(4, 720) detector = HandDetector(detectionCon=0.8) keys = [["火灾检测", "吸烟检测", "行为安全监测", "人群密度监测", "口罩率检测", "行人定位跟踪"]] 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)
The above is the detailed content of The holidays are coming! How technicians use Python to implement scenic spot security systems. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



In VS Code, you can run the program in the terminal through the following steps: Prepare the code and open the integrated terminal to ensure that the code directory is consistent with the terminal working directory. Select the run command according to the programming language (such as Python's python your_file_name.py) to check whether it runs successfully and resolve errors. Use the debugger to improve debugging efficiency.

VS Code can be used to write Python and provides many features that make it an ideal tool for developing Python applications. It allows users to: install Python extensions to get functions such as code completion, syntax highlighting, and debugging. Use the debugger to track code step by step, find and fix errors. Integrate Git for version control. Use code formatting tools to maintain code consistency. Use the Linting tool to spot potential problems ahead of time.

VS Code extensions pose malicious risks, such as hiding malicious code, exploiting vulnerabilities, and masturbating as legitimate extensions. Methods to identify malicious extensions include: checking publishers, reading comments, checking code, and installing with caution. Security measures also include: security awareness, good habits, regular updates and antivirus software.

VS Code can run on Windows 8, but the experience may not be great. First make sure the system has been updated to the latest patch, then download the VS Code installation package that matches the system architecture and install it as prompted. After installation, be aware that some extensions may be incompatible with Windows 8 and need to look for alternative extensions or use newer Windows systems in a virtual machine. Install the necessary extensions to check whether they work properly. Although VS Code is feasible on Windows 8, it is recommended to upgrade to a newer Windows system for a better development experience and security.

Python excels in automation, scripting, and task management. 1) Automation: File backup is realized through standard libraries such as os and shutil. 2) Script writing: Use the psutil library to monitor system resources. 3) Task management: Use the schedule library to schedule tasks. Python's ease of use and rich library support makes it the preferred tool in these areas.

VS Code is the full name Visual Studio Code, which is a free and open source cross-platform code editor and development environment developed by Microsoft. It supports a wide range of programming languages and provides syntax highlighting, code automatic completion, code snippets and smart prompts to improve development efficiency. Through a rich extension ecosystem, users can add extensions to specific needs and languages, such as debuggers, code formatting tools, and Git integrations. VS Code also includes an intuitive debugger that helps quickly find and resolve bugs in your code.

VS Code not only can run Python, but also provides powerful functions, including: automatically identifying Python files after installing Python extensions, providing functions such as code completion, syntax highlighting, and debugging. Relying on the installed Python environment, extensions act as bridge connection editing and Python environment. The debugging functions include setting breakpoints, step-by-step debugging, viewing variable values, and improving debugging efficiency. The integrated terminal supports running complex commands such as unit testing and package management. Supports extended configuration and enhances features such as code formatting, analysis and version control.

Python is more suitable for beginners, with a smooth learning curve and concise syntax; JavaScript is suitable for front-end development, with a steep learning curve and flexible syntax. 1. Python syntax is intuitive and suitable for data science and back-end development. 2. JavaScript is flexible and widely used in front-end and server-side programming.
