Method and device for determining violation behavior in image and electronic equipment

By using the target backbone network layer and multi-size feature map of the target model in image recognition at the power construction site, combined with the channel-first convolution attention mechanism and head network map, the problems of low efficiency and insufficient detection accuracy of traditional patrol methods are solved. , realize accurate identification and monitoring of violations.

CN118887616APending Publication Date: 2024-11-01STATE GRID BEIJING ELECTRIC POWER CO +3

Patent Information

Application Number
CN202411000266.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-24
Publication Date
2024-11-01

AI Technical Summary

Technical Problem

At the power construction site, traditional manual inspection methods are inefficient and have high missed detection rate, which cannot meet the needs of real-time monitoring and identification of violations by personnel. In addition, the existing inspection network has high computational complexity or low detection accuracy, which cannot meet the complex construction scenarios. need.

Method used

The target backbone network layer of the target model is used to process the construction image through the channel-first convolution attention mechanism, and combine the multi-dimensional feature map and head network map of the intermediate layer to determine whether there are violations in the image, and use additional horizontal coordinates and vertical coordinates. The coordinate channel provides positional awareness.

Benefits of technology

It realizes more accurate identification of violations at the power construction site, improves the level of safety management, and meets the needs of real-time and high-precision.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118887616A_ABST
    Figure CN118887616A_ABST
Patent Text Reader

Abstract

The invention discloses a method and device for determining violation behaviors in an image and electronic equipment. The method comprises the following steps: acquiring a construction image in a construction scene; the construction image is input to a target backbone network layer of the target model, a feature image is obtained, the feature image carries weight values corresponding to multiple channels, the multiple channels comprise a horizontal coordinate channel representing horizontal coordinate information and a vertical coordinate channel representing vertical coordinate information, and the vertical coordinate channel represents vertical coordinate information; the target backbone network layer is integrated with a channel-first convolution attention mechanism, and the target model is obtained by training an initial model according to a target sample set; inputting the feature image into a middle layer of the target model to obtain a multi-size feature map; and inputting the multi-size feature graph into the head network graph of the target model to obtain a violation result indicating whether a violation behavior exists in the construction image. The technical problem that it is difficult to accurately identify whether the violation behavior exists in the image in the prior art is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of image recognition, and in particular to a method, device and electronic equipment for determining traffic violation behavior in an image. Background Art

[0002] Personnel safety is of vital importance at power construction sites. However, there are usually various potential safety risks and violations at construction sites, such as not wearing a safety helmet, not wearing protective clothing, and entering dangerous areas without authorization, which may lead to serious safety accidents and personal injuries. At the same time, traditional manual inspection methods have the problems of low efficiency and high missed detection rate, and cannot meet the needs of real-time monitoring and identification of personnel violations in power construction scenarios. At the same time, the particularity of power construction sites includes complex working environments, dense personnel, dynamic changes and other factors, which also bring challenges to the accurate identification of personnel violations.

[0003] In recent years, the field of computer vision has made significant progress, especially in image target detection technology based on deep learning. By annotating a large number of sample images of personnel violations, the detection network can learn the characteristic identification of personnel violations. The network is applied to the monitoring video or image data in the power construction scene to detect violations such as not wearing a safety helmet, working beyond the boundary, and carrying prohibited items in real time. The faster regional convolutional neural network Faster R-CNN network performs well in target detection, but its high computational complexity leads to slow inference speed and cannot meet the real-time requirements. The single-shot multi-frame detection SSD network has advantages in computing speed, but the detection accuracy of small-sized targets is relatively low. In the power construction scene, there may be small-sized targets such as safety helmets, so higher detection accuracy is required to adapt to complex construction scenes. Therefore, an automated personnel violation identification method based on a lightweight detection network is needed to improve the safety management level of power construction sites.

[0004] To address the above-mentioned problems, no effective solution has been proposed yet. Summary of the invention

[0005] The embodiments of the present invention provide a method, device and electronic device for determining traffic violations in an image, so as to at least solve the technical problem in the related art that it is difficult to accurately identify whether there are traffic violations in an image.

[0006] According to one aspect of an embodiment of the present invention, a method for determining illegal behaviors in an image is provided, comprising: acquiring a construction image in a construction scene; inputting the construction image into a target backbone network layer of a target model to obtain a feature image, wherein the feature image carries weight values ​​corresponding to a plurality of channels, wherein the plurality of channels include a horizontal coordinate channel representing horizontal coordinate information, and a vertical coordinate channel representing vertical coordinate information, wherein the target backbone network layer incorporates a channel-priority convolutional attention mechanism, and the target model is obtained by training an initial model according to a target sample set; inputting the feature image into an intermediate layer of the target model to obtain a multi-scale feature map, wherein the multi-scale feature map represents the category probabilities of corresponding targets at a plurality of positions in the construction image; and inputting the multi-scale feature map into a head network map of the target model to obtain a violation result of whether there are illegal behaviors in the construction image.

