Street lamp control method, device and system based on improved YOLOv7 and quantitative acceleration and medium

By improving the quantitative acceleration and network structure optimization of the YOLOv7 model, the problems of low object detection model efficiency and poor real-time performance in the intelligent street light control system are solved, efficient video processing and intelligent lighting effects are achieved, hardware costs are reduced, and system performance is improved. and real-time.

CN118714711APending Publication Date: 2024-09-27JINAN UNIVERSITY
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202410917900.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-10
Publication Date
2024-09-27

AI Technical Summary

Technical Problem

In the existing intelligent street light control system, the object detection model based on deep learning is inefficient when running on a hardware platform with limited resources and cannot achieve real-time processing, especially in multi-channel video surveillance scenarios, resulting in low detection efficiency and poor real-time performance. problem.

Method used

The improved YOLOv7 model is used for quantification acceleration, and TensorRT is used to accelerate inference and quantification processing of the lightweight YOLOv7 model. It prunes and replaces network layers, combines ShuffleNet and MobileNetV2 to improve detection efficiency, and dynamically adjusts street light brightness according to detection results.

Benefits of technology

It achieves efficient video processing capabilities in environments with limited computing resources, improves the video processing capabilities and monitoring efficiency of smart street light systems, reduces hardware costs, ensures detection performance and real-time performance, and dynamically adjusts street light brightness to achieve energy-saving goals.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118714711A
    Figure CN118714711A
Patent Text Reader

Abstract

The invention relates to a street lamp control method, device and system based on improved YOLOv7 and quantitative acceleration, and a medium. The method comprises the following steps: receiving a target video image generated by monitoring a target area within a preset street lamp turn-on time; according to the method, a target video image is preprocessed, moving target identification is carried out in the preprocessed target video image by using a target identification engine which has been subjected to accelerated reasoning to obtain an identification result, and the target identification engine is generated by adopting TensorRT to carry out accelerated reasoning and quantitative processing on a lightweight YOLOv7 model. The lightweight YOLOv7 model is generated by performing pruning on a target network layer in a Head network of the standard YOLOv7 model after a depth multiplier and a width multiplier of the standard YOLOv7 model are adjusted, and replacing E-ELANs in a BackBone network and a Neck network of the standard YOLOv7 model by using ShuffleNet and Mobile NetV2; and in the identification result, detecting a target label, and according to the detection result and a preset brightness control strategy, carrying out brightness control on a preset street lamp located in the target area.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of intelligent street lamp control technology, and in particular to a street lamp control method, device, system and medium based on improved YOLOv7 and quantized acceleration. Background Art

[0002] In the intelligent street light control system, video surveillance is used to detect pedestrians and vehicles to dynamically adjust the brightness of street lights, which not only improves energy efficiency but also increases urban safety.

[0003] In the related technology, existing video surveillance systems generally use object detection models based on deep learning, such as the YOLO (You Only Look Once) series. However, the use of deep learning-based object detection models faces significant challenges when processing large-scale real-time data. These object detection models are less efficient when running on resource-limited hardware platforms, especially in scenarios where multiple channels of video data need to be processed. For example, the object detection model built with the YOLOv7 algorithm cannot meet the requirements of real-time processing when running on resource-limited devices (such as Jetson Nano). At the same time, multi-channel video surveillance is difficult to achieve in an environment with limited hardware resources.

[0004] In the related art, the intelligent street lamp control system is controlled by adopting high-performance hardware or a simplified detection model, but there are defects such as high cost or the need to sacrifice detection accuracy.

[0005] Currently, no effective solution has been proposed for the problems of low detection efficiency and poor real-time performance of object detection models used in intelligent street light control systems in related technologies. Summary of the invention

[0006] The embodiments of the present application provide a street light control method, device, system and medium based on improved YOLOv7 and quantized acceleration, so as to at least solve the problems of low detection efficiency and poor real-time performance of object detection models applied to intelligent street light control systems in related technologies.

[0007] In a first aspect, an embodiment of the present application provides a street light control method based on improved YOLOv7 and quantization acceleration, comprising: receiving a target video image generated by monitoring a target area within a preset street light on time; preprocessing the target video image, and using a target recognition engine that has been accelerated inferenced and deployed to perform mobile target recognition in the preprocessed target video image to obtain a recognition result, wherein the target recognition engine is a TensorRT engine generated by accelerating inference and quantizing a lightweight YOLOv7 model using TensorRT, and the lightweight YOLOv7 model The invention is generated by pruning the target network layer in the Head network of the standard YOLOv7 model after adjusting the depth multiplier and width multiplier of the standard YOLOv7 model, and replacing the target efficient layer aggregation network E-ELAN in the BackBone network and the Neck network of the standard YOLOv7 model with the lightweight network ShuffleNet and the lightweight network MobileNetV2; in the recognition result, the target label is detected, and according to the detection result, the brightness of the preset street lamp located in the target area is controlled according to the preset brightness control strategy.

[0008] In a second aspect, an embodiment of the present application provides a street light control device based on improved YOLOv7 and quantized acceleration, including: A receiving module, used to receive a target video image generated by monitoring a target area within a preset street light on time; A processing module, used for preprocessing the target video image, and using the target recognition engine that has been accelerated inference and deployed, to perform mobile target recognition in the preprocessed target video image to obtain a recognition result, wherein the target recognition engine is a TensorRT engine generated by accelerating the reasoning and quantizing the lightweight YOLOv7 model using TensorRT, and the lightweight YOLOv7 model is generated by pruning the target network layer in the Head network of the standard YOLOv7 model after adjusting the depth multiplier and width multiplier of the standard YOLOv7 model, and replacing the target efficient layer aggregation network E-ELAN in the BackBone network and Neck network of the standard YOLOv7 model with the lightweight network ShuffleNet and the lightweight network MobileNetV2; The control module is used to detect the target tag in the recognition result, and according to the detection result and a preset brightness control strategy, perform brightness control on the preset street lamp located in the target area.

