Regional pedestrian detection lighting method and system based on camera image segmentation
By using camera image segmentation technology and YOLOv5 target detection network in the smart city street light system, pedestrian detection and lighting control are realized in sub-regions, solving the problem of poor performance of smart street light systems in existing technology in less crowded and remote environments. Improved lighting efficiency and energy saving effect.
Patent Information
- Application Number
- CN202210609735.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-31
- Publication Date
- 2024-09-27
- Estimated Expiration
- 2042-05-31
AI Technical Summary
The existing smart city street lighting system does not work well in environments with few people and remote areas, and the degree of energy saving is not good. The traditional target detection algorithm has difficulties in regional detection and control, especially the YOLOv5 detection algorithm only when calling the USB camera. It can achieve single area detection of a single frame image, but it is difficult to achieve sub-regional detection control.
A regional pedestrian detection lighting method based on camera image segmentation is adopted. By acquiring surveillance camera images in real time, the YOLOv5 target detection network is used to divide a single frame image into multiple areas in equal proportions for pedestrian detection. By controlling the lighting circuit, the Arduino microcontroller and The relay controls the on and off of the lighting to achieve lighting control for pedestrian detection in different areas.
It realizes the flexible adjustment of lighting in environments with many or few people, improves lighting efficiency and energy-saving effects, and can control lighting in real time according to the location of pedestrians, providing sufficient lighting or saving power to meet the lighting needs of smart cities.
Smart Images