[0007] Optionally, before the construction image is input into the target backbone network layer of the target model to obtain the feature image, it also includes: acquiring image data of personnel violations in the construction scene to obtain a first sample set; screening a first sample subset, a second sample subset and a third sample subset from the first sample set, randomly blocking the target area of ​​the image in the first sample subset to obtain a first update subset, randomly flipping the image in the second sample subset to obtain a second update subset, adding weights to the samples in the third sample subset to obtain a third update subset, wherein the third sample subset is a small target sample image; determining the target sample set based on the first update subset, the second update subset and the third update subset.

[0008] Optionally, before the construction image is input into the target backbone network layer of the target model to obtain the feature image, it also includes: obtaining an initial model, and constructing a loss function for model training, wherein the loss function represents the degree of overlap between the prediction box and the target box, the prediction box is an image corresponding to the violation part selected by the prediction box, and the target box is an image corresponding to the known violation part; based on the loss function, the initial model is trained using the target sample set to obtain the target model.

[0009] Optionally, an initial model is obtained, and a loss function for model training is constructed, including: determining an overlap coefficient term between the prediction box and the target box, and determining an area position influence coefficient term corresponding to the prediction box and the target box; and determining the loss function based on the overlap coefficient term and the area position influence coefficient term.

[0010] Optionally, the feature image is input into the middle layer of the target model to obtain a multi-size feature map, including: when the middle layer is composed of an asymptotic feature pyramid network, branch detection is performed on the feature image according to the target detection branch at each level of the feature pyramid to obtain the multi-size feature map.

[0011] Optionally, the multi-size feature map is input into the head network map of the target model to obtain a violation result of whether there is a violation in the construction image, and also includes: when the violation probability corresponding to the construction image is lower than a first threshold and higher than a second threshold, determining the continuous frame images corresponding to the construction image; based on the continuous frame images, determining whether there is a violation result of the violation in the construction image.

[0012] Optionally, the multi-size feature map is input into the head network map of the target model to obtain a violation result of whether there is a violation in the construction image, and further includes: when the violation result indicates that there is a violation in the construction image, determining the violation information based on the violation sub-image, wherein the violation information includes at least one of the following: a violation object, a violation behavior; and sending the violation information to a predetermined terminal to cause the predetermined terminal to sound an alarm.

[0013] According to one aspect of an embodiment of the present invention, a device for determining illegal behavior in an image is provided, comprising: an acquisition module, for acquiring a construction image in a construction scene; a first determination module, for inputting the construction image into a target backbone network layer of a target model to obtain a feature image, wherein the feature image carries weight values ​​corresponding to a plurality of channels, wherein the plurality of channels include a horizontal coordinate channel representing horizontal coordinate information, and a vertical coordinate channel representing vertical coordinate information, the target backbone network layer incorporates a channel-priority convolutional attention mechanism, and the target model is obtained by training an initial model according to a target sample set; a second determination module, for inputting the feature image into an intermediate layer of the target model to obtain a multi-size feature map, wherein the multi-size feature map represents the category probabilities of corresponding targets at a plurality of positions in the construction image; and a third determination module, for inputting the multi-size feature map into a head network map of the target model to obtain a violation result of whether there is an illegal behavior in the construction image.

[0014] According to one aspect of an embodiment of the present invention, there is provided an electronic device, comprising: a processor; and a memory for storing instructions executable by the processor; wherein the processor is configured to execute the instructions to implement any of the above-described methods for determining traffic violation behaviors in an image.

[0015] According to one aspect of an embodiment of the present invention, a computer-readable storage medium is provided. When instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device can execute any of the above-mentioned methods for determining traffic violations in an image.

[0016] In an embodiment of the present invention, a construction image in a construction scene is obtained. The construction image is input into the target backbone network layer of the target model to obtain a feature image, wherein the feature image carries weight values ​​corresponding to multiple channels, the multiple channels include a horizontal coordinate channel representing horizontal coordinate information, and a vertical coordinate channel representing vertical coordinate information, the target backbone network layer incorporates a channel priority convolution attention mechanism, and the target model is obtained by training the initial model according to the target sample set. The feature image is input into the middle layer of the target model to obtain a multi-scale feature map, wherein the multi-scale feature map represents the category probability of the corresponding target at multiple positions in the construction image. The multi-scale feature map is input into the head network map of the target model to achieve the purpose of obtaining the violation result of whether there is a violation in the construction image. Since the channel dimension also includes the horizontal coordinate channel representing the horizontal coordinate information and the vertical coordinate channel representing the vertical coordinate information, that is, by adding two additional channels in the channel dimension, the two channels respectively input the horizontal coordinate and vertical coordinate information, thereby providing the network with position perception ability, so as to more accurately determine the violation result of whether there is a violation in the construction image, thereby solving the technical problem of the difficulty in accurately identifying whether there is a violation in the image in the related technology. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:

[0018] Figure 1 is a flow chart of a method for determining traffic violation behavior in an image according to an embodiment of the present invention;

[0019] Figure 2 is a logic flow chart provided by an optional embodiment of the present invention;

[0020] Figure 3 is a system architecture diagram provided by an optional implementation manner of the present invention;

[0021] Figure 4 is a network architecture diagram provided by an optional implementation manner of the present invention;

[0022] Figure 5 4 is a structural block diagram of a device for determining traffic violation behavior in an image according to an embodiment of the present invention. DETAILED DESCRIPTION