[0009] In the third aspect, an embodiment of the present application provides a target recognition system, including: an acquisition module, a transmission device and a server device; wherein the acquisition module is connected to the server device via the transmission device; the acquisition module is used to acquire target video images; the transmission device is used to transmit the target video images to the server device; the server device is used to execute the street light control method based on improved YOLOv7 and quantization acceleration described in the first aspect.

[0010] In a fourth aspect, an embodiment of the present application provides an electronic device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the street light control method based on improved YOLOv7 and quantized acceleration described in the first aspect.

[0011] In a fifth aspect, an embodiment of the present application provides a storage medium having a computer program stored thereon, which, when executed by a processor, implements the street light control method based on improved YOLOv7 and quantized acceleration as described in the first aspect above.

[0012] Compared with the related art, the street light control method, device, system and medium based on improved YOLOv7 and quantization acceleration provided in the embodiments of the present application adopt a method of receiving a target video image generated by monitoring a target area within a preset street light on time; preprocessing the target video image, and using a target recognition engine that has been accelerated inferenced and deployed, performing mobile target recognition in the preprocessed target video image to obtain a recognition result, wherein the target recognition engine is a TensorRT engine generated by accelerating inference and quantizing a lightweight YOLOv7 model using TensorRT, and the lightweight YOLOv7 model is a target network layer in the Head network of the standard YOLOv7 model is pruned after adjusting the depth multiplier and width multiplier of the standard YOLOv7 model, and a lightweight network ShuffleNet and a lightweight The network MobileNetV2 replaces the target efficient layer aggregation network E-ELAN in the BackBone network and Neck network of the standard YOLOv7 model; in the recognition result, the target label is detected, and according to the detection result, the brightness of the preset street lamp located in the target area is controlled according to the preset brightness control strategy, and the detection efficiency is improved by adjusting the depth multiplier and the width multiplier and pruning the target network layer in its Head network, and replacing the target efficient layer aggregation network E-ELAN in its BackBone network and Neck network with a lightweight network ShuffleNet and a lightweight network MobileNetV2 to generate a lightweight YOLOv7 model, which solves the problems of low detection efficiency and poor real-time performance of object detection models used in intelligent street lamp control systems in related technologies.

[0013] Details of one or more embodiments of the present application are set forth in the following drawings and description to make other features, objects, and advantages of the present application more readily apparent. BRIEF DESCRIPTION OF THE DRAWINGS

[0014] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings: Figure 1 It is a hardware structure block diagram of a terminal of a street light control method based on improved YOLOv7 and quantization acceleration according to an embodiment of the present application; Figure 2 is a flow chart of a street light control method based on improved YOLOv7 and quantization acceleration according to an embodiment of the present application; Figure 3 It is a structural block diagram of a street light control device based on improved YOLOv7 and quantization acceleration according to an embodiment of the present application. DETAILED DESCRIPTION

[0015] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application is described and illustrated below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not intended to limit the present application. Based on the embodiments provided in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present application. In addition, it can also be understood that although the efforts made in this development process may be complex and lengthy, for ordinary technicians in the field related to the contents disclosed in the present application, some changes such as design, manufacturing or production based on the technical contents disclosed in the present application are only conventional technical means, and should not be understood as insufficient contents disclosed in the present application.

[0016] Reference to "embodiments" in this application means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those of ordinary skill in the art that the embodiments described in this application may be combined with other embodiments without conflict.

[0017] Unless otherwise defined, the technical terms or scientific terms involved in this application should be understood by people with ordinary skills in the technical field to which this application belongs. The words "one", "a", "a", "the" and the like involved in this application do not indicate a quantitative limitation and may represent the singular or plural. The terms "including", "comprising", "having" and any of their variations involved in this application are intended to cover non-exclusive inclusions; for example, a process, method, system, product or device that includes a series of steps or modules (units) is not limited to the listed steps or units, but may also include unlisted steps or units, or may also include other steps or units inherent to these processes, methods, products or devices. The "multiple links" involved in this application refer to links greater than or equal to two. "And / or" describes the association relationship of associated objects, indicating that there may be three relationships, for example, "A and / or B" may represent: A exists alone, A and B exist at the same time, and B exists alone. The terms "first", "second", "third" and the like involved in this application are only used to distinguish similar objects and do not represent a specific ordering of objects.

[0018] The method embodiment provided in this embodiment can be executed in a terminal, a computer or a similar computing device. Taking running on a terminal as an example, Figure 1: is a hardware structure block diagram of a terminal of a street light control method based on improved YOLOv7 and quantization acceleration according to an embodiment of the present application. Figure 1 As shown, the terminal may include one or more ( Figure 1 Only one is shown in the figure) a processor 102 (the processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 104 for storing data. Optionally, the terminal may also include a transmission device 106 and an input / output device 108 for communication functions. It can be understood by those skilled in the art that Figure 1 The structure shown is for illustration only and does not limit the structure of the above terminal. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations are shown.

[0019] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the street light control method based on improved YOLOv7 and quantization acceleration in the embodiment of the present invention. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, to implement the above method. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories may be connected to the terminal via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0020] The transmission device 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of the terminal. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.

[0021] This embodiment provides a street light control method based on improved YOLOv7 and quantization acceleration running on the above terminal. Figure 2 is a flow chart of a street light control method based on improved YOLOv7 and quantized acceleration according to an embodiment of the present application, such as Figure 2 As shown, the process includes the following steps: Step S201, receiving a target video image generated by monitoring a target area within a preset street lamp on time.

[0022] In the present embodiment, the target video image is collected by monitoring the target area through a deployed acquisition device (e.g., a camera), and the collected video images exist in the form of video image frames one by one, and each video image frame corresponds to an image; in the present embodiment, the target video image is a video image obtained by monitoring the target area within a preset street light on time, that is, a night video image, so the video frame of the target video image is a video frame under low light or dark light conditions.