Figure CN114943986B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of computer vision target detection and smart city lighting technology, and in particular to a regional pedestrian detection lighting method and system based on camera image segmentation. Background Art
[0002] Streetlights are essential facilities in urban lighting systems. With the continuous improvement of urbanization, urban streetlight systems are also expanding and improving. Streetlight systems are no longer just facilities that provide road lighting and facilitate travel. They have become an important part of urban infrastructure and play a pivotal role in urban traffic safety, energy conservation and environmental protection, people's lives and urban appearance. In recent years, the country has focused on the development and construction of smart cities. As an indispensable part of urban development, smart streetlight system solutions have become one of the hot spots for research in industry and universities. However, the current urban pedestrian streetlight lighting system is still only an improvement in the wick material of the traditional lighting system. Although the replacement of materials has improved energy-saving efficiency to a certain extent, it has failed to meet the requirements of smart streetlight systems. Faced with these new opportunities, some cities have launched cloud-networked smart streetlight construction plans. A large part of these solutions is the collective control of urban streetlight systems based on external environmental conditions. They have a certain degree of intelligence, but they are not effective in some environments with few people and remote areas, and the energy-saving level is not optimal.
[0003] The target detection algorithm has been developed for more than 20 years. With the introduction of the concept of deep neural network, the real-time performance and accuracy of the target detection algorithm have changed by leaps and bounds. There are two most commonly used target detection algorithms at present, one is the two-stage R-CNN series, and the other is the one-stage YOLO series. Because YOLOv5 has high real-time performance and accuracy, it is the most widely used in the industry. However, many current YOLOv5 detection algorithms can only realize single-frame images and single regions when calling USB cameras to read each frame of images. If you want to realize multiple regions of a single-frame image, you may need to call other surveillance cameras, so it is very inconvenient to realize regional detection control. Summary of the invention
[0004] In order to solve the problems existing in the prior art, the present invention proposes a regional pedestrian detection lighting method and system based on camera image segmentation, which can determine whether to turn on the light according to the monitoring image of the camera.
[0005] The technical solution adopted by the method of the present invention is: a regional pedestrian detection lighting method based on camera image segmentation, comprising the following steps:
[0006] Step 1: Get the surveillance camera monitoring screen in real time;
[0007] Step 2: Use the YOLOv5 target detection network to obtain a single-frame image from the video stream, and divide the single-frame image into N regions in equal proportion. Each region can detect pedestrians, and obtain the coordinate information and detection probability of pedestrians on the pixels of the image;
[0008] The YOLOv5 target detection network includes a Backbone module, a Neck module and an Output module;
[0009] The Backbone module includes a Focus module, a CBA module, a CSP module and an SPP module, which is used to perform downsampling operations on the characteristic spectrogram of the image multiple times to obtain image information of different fine grains, and input it into the Neck module in three ways;
[0010] The Focus module slices the input image, performs a downsampling operation on the image, and increases the number of channels of the feature map;
[0011] The CBA module downsamples the input feature map and increases the number of channels of the feature map to retain more image information.
[0012] The CSP module performs a downsampling operation on the input feature map and adds a residual structure to increase the gradient value of back propagation between layers to avoid gradient loss caused by deepening the neural network;
[0013] The SPP module reduces the number of channels of the input feature map by half, and then performs maximum pooling operations with convolution kernels 3*3, 5*5, and 7*7 respectively, and finally splices the results to obtain a new feature map;
[0014] The Neck module, which includes a Concat module, an Upsample module, a CBA module and a CSP module, is used to mix the obtained image information, enhance the model's detection ability for objects of different scales, and input the Output module in three ways;
[0015] The Upsample module performs upsampling operation on the feature map to obtain a suitable size;
[0016] The Concat module concatenates the feature map obtained by upsampling with the feature map output by the Backbone module to obtain a feature map with more extensive information.
[0017] The CBA module and CSP module have the same functions as those of the CBA module and CSP module in the Backbone module;
[0018] The Output module includes a CONV module, which is used to anchor the frame on the feature map and output the final feature map with category probability, object score and predicted frame information;
[0019] The CONV module performs convolution operation on the feature maps output by the three paths of the Neck module to obtain feature maps with final sizes of 80*80*255, 40*40*255, and 20*20*255;
[0020] Step 3: By controlling the lighting circuit, controlling the relays corresponding to the N screen areas, controlling the on and off of the N groups of lighting routes, the pedestrian detection lighting control in different areas is realized;
[0021] The lighting control circuit includes an Arduino single-chip microcomputer, N relays, N groups of lighting lamps, an external power supply and a 24V transformer; N digital pins on the Arduino single-chip microcomputer are connected to the N relays to transmit control signals; the N relays are correspondingly connected to the N groups of lighting lamps to realize control of the lighting lamps.
[0022] The technical solution adopted by the system of the present invention is: a regional pedestrian detection lighting system based on camera image segmentation, including the following modules:
[0023] Module 1 is used to obtain the surveillance camera monitoring screen in real time;
[0024] Module 2 is used to use the YOLOv5 target detection network to obtain a single-frame image from the video stream, and divide the single-frame image into N regions in equal proportion. Each region can be used for pedestrian detection to obtain the coordinate information and detection probability of the pedestrian on the pixel of the image;
[0025] The YOLOv5 target detection network includes a Backbone module, a Neck module and an Output module;
[0026] The Backbone module includes a Focus module, a CBA module, a CSP module and an SPP module, which is used to perform downsampling operations on the characteristic spectrogram of the image multiple times to obtain image information of different fine grains, and input it into the Neck module in three ways;
[0027] The Focus module slices the input image, performs a downsampling operation on the image, and increases the number of channels of the feature map;
[0028] The CBA module downsamples the input feature map and increases the number of channels of the feature map to retain more image information.
[0029] The CSP module performs a downsampling operation on the input feature map and adds a residual structure to increase the gradient value of back propagation between layers to avoid gradient loss caused by deepening the neural network;
[0030] The SPP module reduces the number of channels of the input feature map by half, and then performs maximum pooling operations with convolution kernels 3*3, 5*5, and 7*7 respectively, and finally splices the results to obtain a new feature map;
[0031] The Neck module, which includes a Concat module, an Upsample module, a CBA module and a CSP module, is used to mix the obtained image information, enhance the model's detection ability for objects of different scales, and input the Output module in three ways;
[0032] The Upsample module performs upsampling operation on the feature map to obtain a suitable size;
[0033] The Concat module concatenates the feature map obtained by upsampling with the feature map output by the Backbone module to obtain a feature map with more extensive information.
[0034] The CBA module and CSP module have the same functions as those of the CBA module and CSP module in the Backbone module;
[0035] The Output module includes a CONV module, which is used to anchor the frame on the feature map and output the final feature map with category probability, object score and predicted frame information;
[0036] The CONV module performs convolution operation on the feature maps output by the three paths of the Neck module to obtain feature maps with final sizes of 80*80*255, 40*40*255, and 20*20*255;
[0037] Module 3 is used to control the lighting circuit, control the relays corresponding to the N screen areas, control the on and off of the N groups of lighting routes, and realize the pedestrian detection lighting control in different areas;
[0038] The lighting control circuit includes an Arduino single-chip microcomputer, N relays, N groups of lighting lamps, an external power supply and a 24V transformer; N digital pins on the Arduino single-chip microcomputer are connected to the N relays to transmit control signals; the N relays are correspondingly connected to the N groups of lighting lamps to realize control of the lighting lamps.
[0039] The present invention provides a method and system for regional pedestrian detection lighting based on camera screen segmentation, which relates to the fields of computer vision target detection and smart city lighting technology. First, a development board calls a monitoring camera to obtain a real-time monitoring camera screen; the real-time monitoring screen is input into a YOLOv5 target detection model, and the development board executes a detection algorithm and obtains pedestrian detection result information after a single frame screen is segmented into five regions, including the coordinate information of the pedestrian, the detection probability information, etc., and outputs a digital signal of the detection result; a single-chip microcomputer processes the digital signal and controls the corresponding relays of the five screen regions to control the on and off of the corresponding five groups of lighting lamp circuits. If a pedestrian is detected in a certain screen region of the monitoring camera, the lighting lamp corresponding to the screen region can be illuminated. If no pedestrian is detected in a certain screen region of the monitoring camera, the lighting lamp will not be illuminated. If pedestrians can be detected in all five areas of the monitoring camera screen, the five groups of lighting lamps will all be on to provide sufficient lighting. If no pedestrian is detected in any of the five screen regions of the monitoring camera, the five groups of lights will not be on to save electricity, and finally realize regional pedestrian detection lighting and follow-up lighting. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] Figure 1 is a schematic diagram of a detection method according to an embodiment of the present invention;
[0041] Figure 2 It is the YOLOv5 target detection network structure of an embodiment of the present invention;
[0042] Figure 3 This is a diagram showing the effect of implementing the YOLOv5 target detection network of an embodiment of the present invention;
[0043] Figure 4 is a control lighting circuit diagram of an embodiment of the present invention;
[0044] Among them: 1. Arduino microcontroller; 2. Five-way relays; 3.1. lighting lamp; 3.2. lighting lamp; 3.3. lighting lamp; 3.4. lighting lamp; 3.5 lighting lamp; 4. 220V external power supply and 24V transformer.
[0045] Figure 5 1 is a system principle diagram of an embodiment of the present invention. DETAILED DESCRIPTION
[0046] In order to facilitate ordinary technicians in the field to understand and implement the present invention, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the implementation examples described herein are only used to illustrate and explain the present invention, and are not used to limit the present invention.
[0047] The present invention proposes a method and system for regional pedestrian detection lighting based on camera screen segmentation, which relates to the fields of computer vision target detection and smart city lighting technology. First, a development board calls a surveillance camera to obtain a real-time surveillance camera screen; the real-time surveillance screen is input into a YOLOv5 target detection model, and the development board executes a detection algorithm and obtains pedestrian detection result information after a single frame screen is segmented into five regions, including the coordinate information of the pedestrian, the detection probability information, etc., and outputs a digital signal of the detection result; a single-chip microcomputer processes the digital signal and controls the corresponding relays of the five screen regions to control the on and off of the corresponding five groups of lighting lamp circuits. If a pedestrian is detected in a certain screen region of the surveillance camera, the lighting lamp corresponding to the screen region can be illuminated. If no pedestrian is detected in a certain screen region of the surveillance camera, the lighting lamp will not be illuminated. If pedestrians can be detected in all five areas of the surveillance camera screen, the five groups of lighting lamps will all be on to provide sufficient lighting. If no pedestrian is detected in any of the five screen regions of the surveillance camera, the five groups of lights will not be on to save electricity, and finally realize regional pedestrian detection lighting and follow-up lighting.
[0048] Please see Figure 1 The present invention provides a method for lighting pedestrian detection based on camera image segmentation, comprising the following steps:
[0049] Step 1: The Jetson Nano development board calls the surveillance camera to obtain the real-time surveillance camera image.
[0050] In this embodiment, the surveillance camera is located on the bracket of the street lamp to obtain information about pedestrians around the street lamp. The surveillance camera obtains real-time video stream data, which contains targets that the surveillance camera can capture. The YOLOv5 target detection algorithm can process the video stream data into a single-frame image as the input of the YOLOv5 target detection network, and only detect pedestrians among all targets.
[0051] In this embodiment, the surveillance camera is connected to the Jetson Nano development board via a USB cable to transmit real-time monitoring data to the development board as an input image for the YOLOv5 target detection network.
[0052] Step 2: Use the YOLOv5 target detection network to obtain a single-frame image of 640*640 from the video stream, and divide the single-frame image into five 128*640 image regions in equal proportion. The five regions are arranged in parallel. Each region can be detected by the YOLOv5 target detection algorithm executed by the Jetson Nano development board in parallel to obtain the coordinate information and detection probability of the pedestrian on the image pixel, and output the corresponding digital signal "1" or "0";
[0053] Please see Figure 2 , the YOLOv5 target detection network used in this embodiment is used to detect pedestrians;
[0054] The YOLOv5 target detection network used in this embodiment includes a Backbone module, a Neck module, and an Output module;
[0055] The Backbone module used in this embodiment includes a Focus module, a CBA module, a CSP module and an SPP module, which is used to perform downsampling operations on the characteristic spectrogram of the image multiple times to obtain image information of different fine grains, and input it into the Neck module in three ways;
[0056] The Focus module used in this embodiment slices the input image, performs a downsampling operation on the image, and increases the number of channels of the feature map;
[0057] The CBA module used in this embodiment performs a downsampling operation on the input feature map and increases the number of channels of the feature map to retain more image information;
[0058] The CSP module used in this embodiment performs a downsampling operation on the input feature map and adds a residual structure to increase the gradient value of back propagation between layers to avoid gradient loss caused by deepening the neural network;
[0059] The SPP module used in this embodiment reduces the number of channels of the input feature map by half, and then performs maximum pooling operations with convolution kernels 3*3, 5*5, and 7*7 respectively, and finally splices the results to obtain a new feature map;
[0060] The Neck module used in this embodiment includes a Concat module, an Upsample module, a CBA module, and a CSP module, which is used to mix the obtained image information, enhance the model's detection ability for objects of different scales, and input the Output module in three ways;
[0061] The Upsample module used in this embodiment performs an upsampling operation on the feature map to obtain a suitable size;
[0062] The Concat module used in this embodiment concatenates the feature map obtained by upsampling with the feature map output by the Backbone module to obtain a feature map with more extensive information;
[0063] The CBA module and CSP module used in this embodiment have the same functions as the CBA module and CSP module in the Backbone module;
[0064] The Output module used in this embodiment includes a CONV module, which is used to anchor the frame on the feature map and output the final feature map with category probability, object score and predicted frame information;
[0065] The CONV module used in this embodiment performs convolution operation on the feature maps output by the three paths of the Neck module to obtain feature maps with final sizes of 80*80*255, 40*40*255, and 20*20*255;
[0066] In this embodiment, after a series of data enhancement processing, the image will be sent to the backbone module of the YOLOv5 target detection network. The original input image size is 640*640*3. The Focus structure will slice the image, increase the number of channels of the image, and change it into a feature map of appropriate size; the CBL structure consists of a convolutional layer, batch normalization and an activation function. This structure downsamples the feature map and changes the size and number of channels of the feature map again to obtain image information features; the CSP structure is composed of multiple CBL structures, X residual components and convolutional layers, which can be used to perform feature extraction on the input. The image is downsampled, which can increase the depth of the neural network, improve the detection accuracy, and obtain more feature map information. In the backbone module, it will enter the neck module through three paths. The neck module adopts FPN and PAN structures. Through upsampling and convolution, it can enhance the feature fusion ability of the neural network. The Output module outputs feature maps of sizes 80*80*255, 40*40*255, and 20*20*255 through three convolutional layers. Each output feature map corresponds to a different receptive field on the original input image, which is used to detect small targets, medium targets, and large targets respectively.
[0067] The YOLOv5 target detection network used in this embodiment is a trained YOLOv5 target detection network. During the detection process, the weight file that has been trained on the COCO dataset is used for detection. Because the weight file can help the detection algorithm to quickly and accurately detect 80 categories of targets, the detection category needs to be set to "0" (i.e., "person") in the detection algorithm to only detect pedestrians.
[0068] The YOLOv5 target detection algorithm used in this embodiment establishes a pixel XY coordinate system in the image screen, and decodes the real-time video stream data obtained in step 1 into a single-frame image sequence. The size of the single-frame video image is set to 640*640 as the input of the YOLOv5 target detection algorithm. The single-frame image features are obtained through the YOLOv5 target detection network. At the same time, the detection algorithm divides the single-frame image into five 128*640 areas in equal proportion, and finally obtains the pedestrian coordinate information and detection probability of each area, and outputs the corresponding digital signal.
[0069] The YOLOv5 target detection algorithm used in this embodiment, after processing the features of a single frame image and being able to detect the target information of the image, will anchor the pedestrians detected on each frame image, and then screen all the anchor frames through NMS according to the confidence threshold of 0.25 and the IOU threshold of 0.45, and select the anchor frame with the largest IOU as the pedestrian detection frame; call the Annotator class to annotate the pedestrian (including category and probability) and draw the anchor frame; call the xyxy2xyw function to obtain the coordinate information xyxy[0], xyxy[1], xyxy[2] and xyxy[3] (i.e., the position information of the pedestrian) of the pedestrian detection frame, where xyxy[0] represents the coordinate of the upper left corner of the pedestrian rectangular detection frame, xyxy[1] represents the coordinate of the upper right corner of the pedestrian rectangular detection frame, xyxy[2] represents the coordinate of the lower left corner of the pedestrian rectangular detection frame, and xyxy[3] represents the coordinate of the lower right corner of the pedestrian rectangular detection frame.
[0070] The YOLOv5 target detection algorithm adopted in this embodiment determines the position area of the pedestrian in the entire picture according to the upper left corner coordinates xyxy[0] and the lower right corner coordinates xyxy[2] of the pedestrian's position information; the original picture size is 640*640, and the picture is divided into five areas in proportion. The width of the original image remains unchanged (still 640), and the length is divided into five areas in proportion [0,128], [128,256], [256,384], [384,512] and [512,640]; each area can judge whether there is a pedestrian in the area according to the coordinates xyxy[0] and xyxy[2] of the pedestrian.
[0071] The YOLOv5 target detection algorithm used in this embodiment performs pedestrian detection on five areas of the video screen. If a pedestrian is detected in a certain area, the pedestrian's position information, probability and digital signal "1" will be output; if no pedestrian is detected in a certain area, a digital signal "0" will be output.
[0072] Please see Figure 3, which is a diagram showing the effect of the YOLOv5 target detection network implementation of an embodiment of the present invention. The video image is a surveillance picture obtained by a street surveillance camera. The YOLOv5 target detection network detects a certain frame in the video. It can be seen that most pedestrians can be accurately detected. The effect of the YOLOv5 target detection network is obvious, and the requirements of the present invention for fast and accurate pedestrian detection can be met.
[0073] Step 3: By controlling the lighting circuit, the five relays corresponding to the five screen areas are controlled to control the on and off of the five lighting routes, thereby realizing the pedestrian detection lighting control in different areas;
[0074] Please see Figure 4 The lighting control circuit of this embodiment includes an Arduino single-chip microcomputer, five-way relays, five groups of lighting lamps, an external power supply and a 24V transformer; five digital pins on the Arduino single-chip microcomputer are connected to the five relays for transmitting control signals; the five relays are correspondingly connected to the five groups of lighting lamps to realize the control of the lighting lamps.
[0075] In this embodiment, lighting lamp 3.1 is controlled by the signal received by input pin 5 of five-way relay 2; lighting lamp 3.2 is controlled by the signal received by input pin 4 of five-way relay 2; lighting lamp 3.3 is controlled by the signal received by input pin 3 of five-way relay 2; lighting lamp 3.4 is controlled by the signal received by input pin 2 of five-way relay 2; lighting lamp 3.5 is controlled by the signal received by input pin 1 of five-way relay 2.
[0076] In this embodiment, the Arduino single-chip microcomputer output pin 2 is connected to the input pin 1 of the five-way relay 2 to transmit signals; the Arduino single-chip microcomputer output pin 4 is connected to the input pin 2 of the five-way relay 2 to transmit signals; the Arduino single-chip microcomputer output pin 6 is connected to the input pin 3 of the five-way relay 2 to transmit signals; the Arduino single-chip microcomputer output pin 8 is connected to the input pin 4 of the five-way relay 2 to transmit signals; the Arduino single-chip microcomputer output pin 10 is connected to the input pin 5 of the five-way relay 2 to transmit signals.
[0077] In this embodiment, the 5V "+" pole of the Arduino microcontroller is connected to the "DC+" terminal of the five-way relay input terminal, and the "GND" pole is connected to the "DC-" terminal of the five-way relay input terminal. At the same time, the digital pins of the Arduino microcontroller are respectively connected to the 5 pin interfaces corresponding to the 5-way relay input terminals, namely pin 1, pin 2, pin 3, pin 4, and pin 5.
[0078] In this embodiment, the output ends of the five-way relays are connected to the lighting lamp group. Because the street lighting system of the present invention is in a normally off state (that is, the relay output end is in a normally open state), the "NO" normally open end of the relay output end is respectively connected to the "- " pole of the lighting lamp, and the "COM" end of the five-way relay output end is respectively connected to the "- " pole of the transformer.
[0079] In this embodiment, the external power supply is connected to a transformer, which converts 220V AC power into 24V DC power. The "+" pole of the transformer is connected to the "+" pole of the lighting lamp group, and the "-" pole of the transformer is connected to the "-" pole of the lighting lamp group.
[0080] In this embodiment, the Arduino microcontroller is connected to the development board through a data line to provide power for the Arduino microcontroller and transmit digital signals to the Arduino microcontroller; the Arduino microcontroller can process digital signals through a control algorithm, define a readSerial function to obtain the digital signal of the detection target, define an if judgment statement, if the detection program of a certain area outputs the "person" class, then the area will obtain a digital signal "1" by calling the readSerial function, otherwise it is "0"; define a ReceData function to read the digital signal "1" or "0", define a virtual signal "LEDON" or "LEDOFF", call the digitalWrite library to configure the digital signal "1" or "0" with the virtual signal "LEDON" or "LEDOFF" to achieve coordinated control; define the LED_Show function, set the default digital signals of the five areas to all "0", and then convert the digital signals "1" or "0" received by each area into virtual signals "LEDON" or "LEDOFF" to achieve control of the on and off of the corresponding relays.
[0081] In this embodiment, the Arduino microcontroller can control the corresponding relays of the five areas of the monitoring screen according to the control algorithm. The output end of the relay is connected to five groups of lighting lamps, which correspond to the five area screens respectively, so as to realize the control of the five groups of lighting lamps, and finally realize the regional pedestrian detection lighting and following lighting.
[0082] Please see Figure 5 The present invention provides a regional pedestrian detection lighting system based on camera image segmentation, comprising the following modules:
[0083] Video acquisition module, the surveillance camera is connected to the Jetson Nano development board via a USB cable to transmit real-time monitoring data to the development board as the input image of the YOLOv5 target detection algorithm; the surveillance camera is located on the bracket of the street lamp to obtain pedestrian information around the street lamp. The surveillance camera obtains real-time video stream data, which contains targets that the surveillance camera can capture. The YOLOv5 target detection algorithm can process the video stream data into a single-frame image as the input of the deep neural network and only detect pedestrians among all targets.
[0084] Pedestrian detection module: Jetson Nano development board executes YOLOv5 target detection algorithm to establish pixel XY coordinate system in the image screen, and decodes the real-time video stream data obtained by video detection module 401 into a single-frame image sequence. The size of the single-frame video image is set to 640*640 as the input of YOLOv5 target detection algorithm, and the single-frame image features are obtained through deep neural network. At the same time, the detection algorithm will divide the single-frame image into five 128*640 areas in equal proportion. Each area can detect pedestrians according to the coordinate information of pedestrians, and finally obtain the coordinate information and detection probability of pedestrians in each area, and output the corresponding digital signal.
[0085] To control the lighting module, the Jetson Nano development board transmits digital signals to the Arduino microcontroller, which processes the digital signals and controls the five groups of lights accordingly based on the processed virtual signals.
[0086] This embodiment divides the camera monitoring screen into five areas in equal proportions, and each area can detect pedestrians, and can obtain the category information, detection probability, location information and digital signals of pedestrians. The control program will transmit the processed signals to the lighting groups corresponding to each area, thereby realizing the regional pedestrian detection lighting. At the same time, according to the monitoring camera screen segmentation method adopted by the present invention, when pedestrians walk from far to near, the system can follow and illuminate, the lights will turn on when people come, the lights will turn off when people leave, and the lights will be fully illuminated when there are many people. It is convenient to use in places with dense crowds, and can also be used in remote places with few people. It not only saves electricity, but also can meet the most basic lighting needs.
[0087] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution disclosed in the present invention can be achieved, and this document does not limit this.
[0088] It should be understood that the above description of the preferred embodiment is relatively detailed and cannot be regarded as limiting the scope of patent protection of the present invention. Under the enlightenment of the present invention, ordinary technicians in this field can also make substitutions or modifications without departing from the scope of protection of the claims of the present invention, which all fall within the scope of protection of the present invention. The scope of protection requested for the present invention shall be based on the attached claims.
Claims
1. A method for pedestrian detection and lighting based on camera image segmentation, characterized in that: The following steps are involved: Step 1: Get the surveillance camera monitoring screen in real time; Step 2: Use the YOLOv5 target detection network to obtain a single-frame image from the video stream, and divide the single-frame image into N regions in equal proportion. Each region can detect pedestrians, and obtain the coordinate information and detection probability of pedestrians on the pixels of the image; The YOLOv5 target detection network includes a Backbone module, a Neck module and an Output module; The Backbone module includes a Focus module, a CBA module, a CSP module and an SPP module, which is used to perform downsampling operations on the characteristic spectrogram of the image multiple times to obtain image information of different fine grains, and input it into the Neck module in three ways; The Focus module slices the input image, performs a downsampling operation on the image, and increases the number of channels of the feature map; The CBA module downsamples the input feature map and increases the number of channels of the feature map to retain more image information. The CSP module performs a downsampling operation on the input feature map and adds a residual structure to increase the gradient value of back propagation between layers to avoid gradient loss caused by deepening the neural network; The SPP module reduces the number of channels of the input feature map by half, and then performs maximum pooling operations with convolution kernels 3*3, 5*5, and 7*7 respectively, and finally splices the results to obtain a new feature map; The Neck module, which includes a Concat module, an Upsample module, a CBA module and a CSP module, is used to mix the obtained image information, enhance the model's detection ability for objects of different scales, and input the Output module in three ways; The Upsample module performs upsampling operation on the feature map to obtain a suitable size; The Concat module concatenates the feature map obtained by upsampling with the feature map output by the Backbone module to obtain a feature map with more extensive information. The CBA module and CSP module have the same functions as those of the CBA module and CSP module in the Backbone module; The Output module includes a CONV module, which is used to anchor the frame on the feature map and output the final feature map with category probability, object score and predicted frame information; The CONV module performs convolution operation on the feature maps output by the three paths of the Neck module to obtain feature maps with final sizes of 80*80*255, 40*40*255, and 20*20*255; Step 3: By controlling the lighting circuit, controlling the relays corresponding to the N screen areas, controlling the on and off of the N groups of lighting routes, the pedestrian detection lighting control in different areas is realized; The lighting control circuit includes an Arduino single-chip microcomputer, N relays, N groups of lighting lamps, an external power supply and a 24V transformer; N digital pins on the Arduino single-chip microcomputer are connected to the N relays to transmit control signals; the N relays are correspondingly connected to the N groups of lighting lamps to realize control of the lighting lamps.
2. The method for regional pedestrian detection and lighting based on camera image segmentation according to claim 1, characterized in that: In step 2, a single frame image is divided into N regions in equal proportions, corresponding to N groups of lighting lamps arranged in the same row, and each image region corresponds to a group of lighting lamps.
3. The method for regional pedestrian detection and lighting based on camera image segmentation according to any one of claims 1 to 2, characterized in that: The specific implementation process of step 3 is: if a pedestrian is detected in one of the N areas in the same row in the picture, a digital signal "1" is transmitted to the Arduino microcontroller, and the Arduino microcontroller converts it into a virtual signal "LEDON", and controls the corresponding relay of the area to be turned on through the digital pin, so that the corresponding lighting lamp in the area is illuminated; if a pedestrian is detected in one of the N areas in the same row in the picture, a digital signal "0" is transmitted to the Arduino microcontroller, and the Arduino microcontroller converts it into a virtual signal "LEDOFF", and controls the corresponding relay of the area to be turned off through the digital pin, so that the corresponding lighting lamp in the area is not illuminated.
4. A regional pedestrian detection lighting system based on camera image segmentation, characterized in that: Includes the following modules: Module 1 is used to obtain the surveillance camera monitoring screen in real time; Module 2 is used to use the YOLOv5 target detection network to obtain a single-frame image from the video stream, and divide the single-frame image into N regions in equal proportion. Each region can be used for pedestrian detection to obtain the coordinate information and detection probability of the pedestrian on the pixel of the image; The YOLOv5 target detection network includes a Backbone module, a Neck module and an Output module; The Backbone module includes a Focus module, a CBA module, a CSP module and an SPP module, which is used to perform downsampling operations on the characteristic spectrogram of the image multiple times to obtain image information of different fine grains, and input it into the Neck module in three ways; The Focus module slices the input image, performs a downsampling operation on the image, and increases the number of channels of the feature map; The CBA module downsamples the input feature map and increases the number of channels of the feature map to retain more image information. The CSP module performs a downsampling operation on the input feature map and adds a residual structure to increase the gradient value of back propagation between layers to avoid gradient loss caused by deepening the neural network; The SPP module reduces the number of channels of the input feature map by half, and then performs maximum pooling operations with convolution kernels 3*3, 5*5, and 7*7 respectively, and finally splices the results to obtain a new feature map; The Neck module, which includes a Concat module, an Upsample module, a CBA module and a CSP module, is used to mix the obtained image information, enhance the model's detection ability for objects of different scales, and input the Output module in three ways; The Upsample module performs upsampling operation on the feature map to obtain a suitable size; The Concat module concatenates the feature map obtained by upsampling with the feature map output by the Backbone module to obtain a feature map with more extensive information. The CBA module and CSP module have the same functions as those of the CBA module and CSP module in the Backbone module; The Output module includes a CONV module, which is used to anchor the frame on the feature map and output the final feature map with category probability, object score and predicted frame information; The CONV module performs convolution operation on the feature maps output by the three paths of the Neck module to obtain feature maps with final sizes of 80*80*255, 40*40*255, and 20*20*255; Module 3 is used to control the lighting circuit, control the relays corresponding to the N screen areas, control the on and off of the N groups of lighting routes, and realize the pedestrian detection lighting control in different areas; The lighting control circuit includes an Arduino single-chip microcomputer, N relays, N groups of lighting lamps, an external power supply and a 24V transformer; N digital pins on the Arduino single-chip microcomputer are connected to the N relays to transmit control signals; the N relays are correspondingly connected to the N groups of lighting lamps to realize control of the lighting lamps.
5. The regional pedestrian detection lighting system based on camera image segmentation according to claim 4 is characterized in that: The module 2 is used to divide a single frame image into N areas in equal proportion, corresponding to N groups of lighting lamps arranged in the same row, and each image area corresponds to a group of lighting lamps.
6. The regional pedestrian detection lighting system based on camera image segmentation according to any one of claims 4-5, characterized in that: The module 3 is used to transmit a digital signal "1" to the Arduino microcontroller if a pedestrian is detected in one of the N areas in the same row in the picture, and the Arduino microcontroller converts it into a virtual signal "LEDON", and controls the corresponding relay of the area to be turned on through the digital pin, so that the corresponding lighting lamp in the area is illuminated; if a pedestrian is detected in one of the N areas in the same row in the picture, the digital signal "0" is transmitted to the Arduino microcontroller, and the Arduino microcontroller converts it into a virtual signal "LEDOFF", and controls the corresponding relay of the area to be turned off through the digital pin, so that the corresponding lighting lamp in the area is not illuminated.