[0023] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.

[0024] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0025] First, some nouns or terms that appear in the description of the embodiments of the present application are subject to the following explanations:

[0026] Faster R-CNN (Region-based Convolutional Neural Networks): is a target detection algorithm that is improved and optimized based on R-CNN and Fast R-CNN. The algorithm generates candidate regions by introducing Region Proposal Network (RPN), and then uses the network structure of Fast R-CNN to classify and regress these candidate regions, thereby achieving the task of target detection.

[0027] SSD: Single Shot MultiBox Detector, a neural network model for target detection. The SSD network structure is simple and efficient, and can achieve real-time target detection.

[0028] YOLO-v8 network: is a deep learning model and the eighth version of the YOLO (You Only Look Once) target detection algorithm. This network can simultaneously predict the location and category of all targets in an image through a single forward propagation, with high detection speed and accuracy. YOLO-v8 network is widely used in target detection tasks in the field of computer vision.

[0029] CoordConv: is a coordinate convolution technique in deep learning models that converts absolute position information in input data into relative position information. This technique can help neural networks better learn spatial information in input data and improve the performance and generalization ability of the model. CoordConv technology is usually used to process data with spatial structures such as images and videos.

[0030] PAN-FPN network: Feature Pyramid Networks with Positional Attention Network, a neural network architecture for target detection and instance segmentation tasks. This network combines the advantages of Feature Pyramid Networks (FPN) and Positional Attention Network (PAN).

[0031] PANet: It is a neural network model for target detection, designed to solve the problem of long-tail categories (RareCategory) in target detection. PANet (Path Aggregation Network) introduces cascade structure and progressive feature fusion.

[0032] FPN (Feature Pyramid Network): is a deep neural network structure used to handle multi-scale object detection tasks. The FPN structure consists of a feature pyramid, and each pyramid level contains feature maps of different scales to detect objects at different scales.

[0033] C2F: is a module in a feature extraction network, which is the abbreviation of Context-to-Fragment. The C2F module is designed to extract features from input data and combine contextual information with local information to help the network better understand the input data.

[0034] Example 1

[0035] According to an embodiment of the present invention, an embodiment of a method for determining traffic violations in an image is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0036] Figure 1 is a flow chart of a method for determining traffic violation behavior in an image according to an embodiment of the present invention. Figure 1 As shown, the method comprises the following steps:

[0037] Step S102, obtaining a construction image in a construction scene;

[0038] In step S102 provided in the present application, it is described to obtain a construction image in a construction scene, wherein the construction scene may be a scene of construction at a construction site, which may include equipment used for construction work, such as a crane, an excavator, a concrete mixer, etc.

[0039] The specific construction process can be realized in the construction scene, such as construction sequence, process flow, etc.

[0040] For example, in a construction image, you can see a group of construction workers operating an excavator to carry out earthwork. There are a lot of cement and steel bars piled up next to them, and a concrete mixer is operating in the distance. This picture shows a typical construction site, including construction workers, construction equipment, construction materials and other elements, and also reflects the construction process and process of earthwork. Through this image, you can clearly understand the situation of the construction site and the various elements in the construction process. At the same time, you can also use the image to detect whether there are any violations in the image.

[0041] Step S104, inputting the construction image into the target backbone network layer of the target model to obtain a feature image, wherein the feature image carries weight values ​​corresponding to multiple channels, the multiple channels include a horizontal coordinate channel representing horizontal coordinate information, and a vertical coordinate channel representing vertical coordinate information, the target backbone network layer incorporates a channel-priority convolution attention mechanism, and the target model is obtained by training the initial model according to the target sample set;

[0042] In step S104 provided in the present application, a step of inputting the construction image into the target backbone network layer of the target model is described.

[0043] Among them, the target model is obtained by training the initial model according to the target sample set. The target model includes multiple layers, and the multiple layers have different functions to achieve the purpose of ultimately identifying illegal behaviors.

[0044] In this step, it is explained that the target backbone network layer, namely the Backbone layer, and the feature image obtained in the target backbone network layer have weight values ​​corresponding to multiple channels. This function can be realized by adding a cross position adaptive attention mechanism CPCA attention mechanism on the basis of the original backbone network Backbone structure. By adding the CPCA attention mechanism, different weights are adaptively given to different channels to enhance effective information, and the feature image is obtained by dynamically adjusting the weight distribution.

[0045] Among them, the channel dimension also includes a horizontal axis channel representing the horizontal axis information, and a vertical axis channel representing the vertical axis information, that is, by adding two additional channels in the channel dimension, these two channels respectively input the horizontal axis and vertical axis information, thereby providing the network with position perception capabilities.

[0046] Step S106, inputting the feature image into the middle layer of the target model to obtain a multi-scale feature map, wherein the multi-scale feature map represents the category probabilities of the corresponding targets at multiple positions in the construction image;

[0047] In step S106 provided in the present application, the step of inputting the feature image into the middle layer of the target model, namely the Neck layer, is described to obtain a multi-size feature map.