[0023] Step S202, preprocessing the target video image, and using the target recognition engine that has been accelerated inference and deployed, to perform mobile target recognition in the preprocessed target video image to obtain a recognition result, wherein the target recognition engine is a TensorRT engine generated by accelerating the reasoning and quantizing the lightweight YOLOv7 model using TensorRT, and the lightweight YOLOv7 model is generated by pruning the target network layer in the Head network of the standard YOLOv7 model after adjusting the depth multiplier and width multiplier of the standard YOLOv7 model, and replacing the target efficient layer aggregation network E-ELAN in the BackBone network and Neck network of the standard YOLOv7 model with the lightweight network ShuffleNet and the lightweight network MobileNetV2.

[0024] In this embodiment, because the target video image is a video image under low-light or dark-light conditions, the video frame corresponding to the video image will have corresponding spots or color noise. Before being processed by the target recognition engine, the video frame will be pre-processed accordingly (for example, noise reduction). In this way, the target video image input into the target recognition engine has less noise interference and higher image quality, thereby improving the target recognition efficiency.

[0025] In this embodiment, in order to deploy the target recognition engine on the AI ​​edge computing box Jetson Nano to achieve efficient video processing, TensorRT technology is used to achieve accelerated reasoning and quantization processing, that is, the weight file pt of the lightweight YOLOv7 model is converted to the open standard file format (Open Neural Network Exchange, onnx for short), and converted to the engine format using the TensorRT tool, and INT8 quantization processing is performed at the same time. The converted lightweight YOLOv7 model is deployed on Jetson Nano, and Jetson Nano is used to receive the target video image from the camera through the accelerated reasoning function of TensorRT.

[0026] In this embodiment, the lightweight implementation of the YOLOv7 model includes: taking the standard YOLOv7 model as the basis, adjusting its key parameters. First, adjusting the depth multiplier (depth_multiple) and width multiplier (width_multiple) of the standard YOLOv7 model, for example, adjusting the depth multiplier and width multiplier of the standard YOLOv7 model from the default value of 1.0 to 0.15 and 0 respectively.2. By reducing the depth and width of the network, the purpose of reducing the computational burden of the model is achieved; it should be noted that the adjusted YOLOv7 model is trained for multiple rounds of iterations, its performance is monitored (the detection accuracy of the YOLOv7 model is monitored), and the overfitting risk and comprehensive performance of the YOLOv7 model are evaluated; secondly, the YOLOv7 model is pruned and optimized. In this embodiment, the head network of the YOLOv7 model after adjusting the depth multiplier and the width multiplier is pruned in depth. It should be understood that the application scenario of the embodiment of the present application has an impact on the detection accuracy. The requirements are relatively lenient, focusing on judging the presence of pedestrians or vehicles rather than precise positioning. Therefore, a more in-depth lightweight processing is performed on the Head part, that is, some target network layers (for example: E-ELAN) in the Head network are pruned, that is, some target network layers are deleted. It should be explained and understood that the target network layers selected for deletion are determined based on experimental tests during the training process, that is, through trial pruning, and then the object (target) recognition effect of the YOLOv7 model after pruning is determined. The selected pruning has a good recognition effect and meets the requirements for lightweight processing of the model. The target network layer of the YOLOv7 model is used in this embodiment. The Head network part of the YOLOv7 model is deeply pruned to reduce the computational burden. At the same time, considering the importance of the BackBone network in feature transfer, this embodiment performs moderate pruning on the BackBone network to ensure the complete transfer of features and the basic detection capability of the model. After each network pruning, the YOLOv7 model is retrained and performance tested to verify its effectiveness and adaptability in actual application scenarios. Optimizing the network refers to replacing the target efficient layer aggregation network E-ELAN in the BackBone network and Neck network of the standard YOLOv7 model with a lightweight network ShuffleNet and a lightweight network MobileNetV2. Furthermore, in this embodiment, a deep separable convolution is used at the algorithm level to decompose the traditional convolution into deep convolution and point-by-point convolution, thereby reducing the number of parameters and computational cost of the model. The inverted residual structure and linear bottleneck in MobileNetV2 are applied to construct the basic unit of the network, thereby enhancing the expression ability of the network while maintaining lightweight, and integrating the Shuffle of ShuffleNet. Block, using group convolution and channel shuffling technology, effectively reduces the computational complexity and promotes information interaction between features; it should be noted that in this embodiment, the model after each step of the algorithm improvement is retrained and comprehensively evaluated to ensure high operating efficiency and good detection performance in an environment with limited computing resources. .

[0027] Step S203, in the recognition result, the target tag is detected, and according to the detection result and the preset brightness control strategy, the brightness of the preset street lamp located in the target area is controlled.

[0028] In this embodiment, the result of target recognition is to detect the target to be monitored, such as a person or a vehicle, from the target video image. In this embodiment, the output result of the target recognition engine contains a target tag (such as person or car), which indicates that the target object of the target video image is not empty. The third-party library of PWM and GPIO can be used to control the power generation power of the preset street lamp. For example, the duty cycle of the current is controlled by the two third-party libraries of PWM and GPIO, thereby controlling the output power of the current. In some optional implementations, when no vehicles or pedestrians are detected in the target video image, the PWM and third-party libraries will set the duty cycle of the preset street lamp to 50%, i.e., control the street lamp to light up at half power. If a pedestrian is detected in the target video image, the PWM library will set the duty cycle of the street lamp to 100%, i.e., control the street lamp to light up at full power.