[0048] Among them, the multi-scale feature map represents the category probability of the corresponding target at multiple positions in the construction image. The feature maps of different scales and receptive fields output from the backbone network are fused through upsampling and downsampling to perform multi-scale feature fusion. Structurally, the high-resolution feature map is passed to the next layer through the upsampling operation, and is fused with the feature map of the next layer at the same time, and multi-scale feature fusion is performed from bottom to top; then a top-down channel is added for downsampling, and the low-resolution feature map is passed to the previous layer, and is fused with the feature map of the previous layer to achieve the transmission and fusion of feature information. In addition, through cascading, that is, the bottom-up and top-down features are cascaded, so that the obtained multi-scale feature map can better fuse feature information of different scales and semantic levels.

[0049] Step S108, inputting the multi-size feature map into the head network map of the target model to obtain a violation result of whether there is any violation in the construction image.

[0050] In step S108 provided in the present application, the step of inputting the multi-size feature map into the head network map of the target model, i.e., the Head layer, is described to obtain the violation result of whether there is any violation in the construction image, thereby achieving the purpose of identifying whether there is any violation in the image.

[0051] Through the above steps S102-S108, the construction image of the construction scene is obtained. The construction image is input into the target backbone network layer of the target model to obtain a feature image, wherein the feature image carries weight values ​​corresponding to multiple channels, wherein the multiple channels include a horizontal coordinate channel representing horizontal coordinate information, and a vertical coordinate channel representing vertical coordinate information. The target backbone network layer incorporates a channel-priority convolution attention mechanism, and the target model is obtained by training the initial model according to the target sample set. The feature image is input into the middle layer of the target model to obtain a multi-size feature map, wherein the multi-size feature map represents the category probability of the corresponding targets at multiple positions in the construction image. The multi-size feature map is input into the head network diagram of the target model to achieve the purpose of obtaining the violation result of whether there is a violation in the construction image. Since the channel dimension also includes a horizontal coordinate channel representing the horizontal coordinate information and a vertical coordinate channel representing the vertical coordinate information, that is, by adding two additional channels in the channel dimension, the two channels respectively input the horizontal coordinate and vertical coordinate information, thereby providing the network with position perception capabilities, so as to more accurately determine whether there are illegal behaviors in the construction image, thereby solving the technical problem in related technologies that it is difficult to accurately identify whether there are illegal behaviors in the image.

[0052] As an optional embodiment, before the construction image is input into the target backbone network layer of the target model to obtain the feature image, it also includes: obtaining image data of personnel violations in the construction scene to obtain a first sample set; screening a first sample subset, a second sample subset and a third sample subset from the first sample set, randomly blocking the target area of ​​the image in the first sample subset to obtain a first update subset, randomly flipping the image in the second sample subset to obtain a second update subset, adding weights to the samples in the third sample subset to obtain a third update subset, wherein the third sample subset is a small target sample image; determining the target sample set based on the first update subset, the second update subset and the third update subset.

[0053] In this embodiment, the steps of inputting the construction image into the target backbone network layer of the target model and obtaining the target sample set before obtaining the feature image are described. First, the image data of personnel violations in the construction scene can be obtained to obtain the first sample set. The first sample set is screened to obtain three sample subsets, namely, the first sample subset, the second sample subset and the third sample subset. These three sample subsets are processed differently, such as randomly blocking the target area of ​​the image in the first sample subset to obtain the first updated subset. The images in the second sample subset are randomly flipped to obtain the second updated subset, and the weights of the samples in the third sample subset are increased to obtain the third updated subset, wherein the third sample subset is a small target sample image; the target sample set is determined based on the first updated subset, the second updated subset and the third updated subset.

[0054] By setting the first sample subset and randomly occluding the images in the training samples, the model can be made more robust and better able to handle unknown input data. Moreover, random occlusion of the images in the training samples can help the model learn more features and patterns, thereby improving the generalization ability of the model and making it perform better on the test set. By randomly occluding the images in the training samples, the overfitting of the model to the training data can be reduced, thereby improving the generalization ability of the model. Random occlusion can increase the diversity of the data, allowing the model to learn more different situations and scenarios, thereby improving the performance of the model. In addition, it can also make the model more tolerant to noise and interference, thereby improving the robustness and performance of the model.

[0055] By setting a second sample subset and randomly flipping the images in the training samples, the diversity of the data set can be increased, allowing the model to more comprehensively learn features from different angles and perspectives. By introducing randomness, the model can better adapt to different input situations, thereby improving its generalization ability and performing better on unseen data. Randomly flipping the training samples can effectively reduce the risk of overfitting of the model, making the model more robust and reliable. By increasing data diversity and generalization ability, the training effect of the model will be improved, and it can converge faster and achieve better performance.

[0056] By setting a third sample subset, wherein the third sample subset is a small target sample image, the small target sample image generally refers to an image sample with a relatively small target object in a target detection or image classification task. Such sample images generally contain small-sized target objects and may have a certain degree of blur or noise. When processing small target sample images, some special processing methods need to be adopted to ensure accurate recognition of the target object. Therefore, the small target sample images are subjected to weight processing. Adding weight processing to the small target sample images allows the model to pay more attention to these samples, thereby improving the recognition accuracy of small targets. Since the number of small target samples in the entire data set is small, if no weight processing is performed, the model may ignore these samples or misclassify them into other categories. By adding weight processing, the model can pay more attention to learning the features of small targets, thereby improving the recognition performance of small targets. In addition, adding weight processing can also balance the sample distribution between different categories in the data set, avoid the model from being overly biased towards certain categories, thereby improving the generalization ability and performance of the overall model.