[0029] Through the above steps S201 to S203, a target video image generated by monitoring a target area within a preset street lamp on time is received; the target video image is preprocessed, and a target recognition engine with accelerated reasoning and deployment is used to perform mobile target recognition in the preprocessed target video image to obtain a recognition result, wherein the target recognition engine is a TensorRT engine generated by accelerating reasoning and quantizing a lightweight YOLOv7 model using TensorRT, and the lightweight YOLOv7 model is a target network layer in a Head network of a standard YOLOv7 model is pruned after adjusting the depth multiplier and width multiplier of the standard YOLOv7 model, and a lightweight network ShuffleNet and a lightweight network MobileNetV2 are used to perform mobile target recognition in the preprocessed target video image to obtain a recognition result. The target efficient layer aggregation network E-ELAN in the BackBone network and Neck network of the LOv7 model is replaced by the generated lightweight YOLOv7 model; in the recognition result, the target label is detected, and according to the detection result, the brightness of the preset street lights located in the target area is controlled according to the preset brightness control strategy, and the detection efficiency is improved by adjusting the depth multiplier and the width multiplier and pruning the target network layer in its Head network, and replacing the target efficient layer aggregation network E-ELAN in its BackBone network and Neck network with the lightweight network ShuffleNet and the lightweight network MobileNetV2. The problem of low detection efficiency and poor real-time performance of object detection models used in intelligent street light control systems in related technologies is solved.

[0030] It should be noted that the embodiment of the present application realizes the intelligent lighting effect of "lights follow people and cars" by using the lightweight YOLOv7 model for object detection; in this embodiment, in view of the problem that the traditional detection model network architecture is huge and not suitable for edge computing platforms, the embodiment of the present application uses network lightweighting, structural pruning and quantitative reasoning acceleration TensorRT technology to optimize the YOLOv7 model, so that the target recognition engine can be deployed on the Jetson Nano hardware platform and has the ability to process multi-channel video data; at the same time, while ensuring the detection performance of smart street lights, the embodiment of the present application effectively reduces the hardware cost and realizes real-time detection function, significantly improving the video processing capability and monitoring efficiency of the smart street light system, and dynamically adjusts the brightness of the street lights according to the detection results to achieve the energy-saving goal of the smart street light system; furthermore, the embodiment of the present application effectively improves the performance of the smart street light system by integrating advanced deep learning technology and edge computing optimization strategies.

[0031] It should be further explained that the target recognition engine of the embodiment of the present application combines the lightweight model structure, pruning and optimization of the network architecture, the integrated application of the algorithm, and the accelerated reasoning and quantization processing of TensorRT. Through the target recognition engine, high-efficiency video processing capabilities are achieved in an environment with limited computing resources; at the same time, the corresponding model lightweight and optimization strategies are adopted, so that the method of the embodiment of the present application can maintain high detection accuracy while reducing the computational complexity and resource requirements of the model, so that the YOLOv7 model can adapt to hardware environments with limited computing resources; the embodiment of the present application adopts structural pruning and algorithm optimization, so that the method of the embodiment of the present application can run efficiently in real-time video surveillance scenarios, provide fast and accurate object detection, and meet the high real-time requirements of the intelligent street lamp system; the embodiment of the present application also has efficient video processing capabilities with the help of TensorRT's accelerated reasoning and quantization processing, and realizes the optimization of resource utilization.

[0032] The following is a further description of the lightweight implementation of the YOLOv7 model of this application: The adjustment of depth multiplier and width multiplier, structural pruning, introduction of ShuffleNet lightweight network and MobileNetV2 lightweight network structure are the processing before model training (processing the algorithm model itself), and TensorRT quantization is the processing after model training. The depth multiplier and the width multiplier are factors used to adjust the parameters of the convolutional neural network model. In this embodiment, the lightweight processing of the YOLO v7 model is targeted. YOLO is a popular real-time object detection system. The standard YOLO v7 model requires higher computing resources and is not suitable for edge development board devices. Because the edge development board has a low computing speed and lacks computing power, it is necessary to adjust the depth multiplier and the width multiplier to achieve lightweight YOLO v7 model. The adjustment of the depth multiplier and the width multiplier is obtained through laboratory testing. Specifically, the same vehicle data set is used, and then the depth multiplier and the width multiplier of the same YOLO v7 model are adjusted. The initial values ​​are all 1.0, and then each adjustment (in units of 0.01, each time a parameter is reduced by 0.01), the modified YOLO is tested. For the training results of the v7 model, if the model evaluation parameters such as recall rate and mAP50 are greatly reduced, it means that the model lightweighting has failed; if the model evaluation parameters such as recall rate and mAP50 can still be maintained above 90%, it means that the model effect is good, and you can try to continue lightweighting until the depth multiplier and width multiplier can no longer be reduced, which means that the YOLO v7 model has been compressed to the extreme. Record the values ​​of the depth multiplier and width multiplier each time until you find the parameter values ​​that best suit your field.

[0033] Structural pruning is to remove some redundant parts in the neural network or parts that contribute less to the final performance. In this embodiment, pruning is performed according to the structure of the neural network (convolutional layer), that is, some unimportant network layers are directly removed. In the actual algorithm model, for example, the YOLO v7 model, it is impossible to confirm in advance which network layers are important or unimportant, that is, the model itself is a "black box", so structural pruning also needs to be tested to obtain results. Similar to obtaining the optimal values ​​of the two parameters of depth multiplier and width multiplier, structural pruning is also achieved by controlling a single data set and then modifying the YOLO v7 model file (model file in YAML format), and then recording the model training results (accuracy, recall rate, mAP50 and other indicators) each time it is modified; it is understandable that YOLO The YOLOv7 model file (model file in YAML format) mainly includes two parts, the Head network and the BackBone network. The Head network is responsible for framing the targets appearing in the video, and the BackBone network is responsible for transmitting label feature information. In the application scenario of the embodiment of the present application, it is only necessary to identify vehicles and pedestrians, and there is no requirement for the accuracy of the aiming frame. That is, the YOLOv7 model only needs to determine that vehicles and pedestrians appear in the video, without obtaining the specific positions of specific vehicles and pedestrians in the video. In this embodiment, more network layers of the Head network are deleted, while more network layers of the BackBone network are retained to ensure that the BackBone network correctly transmits the features and information of vehicles and pedestrians. As for whether the Head network accurately aims at the frame, it can be appropriately discarded.