[0057] As an optional embodiment, before the construction image is input into the target backbone network layer of the target model to obtain the feature image, it also includes: obtaining an initial model, and constructing a loss function for model training, wherein the loss function represents the degree of overlap between the prediction box and the target box, the prediction box is the image corresponding to the violation part selected by the prediction box, and the target box is the image corresponding to the known violation part; based on the loss function, the initial model is trained using the target sample set to obtain the target model.

[0058] In this embodiment, the construction image is input into the target backbone network layer of the target model. Before obtaining the feature image, the step of training to obtain the target model can first obtain the initial model and construct a loss function for model training. The loss function is a function used to measure the difference or error between the model prediction result and the actual result. During the training process, the model adjusts the parameters by minimizing the loss function so that the model's prediction result is closer to the real result, thereby improving the accuracy and performance of the model. In this embodiment, the loss function represents the degree of overlap between the prediction box and the target box. The prediction box is the image corresponding to the part of the violation selected by the prediction box, and the target box is the image corresponding to the part of the known violation. That is, through the training of the loss function, the model can more accurately step out the violation. Based on the loss function, the initial model is trained with the target sample set to obtain the target model.

[0059] As an optional embodiment, an initial model is obtained, and a loss function for model training is constructed, including: determining an overlap coefficient term between a prediction box and a target box, determining an area position influence coefficient term corresponding to the prediction box and the target box; and determining a loss function based on the overlap coefficient term and the area position influence coefficient term.

[0060] In this embodiment, the steps of determining the loss function are described. In addition to considering the overlap coefficient term between the prediction box and the target box, the area between the two and its importance are also considered, which is not considered in the related art, which greatly affects the accuracy of network evaluation. Therefore, the location information, area information and the importance between the two are comprehensively weighed to enhance the accuracy and robustness of the target detection model in target positioning and important target identification.

[0061] As an optional embodiment, the feature image is input into the middle layer of the target model to obtain a multi-size feature map, including: when the middle layer is composed of an asymptotic feature pyramid network, branch detection is performed on the feature image according to the target detection branch at each level of the feature pyramid to obtain a multi-size feature map.

[0062] In this embodiment, the case where the intermediate layer is composed of an asymptotic feature pyramid network is described. In this case, at each level of the feature pyramid, there is a corresponding target detection branch, and the location and category prediction of the target are generated using convolutional layers and fully connected layers. Therefore, according to the target detection branch at each level of the feature pyramid, branch detection can be performed on the feature image to obtain a multi-size feature map that can better reflect the feature.

[0063] As an optional embodiment, a multi-size feature map is input into a head network map of a target model to obtain a violation result of whether there is any violation in the construction image, and also includes: when the violation probability corresponding to the construction image is lower than a first threshold and higher than a second threshold, determining a continuous frame image corresponding to the construction image; based on the continuous frame images, determining a violation result of whether there is any violation in the construction image.

[0064] In this embodiment, it is explained that in the process of inputting a multi-size feature map into the head network diagram of the target model to obtain the violation result of whether there is a violation in the construction image, if the violation probability corresponding to the construction image is lower than the first threshold and higher than the second threshold, that is, it is impossible to accurately determine whether there is a violation. Auxiliary judgment can be performed through continuous frame images corresponding to the construction image. When auxiliary judgment is performed, image frames that are continuous with it can be selected first, such as the previous frame image, the next frame image, etc. The violation result of whether there is a violation in the construction image can be better and more accurately determined through continuous actions in continuous frame images.

[0065] As an optional embodiment, after the multi-size feature map is input into the head network map of the target model and the violation result of whether there is a violation in the construction image is obtained, it also includes: when the violation result indicates that there is a violation in the construction image, based on the violation sub-image, determining the violation information, wherein the violation information includes at least one of the following: a violation object, a violation behavior; sending the violation information to a predetermined terminal to cause the predetermined terminal to alarm.

[0066] In this embodiment, the operation after inputting the multi-scale feature map into the head network diagram of the target model and obtaining the violation result of whether there is a violation in the construction image is described. In this embodiment, when the violation result indicates that there is a violation in the construction image, a violation sub-image can be determined, and the violation sub-image is a partial image of the construction image with the violation. Through the violation sub-image, the violation information corresponding to the violation sub-image can be determined, such as identifying the object part in the image to identify the violation object, and then identifying the specific violation, so that the violation information including the above information is sent to the predetermined terminal, so that the predetermined terminal is alarmed to play a warning role.

[0067] Based on the above embodiments and optional embodiments, an optional implementation is provided, which is described in detail below.

[0068] An optional implementation of the present invention provides a method for detecting personnel violations based on an improved YOLO-v8 network in a power construction scenario. Figure 2 is a logic flow chart provided by an optional embodiment of the present invention, Figure 3 is a system architecture diagram provided by an optional implementation manner of the present invention, Figure 4 It is a network architecture diagram provided by an optional implementation mode of the present invention, as shown in 2, 3, and 4, which is introduced below.

[0069] Step 1: Obtain image data of personnel violating regulations in construction scenes and collect data sets;

[0070] Step 2: Select some collected images to randomly block the target area, increase the weight of small target image samples, and augment and normalize the data set by random flipping and other methods. The processed data set is divided into a training set and a validation set;

[0071] Step 3: Introduce CoordConv according to the image coordinates at input to obtain position perception capability, introduce the channel priority convolutional attention mechanism (CPCA) in the feature extraction module to capture the detail information in the feature map, and use the AFPN asymptotic feature pyramid network in the neck module to replace the PAN-FPN network in the original network. Based on the above, build an improved YOLO-v8 network model;

[0072] Step 4: According to the real-time and accuracy of the detection model, the weighted cross entropy loss function WIOU loss function is selected to train the improved YOLO-v8 model;

[0073] Step 5: Obtain a traffic violation detection model and use the validation set to evaluate the accuracy of the detection model;

[0074] Step 6: The monitoring device or drone is equipped with a detection model to collect real-time image data to detect violations and send the detection results to the remote control terminal.

[0075] Specifically, in the above technical solution, step 1 obtains image data of violations of personnel in the power construction scene by obtaining real images of the power construction site through a camera or monitoring equipment. In addition, the collected image data should include scenes with different lighting conditions, different angles and distances, and cover various possible violations.

[0076] Specifically, in the above technical solution, step 2 selects 20% of the collected image data for coverage and occlusion, and randomly performs mosaic fusion on the local pixels of the target area to blur the features of the target area; at the same time, the weight of small target samples is increased to obtain more attention from the network;

[0077] In step 2, preprocessing operations such as data augmentation, size adjustment, and image enhancement are performed on the collected image data, and the target area is labeled. The target box is required to be larger than or equal to the target area. If multiple violations appear in the same image, they are labeled by category respectively, and overlapping parts between the labeled boxes are allowed.

[0078] In step 2, the data ratio of the training set and the validation set is 7:3, and all small target samples are divided into the training set, and the random occlusion samples are divided into the training set and the validation set in a 1:1 ratio.

[0079] Specifically, in the above technical solution, the improvements made to the YOLO-v8 detection network model in step 3 include:

[0080] 1. The YOLO-v8 network consists of three parts: Backbone, Neck and Head. The CPCA attention mechanism is added to the backbone structure of the backbone network to adaptively give different weights to different channels to enhance effective information and obtain feature images by dynamically adjusting the weight distribution;

[0081] 2. Before the feature image is output, two additional channels are added in the channel dimension. These two channels input the information of the horizontal and vertical coordinates respectively, thereby providing the network with position awareness.

[0082] 3. PAN-FPN is selected as the target detection network of the model, which combines the ideas of PANet and FPN. It downsamples first and then upsamples. There are two cross-layer fusion connections between the two branches of upsampling and downsampling, making it easier to pass the bottom-level information to the high-level information.

[0083] Specifically, the preprocessed image is input into the backbone network for feature extraction, where the feature extraction network is mainly composed of convolution and C2F modules. First, two layers of convolution are performed for downsampling. Secondly, a convolution normalization layer and a downsampling layer are included in three stages, and a CPCA attention mechanism is added to each C2F layer to dynamically allocate attention weights in the channel and spatial dimensions. The CPCA module captures the spatial relationship between features based on deep separable convolution and retains the relationship between channels, reducing the computational complexity. Finally, 1×1 convolution is used for channel fusion to enhance the ability to adaptively select important information.

[0084] Specifically, the feature maps generated by the above-mentioned downsampling layer are all extracted by convolution, wherein the coordinates of the input feature map are normalized before the convolution operation, and the normalized coordinates relative to the size of the feature map are calculated for each position on the feature map, and the normalized coordinates are expanded to the same dimension as the feature map to form two additional channels, one is the i coordinate and the other is the j coordinate. The standard convolution is expanded to obtain a new convolution CoordConv, and the original feature map is merged with the expanded coordinate channel to generate a new feature map, which can provide important information such as the position and size of the target when performing subsequent detection tasks;

[0085] Specifically, the Neck network combines the traditional FPN network with the PAN network, and fuses the feature maps of different scales and receptive fields output from the backbone network through upsampling and downsampling to perform multi-scale feature fusion. Structurally, the high-resolution feature map is passed to the next layer through the upsampling operation, and is fused with the feature map of the next layer at the same time, and multi-scale feature fusion is performed from the bottom to the top; then a top-down channel is added for downsampling, and the low-resolution feature map is passed to the previous layer, and is fused with the feature map of the previous layer to achieve the transmission and fusion of feature information. In addition, through cascading, that is, the bottom-up and top-down features are cascaded to better fuse feature information of different scales and semantic levels.

[0086] Specifically, in the above technical solution, step 4 is based on the improved YOLO-v8 model in step 3. At each level of the feature pyramid, there is a corresponding target detection branch, and the convolution layer and the fully connected layer are used to generate the position and category prediction of the target. The difference between the predicted prediction box and the target box is used as the optimization target of the network training. When the curve of the loss function converges and stabilizes, the model training is completed;