[0034] The ShuffleNet lightweight network and MobileNetV2 lightweight network structures are introduced. The standard YOLO v7 model (model file in YMAL format) mainly consists of the E-ELAN network layer. However, the convolution calculation pressure of the standard YOLO v7 model itself is very large, which is one of the reasons why it is difficult to deploy the model in the edge development version. MobileNetV2 and ShuffleNet are both lightweight networks. MobileNetV2 reduces the model complexity with its deep separable convolution technology, while ShuffleNet uses group convolution and channel shuffling technology to reduce computing requirements and enhance the information processing capabilities of the model. These two lightweight networks can be used to replace the network layers with high computing pressure of the standard YOLO v7 model, especially when a lightweight model is required or when running on devices with limited computing resources. Due to their structural advantages, these two networks can use fewer parameters and lower computational complexity, and are very suitable for use as the backbone part of the standard YOLO v7 model. In this embodiment, the forward propagation and gradient calculation of MobileNetV2 and ShuffleNet are used directly in the standard YOLO In the YOLO v7 model (model file in YAML format), the ShuffleNet lightweight network and MobileNetV2 lightweight network are used to replace the E-ELAN network of the standard YOLO v7 model. It should be noted that the main function of MobileNetV2 and ShuffleNet is to extract features from the BackBone network in the YOLO v7 model, so they can replace the original feature extraction network layer and are not used for the Head network.

[0035] In some of the embodiments, the target video image is preprocessed, including the following steps: extracting corresponding video image frames from the target video image, and performing noise reduction processing on all video image frames, wherein the noise reduction processing includes one of the following: median filtering, image sharpening.

[0036] In this embodiment, noise reduction processing is performed on the video image frames to remove spots in the video frames, thereby improving target recognition efficiency and reducing the computing power required for target recognition.

[0037] In some embodiments, using the target recognition engine with accelerated reasoning deployment, performing moving target recognition in the preprocessed target video image to obtain a recognition result includes the following steps:

[0038] Step 21, input the video image frame after the noise reduction processing into the target recognition engine, and perform image scaling and normalization processing on the video image frame after the noise reduction processing in sequence to obtain image pixel data.

[0039] In this embodiment, after the preprocessed video image frames are input into the target recognition engine in the form of pictures, the target recognition engine also performs image processing, that is, image scaling and normalization processing; by scaling and splicing the video image frames, the number of images is increased, thereby improving the recognition effect; by normalizing the scaled images, the image pixel values ​​are normalized to within the set digital range.

[0040] It should be noted that when the lightweight YOLOv7 model is trained using sample video image frames, the sample video image frames are preprocessed outside the lightweight YOLOv7 model. After the preprocessed sample video image frames are input into the lightweight YOLOv7 model, the lightweight YOLOv7 model performs normalization, data enhancement and image data tensorization on the sample video image frames in sequence. That is, during the training process, data enhancement and data annotation are adopted, and during the target recognition process, only the preprocessed video image frames are scaled and normalized, that is, the data amount of the video image frames is amplified to improve the accuracy of identifying the target. It should be noted that the accuracy of identifying the target in the embodiment of the present application is only to determine whether the target object appears in the target video image, but not to accurately identify the position of the target object.

[0041] Step 22, using the lightweight YOLOv7 model of the target recognition engine, extracting features from the image pixel data, performing feature fusion on the extracted image features, and predicting the label information of the targets appearing in the video image frame from the feature map generated by the feature fusion, wherein the label information includes the prediction box corresponding to each target, the category confidence corresponding to each prediction box, and the category probability corresponding to each prediction box.

[0042] In this embodiment, the specific technical means involved in the lightweight YOLOv7 model for feature extraction, feature fusion, and target prediction from the feature map are understandable and should be understood by those skilled in the art, and do not constitute unclear limitations of the embodiments of the present application; in this embodiment, the lightweight YOLOv7 model adopts a multi-scale detection head to better handle objects of different sizes; it should be understood that the prediction box of the embodiment of the present application is used to frame the target appearing in the video image frame, and the category confidence indicates the probability of whether the current prediction box has an object, not the probability of an object of a certain category. The category confidence is used to indicate whether the current prediction box is just a background or an object; and the category probability indicates that when there is an object or target in the prediction box, the possible value of a certain category corresponding to the prediction box predicted by the model and the real object of the category, for example: when the object in the prediction box predicted by the model is a car, and the probability of predicting that the object is a car is 0.8, then 0.8 is the category probability.

[0043] Step 23, based on the category confidence and non-maximum suppression (NMS) algorithm, select the target prediction box corresponding to each target from the multiple prediction boxes corresponding to each target, and use each target prediction box, the category confidence and category probability corresponding to the target prediction box as the label of the target appearing in the video image frame to obtain the recognition result.

[0044] In this embodiment, when the lightweight YOLOv7 model predicts a target, multiple prediction boxes will appear for the same target, that is, the same target in multiple prediction boxes. In order to improve the model calculation speed and reduce the reasoning pressure, the NMS algorithm is used to delete the prediction boxes and remove redundant prediction boxes.

[0045] In some optional implementations, the target prediction box corresponding to each target is screened from multiple prediction boxes corresponding to each target, including the following steps: from the multiple prediction boxes corresponding to each target, a prediction box with the highest category confidence is selected as the target prediction box corresponding to each target.