[0087] The optional implementation of the present invention selects the WIoU loss function for feedback of training results. The traditional IOU only considers the overlap between the prediction box and the target box, but does not consider the area between the two and its importance, which greatly affects the accuracy of network evaluation. Therefore, the position information, area information and the importance between the two are comprehensively weighed to enhance the accuracy and robustness of the target detection model in target positioning and important target recognition.

[0088] Specifically, the higher the overlap between the prediction box and the target box, the greater the weight coefficient. The calculation method of the WIOU loss function is as follows:

[0089]

[0090] Where n represents the number of prediction boxes in the image; w i represents the weight coefficient of the i-th prediction box; b irepresents the coordinates of the i-th prediction box; g i represents the coordinates of the i-th target box; IOU(b i ,g i ) represents the IoU value between the i-th predicted box and the target box.

[0091] Specifically, in the above technical solution, in step 5, based on the target detection model obtained in step 4, the validation set is used to evaluate the effect of the model, and the precision and recall are used comprehensively to evaluate the accuracy and completeness of the model.

[0092] Specifically, in the above technical solution, in step 6, when the detection model is working, the detection picture is transmitted to the remote control end in real time, and the system monitors the situation at the power construction site in real time. Through learning and training, the network can extract relevant features of personnel's illegal behaviors, such as human posture, safety helmets, protective clothing, etc.

[0093] When the detection model identifies a violation by a person, the system automatically records key information such as the time, location, and personal information of the violation, and issues an alarm by broadcasting a warning message through voice or displaying a warning text on the display screen, and sends an alarm message to the management personnel to remind relevant personnel to take timely measures, including providing a basis for subsequent safety analysis and management, such as accident investigation and accountability.

[0094] The optional implementation manner of the present invention proposes a method for detecting personnel violations based on an improved YOLO-v8 network in a power construction scenario, which mainly includes an image acquisition module, a feature extraction and fusion module, an automatic target detection module, and a violation warning module. Based on the collaborative cooperation of the above modules, accurate detection of violations can be achieved quickly, and at least the following beneficial effects can be achieved:

[0095] 1. The dataset is enhanced by using small sample enhancement and random occlusion of the target area, so that the model can focus more on the contextual information and key features of the target, reduce sensitivity to background interference, and help improve the robustness and generalization ability of the model in complex scenes;

[0096] 2. Introduce CoordConv to obtain position perception ability, so that the network pays more attention to the local structure and position information of the input feature map, thereby better understanding the image.

[0097] 3. Using the improved YOLO-v8 network, the backbone network adds the CPCA attention mechanism in the downsampling process, dynamically adjusts the weight distribution of important information, and performs multi-scale feature fusion and information transmission to enhance the availability of feature information and the robustness of the detection model.

[0098] 4. The optional implementation mode of the present invention is combined with an alarm system to monitor the situation at the power construction site in real time, which can automatically identify violations, reduce the workload of manual inspections, and record key information to provide a basis for subsequent safety analysis and management.

[0099] It should be noted that, for the above-mentioned method embodiments, for the sake of simplicity, they are all described as a series of action combinations, but those skilled in the art should know that the present invention is not limited by the described action sequence, because according to the present invention, certain steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present invention.

[0100] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods of various embodiments of the present invention.

[0101] Example 2

[0102] According to an embodiment of the present invention, a device for implementing the above-mentioned method for determining traffic violation behavior in an image is also provided. Figure 5 is a structural block diagram of a device for determining traffic violation behavior in an image according to an embodiment of the present invention. Figure 5 As shown, the device includes: an acquisition module 502, a first determination module 504, a second determination module 506 and a third determination module 508. The device is described in detail below.

[0103] An acquisition module 502 is used to acquire a construction image in a construction scene; a first determination module 504 is connected to the acquisition module 502, and is used to input the construction image into the target backbone network layer of the target model to obtain a feature image, wherein the feature image carries weight values ​​corresponding to multiple channels, wherein the multiple channels include a horizontal axis channel representing horizontal axis information, and a vertical axis channel representing vertical axis information, and the target backbone network layer incorporates a channel-priority convolution attention mechanism, and the target model is obtained by training the initial model according to the target sample set; a second determination module 506 is connected to the first determination module 504, and is used to input the feature image into the middle layer of the target model to obtain a multi-size feature map, wherein the multi-size feature map represents the category probability of the corresponding targets at multiple positions in the construction image; a third determination module 508 is connected to the second determination module 506, and is used to input the multi-size feature map into the head network map of the target model to obtain a violation result of whether there is any violation in the construction image.

[0104] It should be noted here that the above-mentioned acquisition module 502, the first determination module 504, the second determination module 506 and the third determination module 508 correspond to steps S102 to S108 in the method for determining traffic violations in implementation images, and the instances and application scenarios implemented by the multiple modules are the same as the corresponding steps, but are not limited to the contents disclosed in the above-mentioned embodiment 1.

[0105] Example 3

[0106] According to another aspect of an embodiment of the present invention, there is also provided an electronic device, comprising: a processor; and a memory for storing instructions executable by the processor, wherein the processor is configured to execute instructions to implement any of the above methods for determining traffic violation behaviors in an image.

[0107] Example 4

[0108] According to another aspect of an embodiment of the present invention, a computer-readable storage medium is provided. When instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device can execute any of the above methods for determining traffic violations in an image.

[0109] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.

[0110] In the above embodiments of the present invention, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0111] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units can be a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.

[0112] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0113] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0114] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, magnetic disk or optical disk and other media that can store program codes.

[0115] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.

Claims

1. A method for determining traffic violation behavior in an image, characterized in that: include: Acquire construction images in construction scenes; Input the construction image into the target backbone network layer of the target model to obtain a feature image, wherein the feature image carries weight values ​​corresponding to multiple channels, the multiple channels include a horizontal coordinate channel representing horizontal coordinate information, and a vertical coordinate channel representing vertical coordinate information, the target backbone network layer incorporates a channel-priority convolution attention mechanism, and the target model is obtained by training the initial model according to the target sample set; Inputting the feature image into the middle layer of the target model to obtain a multi-scale feature map, wherein the multi-scale feature map represents the category probabilities of the corresponding targets at multiple positions in the construction image; The multi-size feature map is input into the head network map of the target model to obtain a violation result of whether there is any violation in the construction image.

2. The method according to claim 1, characterized in that Before inputting the construction image into the target backbone network layer of the target model to obtain the feature image, the method further includes: Acquire image data of personnel violating traffic rules in a construction scene to obtain a first sample set; Selecting a first sample subset, a second sample subset and a third sample subset from the first sample set, randomly blocking the target area of ​​the images in the first sample subset to obtain a first update subset, randomly flipping the images in the second sample subset to obtain a second update subset, and increasing the weight of the samples in the third sample subset to obtain a third update subset, wherein the third sample subset is a small target sample image; A target sample set is determined according to the first updated subset, the second updated subset and the third updated subset.

3. The method according to claim 2, characterized in that Before inputting the construction image into the target backbone network layer of the target model to obtain the feature image, the method further includes: Acquire an initial model, and construct a loss function for model training, wherein the loss function represents the degree of overlap between a prediction box and a target box, the prediction box is an image corresponding to the portion of the violation selected by the prediction box, and the target box is an image corresponding to the portion of the known violation; Based on the loss function, the initial model is trained using the target sample set to obtain the target model.

4. The method according to claim 3, characterized in that Obtain the initial model and construct the loss function for model training, including: Determine an overlap coefficient term between the prediction frame and the target frame, and determine an area position influence coefficient term corresponding to the prediction frame and the target frame; The loss function is determined based on the overlap coefficient term and the area position influence coefficient term.

5. The method according to claim 1, characterized in that Inputting the feature image into the middle layer of the target model to obtain a multi-size feature map, including: In the case where the intermediate layer is composed of an asymptotic feature pyramid network, branch detection is performed on the feature image according to the target detection branch at each level of the feature pyramid to obtain the multi-scale feature map.

6. The method according to claim 1, characterized in that Inputting the multi-size feature map into the head network map of the target model to obtain a violation result of whether there is a violation in the construction image, further comprising: When the probability of violation corresponding to the construction image is lower than a first threshold value and higher than a second threshold value, determining continuous frame images corresponding to the construction image; Based on the continuous frame images, it is determined whether there are any violation results of illegal behavior in the construction image.

7. The method according to any one of claims 1 to 6, characterized in that: Inputting the multi-size feature map into the head network map of the target model to obtain a violation result of whether there is a violation in the construction image, further comprising: In the case where the violation result indicates that there is a violation behavior in the construction image, determining violation information based on the violation sub-image, wherein the violation information includes at least one of the following: a violation object, a violation behavior; The traffic violation information is sent to a predetermined terminal so that the predetermined terminal issues an alarm.

8. A device for determining traffic violation behavior in an image, characterized in that: include: An acquisition module, used to acquire construction images in a construction scene; A first determination module is used to input the construction image into a target backbone network layer of a target model to obtain a feature image, wherein the feature image carries weight values ​​corresponding to a plurality of channels, the plurality of channels include a horizontal coordinate channel representing horizontal coordinate information, and a vertical coordinate channel representing vertical coordinate information, the target backbone network layer incorporates a channel-priority convolution attention mechanism, and the target model is obtained by training an initial model according to a target sample set; A second determination module is used to input the feature image into the middle layer of the target model to obtain a multi-scale feature map, wherein the multi-scale feature map represents the category probabilities of the corresponding targets at multiple positions in the construction image; The third determination module is used to input the multi-size feature map into the head network map of the target model to obtain a violation result of whether there is any violation in the construction image.

9. An electronic device, characterized in that: include: processor; a memory for storing instructions executable by the processor; The processor is configured to execute the instructions to implement the method for determining traffic violation behavior in an image as described in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: When the instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the method for determining traffic violation behavior in an image as described in any one of claims 1 to 7.

Citation Information

Patent Citations

  • Complex road scene target detection method based on YOLOv7 improvement

    CN116844126A

  • Power grid switching operation violation identification method and device

    CN117935361A

Cited By

  • Training method of acid-base leakage monitoring model and acid-base leakage monitoring method and device

    CN119721134A