[0046] The denoised video image frame is input into the target recognition engine in the above steps, and the denoised video image frame is sequentially scaled and normalized to obtain image pixel data; the lightweight YOLOv7 model of the target recognition engine is used to extract features of the image pixel data, and the extracted image features are feature fused, and the label information of the target appearing in the video image frame is predicted from the feature map generated by the feature fusion, wherein the label information includes the prediction box corresponding to each target, the category confidence corresponding to each prediction box, and the category probability corresponding to each prediction box; based on the category confidence and non-maximum suppression NMS algorithm, the target prediction box corresponding to each target is screened from the multiple prediction boxes corresponding to each target, and each target prediction box, the category confidence and the category probability corresponding to the target prediction box are used as the label of the target appearing in the video image frame to obtain the recognition result, thereby realizing target recognition in the video image frame, and improving the target recognition accuracy by performing image amplification on the denoised video image frame, and at the same time, improving the calculation speed of the YOLOv7 model and reducing the model reasoning pressure by removing redundant prediction boxes.

[0047] In some of the embodiments, in the recognition result, the target tag is detected, and according to the detection result, the brightness of the preset street lamp located in the target area is controlled according to the preset brightness control strategy, including the following steps:

[0048] Step 31 , detecting a target tag among all tags obtained from the recognition result, wherein the target tag includes a person tag and a vehicle tag.

[0049] In this embodiment, the target recognition engine will identify several different targets from the target video image, such as: people, cars, trees, and road objects. In the embodiment of the present application, what needs to be achieved is to intelligently control the preset street lights according to whether there are people or cars in the target area, so as to achieve an intelligent lighting effect in which the lights move with people and the lights move with cars. Therefore, it is necessary to determine whether there are people or cars among the identified targets. Therefore, it is necessary to detect target tags including person tags or vehicle tags among all tags in the recognition results.

[0050] Step 32, based on the detection result of whether the target tag is detected, generate a corresponding brightness adjustment signal, wherein the brightness adjustment signal includes one of the following: a first brightness adjustment signal and a second brightness adjustment signal, the first brightness adjustment signal is used to characterize the control of the preset street lights located in the target area to emit light at a preset full power, and the second brightness adjustment signal is used to characterize the control of the preset street lights located in the target area to emit light at a preset half power.

[0051] In this embodiment, when a target tag is detected, it means that a person or a car appears in the target video image, and the brightness of the street lamp needs to be brightened. When no target tag is detected, it means that no person or car appears in the target video image, and the brightness of the street lamp can be lowered. Therefore, a corresponding brightness adjustment signal is generated based on the result of whether the target tag is detected.

[0052] Step 33, obtaining the current brightness state corresponding to the preset street lamp located in the target area, and controlling the switching of the current brightness state based on the brightness adjustment signal.

[0053] In this embodiment, after generating the corresponding brightness adjustment signal, it is necessary to first determine the current brightness state of the street lamp, and then determine whether brightness adjustment is needed. For example: when the brightness adjustment signal is to increase the brightness of the street lamp, and the current brightness state of the street lamp is the brightest, then the street lamp can be maintained in the current brightness state.

[0054] In some embodiments, step 32 generates a corresponding brightness adjustment signal according to the detection result of whether the target tag is detected, including the following steps:

[0055] Step 321 : When at least one target tag is detected from all tags obtained from the recognition results, a first brightness adjustment signal is generated.

[0056] Step 322: if the target tag is not detected from all tags obtained from the recognition results, generate a second brightness adjustment signal.

[0057] In this embodiment, when a person or a car is detected, it means that the brightness of the street lamp needs to be increased, that is, a first brightness adjustment signal is generated; when no person or car is detected, it means that the brightness of the street lamp needs to be lowered to save energy, that is, a second brightness adjustment signal is generated.

[0058] In some embodiments, step 33 of controlling the switching of the current brightness state based on the brightness adjustment signal includes the following steps:

[0059] Step 331, determining the response brightness state corresponding to the preset street lamp located in the target area after the response brightness adjustment signal, and judging whether the response brightness state is the current brightness state.

[0060] Step 332, when it is determined that the response brightness state is the current brightness state, controlling the preset street lights located in the target area to maintain the current brightness state;

[0061] Step 333, when it is determined that the response brightness state is not the current brightness state, control the preset street lights located in the target area to switch from the current brightness state to the response brightness state corresponding to the brightness adjustment signal.

[0062] Through the above steps, among all the tags obtained from the recognition results, the target tag is detected, wherein the target tag includes a person tag and a vehicle tag; according to the detection result of whether the target tag is detected, a corresponding brightness adjustment signal is generated, wherein the brightness adjustment signal includes one of the following: a first brightness adjustment signal and a second brightness adjustment signal, the first brightness adjustment signal is used to characterize the control of the preset street lights located in the target area to emit light at a preset full power, and the second brightness adjustment signal is used to characterize the control of the preset street lights located in the target area to emit light at a preset half power; the current brightness state corresponding to the preset street lights located in the target area is obtained, and based on the brightness adjustment signal, the current brightness state is controlled to be switched, so as to realize brightness control of the preset paths located in the target area.

[0063] This embodiment also provides a street light control device based on improved YOLOv7 and quantized acceleration, which is used to implement the above embodiments and preferred implementations, and will not be repeated for what has been described. As used below, the terms "module", "unit", "subunit", etc. can implement a combination of software and / or hardware for a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.

[0064] Figure 3 is a structural block diagram of a street light control device based on improved YOLOv7 and quantization acceleration according to an embodiment of the present application, such as Figure 3As shown, the device includes a receiving module 31, a processing module 32 and a control module 33, wherein: A receiving module 31 is used to receive a target video image generated by monitoring a target area within a preset street light on time; The processing module 32 is coupled to the receiving module 33 and is used to pre-process the target video image, and use the target recognition engine that has been accelerated inferenced and deployed to perform mobile target recognition in the pre-processed target video image to obtain a recognition result, wherein the target recognition engine is a TensorRT engine generated by accelerating the reasoning and quantizing the lightweight YOLOv7 model using TensorRT, and the lightweight YOLOv7 model is generated by pruning the target network layer in the Head network of the standard YOLOv7 model after adjusting the depth multiplier and width multiplier of the standard YOLOv7 model, and replacing the target efficient layer aggregation network E-ELAN in the BackBone network and Neck network of the standard YOLOv7 model with the lightweight network ShuffleNet and the lightweight network MobileNetV2; The control module 33 is coupled to the processing module 32 and is used to detect the target tag in the recognition result, and control the brightness of the preset street lights located in the target area according to the detection result and the preset brightness control strategy.

[0065] Through the street light control device based on improved YOLOv7 and quantization acceleration of the embodiment of the present application, a target video image generated by monitoring the target area within the preset street light opening time is received; the target video image is preprocessed, and the target recognition engine with accelerated reasoning and deployment is used to perform mobile target recognition in the preprocessed target video image to obtain a recognition result. The target recognition engine is a TensorRT engine generated by accelerating reasoning and quantizing the lightweight YOLOv7 model using TensorRT. The lightweight YOLOv7 model is a target network layer in the Head network of the standard YOLOv7 model after adjusting the depth multiplier and width multiplier of the standard YOLOv7 model, and a lightweight network ShuffleNet and a lightweight network MobileNet are used. V2 replaces the target efficient layer aggregation network E-ELAN in the BackBone network and Neck network of the standard YOLOv7 model; in the recognition result, the target label is detected, and according to the detection result, the brightness of the preset street lights located in the target area is controlled according to the preset brightness control strategy. The detection efficiency is improved by adjusting the depth multiplier and the width multiplier and pruning the target network layer in its Head network, and replacing the target efficient layer aggregation network E-ELAN in its BackBone network and Neck network with the lightweight network ShuffleNet and the lightweight network MobileNetV2 to generate a lightweight YOLOv7 model, which solves the problems of low detection efficiency and poor real-time performance of object detection models used in intelligent street light control systems in related technologies.

[0066] In some embodiments, the processing module 32 is further used to extract corresponding video image frames from the target video image, and perform noise reduction processing on all the video image frames, wherein the noise reduction processing includes one of the following: median filtering, image sharpening.

[0067] In some embodiments, the processing module 32 further includes: A processing unit, used to input the video image frame after the noise reduction processing into the target recognition engine, and perform image scaling and normalization processing on the video image frame after the noise reduction processing in sequence to obtain image pixel data, wherein the data enhancement includes one of the following: image cropping, image rotation, image flipping, and image color adjustment; A prediction unit is coupled to the processing unit and is used to extract features from image pixel data using a lightweight YOLOv7 model of the target recognition engine, perform feature fusion on the extracted image features, and predict label information of targets appearing in the video image frame from a feature map generated by feature fusion, wherein the label information includes a prediction box corresponding to each target, a category confidence corresponding to each prediction box, and a category probability corresponding to each prediction box; The screening unit is coupled to the prediction unit and is used to screen the target prediction box corresponding to each target from the multiple prediction boxes corresponding to each target based on the category confidence and non-maximum suppression (NMS) algorithm, and use each target prediction box, the category confidence and category probability corresponding to the target prediction box as the label of the target appearing in the video image frame to obtain the recognition result.

[0068] In some embodiments, the control module 33 further includes: A detection unit, used to detect a target tag from all tags obtained from the recognition result, wherein the target tag includes a person tag and a vehicle tag; A generating unit is coupled to the detecting unit and is used to generate a corresponding brightness adjustment signal according to a detection result of whether the target tag is detected, wherein the brightness adjustment signal includes one of the following: a first brightness adjustment signal and a second brightness adjustment signal, wherein the first brightness adjustment signal is used to characterize the control of a preset street lamp located in the target area to emit light at a preset full power quantity, and the second brightness adjustment signal is used to characterize the control of a preset street lamp located in the target area to emit light at a preset half power quantity; The control unit is coupled to the generating unit and is used to obtain the current brightness state corresponding to the preset street lamp located in the target area, and control the switching of the current brightness state based on the brightness adjustment signal.

[0069] In some of the embodiments, the generating unit is further used to generate a first brightness adjustment signal when at least one target tag is detected from all tags obtained from the recognition results; and to generate a second brightness adjustment signal when no target tag is detected from all tags obtained from the recognition results.

[0070] In some of the embodiments, the control unit is also used to determine the response brightness state corresponding to the preset street lights located in the target area after responding to the brightness adjustment signal, and judge whether the response brightness state is the current brightness state; when it is judged that the response brightness state is the current brightness state, the preset street lights located in the target area are controlled to maintain the current brightness state; when it is judged that the response brightness state is not the current brightness state, the preset street lights located in the target area are controlled to switch from the current brightness state to the response brightness state corresponding to the brightness adjustment signal.

[0071] This embodiment also provides a target recognition system, including: an acquisition module, a transmission device and a server device; wherein the acquisition module is connected to the server device via the transmission device; wherein the acquisition module is connected to the server device via the transmission device; the acquisition module is used to acquire target video images; the transmission device is used to transmit the target video images to the server device; the server device is used to execute the steps in any of the above method embodiments.

[0072] This embodiment further provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.

[0073] Optionally, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.

[0074] Optionally, in this embodiment, the processor may be configured to perform the following steps through a computer program:

[0075] S1, receiving a target video image generated by monitoring a target area within a preset street lamp on time.

[0076] S2, preprocessing the target video image, and using the target recognition engine with accelerated reasoning deployment to perform moving target recognition in the preprocessed target video image to obtain a recognition result.

[0077] S3, in the recognition result, detecting the target tag, and according to the detection result and the preset brightness control strategy, controlling the brightness of the preset street lights located in the target area.

[0078] It should be noted that the specific examples in this embodiment can refer to the examples described in the above embodiments and optional implementation modes, and this embodiment will not be described in detail here.

[0079] In addition, in combination with the street light control method based on improved YOLOv7 and quantized acceleration in the above embodiments, the present application embodiment can provide a storage medium for implementation. The storage medium stores a computer program; when the computer program is executed by a processor, any street light control method based on improved YOLOv7 and quantized acceleration in the above embodiments is implemented.

[0080] Those skilled in the art should understand that the technical features of the above embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0081] The above embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.

Claims

1. A street light control method based on improved YOLOv7 and quantization acceleration, characterized in that: include: Receiving a target video image generated by monitoring a target area during a preset street light on time; Preprocessing the target video image, and using the target recognition engine that has been accelerated inference deployed, performing mobile target recognition in the preprocessed target video image to obtain a recognition result, wherein the target recognition engine is a TensorRT engine generated by accelerating the inference and quantizing the lightweight YOLOv7 model using TensorRT, and the lightweight YOLOv7 model is generated by pruning the target network layer in the Head network of the standard YOLOv7 model after adjusting the depth multiplier and width multiplier of the standard YOLOv7 model, and replacing the target efficient layer aggregation network E-ELAN in the BackBone network and Neck network of the standard YOLOv7 model with the lightweight network ShuffleNet and the lightweight network MobileNetV2; In the recognition result, the target tag is detected, and according to the detection result and a preset brightness control strategy, the brightness of the preset street lamp located in the target area is controlled.

2. The method according to claim 1, characterized in that Preprocessing the target video image includes: extracting corresponding video image frames from the target video image, and performing noise reduction processing on all the video image frames, wherein the noise reduction processing includes one of the following: median filtering and image sharpening.

3. The method according to claim 2, characterized in that Using the target recognition engine with accelerated reasoning deployment, mobile target recognition is performed in the preprocessed target video image to obtain recognition results, including: Inputting the video image frame after the noise reduction processing into the target recognition engine, and performing image scaling and normalization processing on the video image frame after the noise reduction processing in sequence to obtain image pixel data; Utilizing the lightweight YOLOv7 model of the target recognition engine, extracting features from the image pixel data, performing feature fusion on the extracted image features, and predicting label information of the targets appearing in the video image frame from the feature map generated by the feature fusion, wherein the label information includes a prediction box corresponding to each target, a category confidence corresponding to each prediction box, and a category probability corresponding to each prediction box; Based on the category confidence and non-maximum suppression (NMS) algorithm, a target prediction box corresponding to each target is screened from the multiple prediction boxes corresponding to each target, and each target prediction box, the category confidence and the category probability corresponding to the target prediction box are used as labels of the targets appearing in the video image frame to obtain the recognition result.

4. The method according to claim 3, characterized in that In the recognition result, the target tag is detected, and according to the detection result, the brightness of the preset street lamp located in the target area is controlled according to the preset brightness control strategy, including: Detecting the target tag among all the tags obtained from the recognition result, wherein the target tag includes a person tag and a vehicle tag; Generate a corresponding brightness adjustment signal according to the detection result of whether the target tag is detected, wherein the brightness adjustment signal includes one of the following: a first brightness adjustment signal and a second brightness adjustment signal, wherein the first brightness adjustment signal is used to characterize the control of a preset street lamp located in the target area to emit light at a preset full power, and the second brightness adjustment signal is used to characterize the control of a preset street lamp located in the target area to emit light at a preset half power; The current brightness state corresponding to the preset street lamp located in the target area is obtained, and based on the brightness adjustment signal, the current brightness state is controlled to be switched.

5. The method according to claim 4, characterized in that Generating a corresponding brightness adjustment signal according to the detection result of whether the target tag is detected, including: In the case where at least one of the target tags is detected from all the tags obtained from the recognition result, generating the first brightness adjustment signal; In a case where the target tag is not detected from all the tags acquired from the recognition result, the second brightness adjustment signal is generated.

6. The method according to claim 4, characterized in that Based on the brightness adjustment signal, controlling to switch the current brightness state includes: Determining a response brightness state corresponding to a preset street lamp located in the target area in response to the brightness adjustment signal, and judging whether the response brightness state is the current brightness state; In the case where it is determined that the response brightness state is the current brightness state, controlling the preset street lights located in the target area to maintain the current brightness state; In the case where it is determined that the response brightness state is not the current brightness state, the preset street lights located in the target area are controlled to switch from the current brightness state to the response brightness state corresponding to the brightness adjustment signal.

7. A street light control device based on improved YOLOv7 and quantized acceleration, characterized in that: include: A receiving module, used to receive a target video image generated by monitoring a target area within a preset street light on time; A processing module, used for preprocessing the target video image, and using the target recognition engine that has been accelerated inference and deployed, to perform mobile target recognition in the preprocessed target video image to obtain a recognition result, wherein the target recognition engine is a TensorRT engine generated by accelerating the reasoning and quantizing the lightweight YOLOv7 model using TensorRT, and the lightweight YOLOv7 model is generated by pruning the target network layer in the Head network of the standard YOLOv7 model after adjusting the depth multiplier and width multiplier of the standard YOLOv7 model, and replacing the target efficient layer aggregation network E-ELAN in the BackBone network and Neck network of the standard YOLOv7 model with the lightweight network ShuffleNet and the lightweight network MobileNetV2; The control module is used to detect the target tag in the recognition result, and according to the detection result and a preset brightness control strategy, control the brightness of the preset street lamp located in the target area.

8. A target recognition system, characterized in that: include: A collection module, a transmission device and a server device; wherein the collection module is connected to the server device via the transmission device; The acquisition module is used to acquire target video images; The transmission device is used to transmit the target video image to the server device; The server device is used to execute the street light control method based on improved YOLOv7 and quantization acceleration according to any one of claims 1 to 6.

9. An electronic device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps of the street light control method based on improved YOLOv7 and quantized acceleration according to any one of claims 1 to 6.

10. A storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the street light control method based on improved YOLOv7 and quantization acceleration described in any one of claims 1 to 6 is implemented.

Citation Information

Cited By

  • Rolov7-based inquiry identification auxiliary method and system

    CN119540836A