A target detection method and system for smart construction site security

By integrating multi-layer spatial displacement sensing visual backbone network and attention mechanism in the YOLOV8 object detection model, and using the fully convolutional spatial pyramid convolution module, the problem of poor target detection effect in complex environments of the construction site is solved, and efficient and accurate target detection in complex environments is achieved.

CN118262290BActive Publication Date: 2025-03-04BEIJING NORTH STAR DIGITAL REMOTE SENSING TECH CO LTD

Patent Information

Application Number
CN202410423137.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-04-09
Publication Date
2025-03-04
Estimated Expiration
2044-04-09

AI Technical Summary

Technical Problem

Existing object detection algorithms based on computer vision and machine learning have problems with poor recognition effects in complex construction sites, especially in situations such as poor lighting conditions, object movement, misalignment of spatial pixels, mismatch of color brightness, inappropriate shooting angles and bad weather.

Method used

An improved object detection model is built by integrating the multi-layer spatial displacement sensing visual backbone network S2-MLPv2 attention mechanism in YOLOV8's object detection basic network and replacing the spatial pyramid pooling module with a fully convolutional spatial pyramid convolution module. The model uses historical images of the construction site for training, and detects target violations at the construction site in real time, triggers the early warning system and outputs the violation images.

Benefits of technology

This method can improve the accuracy and efficiency of target detection in complex construction site environments, promptly detect potential safety hazards, and improve the efficiency and accuracy of construction site safety management through early warning systems.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118262290B_ABST
    Figure CN118262290B_ABST
Patent Text Reader

Abstract

The present invention belongs to the field of target detection technology, and specifically is a target detection method applied to smart construction site security, the method comprising the following steps: constructing a YOLOV8 target detection original model; using historical images collected on the construction site to train the YOLOV8 target detection original model to obtain a trained target detection model; inputting the real-time to-be-detected images collected on the construction site into the trained target detection model, detecting target violations on the construction site in real time, and classifying and locating the detected behaviors, while triggering an early warning system and outputting violation images. The present invention also discloses a target detection system applied to smart construction site security. The target detection model provided by the present invention is applied to a smart construction site, and can monitor various behaviors on the construction site in real time, discover potential safety hazards in a timely manner, and issue alarms or take corresponding preventive measures in a timely manner. This method greatly improves the efficiency of construction site safety management.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of target detection, and in particular, relates to a target detection method and system applied to smart construction site security. Background Art

[0002] Construction site management has become more difficult, and manual inspection of construction site safety behavior can no longer meet the needs of construction site safety management.

[0003] In recent years, with the rapid development of artificial intelligence technology, the formation of smart construction sites has been promoted accordingly to strengthen the real-time monitoring and management of construction sites. The underlying algorithm for target detection on construction sites using computer vision technology is a target detection algorithm based on deep learning. By obtaining digital videos and images of the construction site, the target detection algorithm can realize target recognition on the construction site.

[0004] At present, the target detection algorithm based on computer vision and machine learning has a significant effect on the recognition of construction site targets, but there are still some bottleneck problems: the images obtained at the construction site do not fully consider the challenges of other noises in the complex environmental conditions of the construction site (such as poor lighting conditions, object motion, spatial pixel misalignment, color brightness mismatch, inappropriate shooting angle, bad weather, etc.) to target detection, which may affect the effectiveness of subsequent target detection. Summary of the invention

[0005] The purpose of the embodiments of the present invention is to provide a target detection method and system for smart construction site security, aiming to solve the technical problems raised in the above-mentioned background technology.

[0006] To achieve the above object, the present invention provides the following technical solutions.

[0007] In a first aspect, in one embodiment of the present invention, a target detection method for smart construction site security is provided, the target detection method comprising the following steps:

[0008] Step S101: construct a basic network for target detection based on YOLOV8, integrate the multi-layer spatial displacement-aware visual backbone network S2-MLPv2 attention mechanism into the feature fusion module of the YOLOV8 basic network, and use the fully convolutional spatial pyramid convolution module to replace the spatial pyramid pooling module connecting the backbone and neck in the YOLOV8 model to obtain the original model of YOLOV8 target detection;

[0009] Step S102: training the YOLOV8 target detection original model using historical images collected at the construction site to obtain a trained target detection model;

[0010] Step S103: Input the real-time images to be detected collected at the construction site into the trained target detection model, detect the target violation behaviors at the construction site in real time, classify and locate the detected behaviors, trigger the early warning system, and output the violation images.

[0011] Optionally, in the S2-MLPv2 attention mechanism, the feature map of channel C is expanded to a 3C channel feature map; the expanded feature map is divided into three parts along the channel dimension, and different spatial shift operations are applied to each part; through the split attention operation, the shifted parts are merged to generate a C channel feature map.

[0012] Optionally, given a feature map X∈R w×h×c , expand the X channel from c to 3c through a multilayer perceptron:

[0013]

[0014] in, refers to the expanded feature map; MLP refers to the multi-layer perceptron; w refers to the width of the feature map; h refers to the height of the feature map; c refers to the channel of the feature map;

[0015] The extended feature map The channel dimension is divided into three equal parts:

[0016] Part I:

[0017] Part II:

[0018] Part III:

[0019] By using two spatial displacement layers SS1(·) and SS2(·) to change X 1 and X 2 location;

[0020] SS1(·) performs the following spatial shift operations:

[0021] X[1:h-1,:,1:c / 4]→X[2:h,1:c / 4]

[0022] X[2:h,:,c / 4+1:c / 2]→X[1:h-1,:,1:c / 4+1:c / 2]

[0023] X[:,1:W-1,c / 2:3c / 4]→X[:,2:w,c / 2:3c / 4]

[0024] X[:, 2: w, 3c / 4: c]→X[:, 1: w-1, 3c / 4: c] (2);

[0025] SS2(·) performs an asymmetric spatial shift operation on SS1(·).

[0026] Optionally, the specific steps of SS2(·) performing an asymmetric spatial displacement operation on SS1(·) include:

[0027] Given a feature map X 2 , SS2(X 2 )implement:

[0028] X 2 [:, 2:w, 1:c / 4]←X 2 [:, 1:w-1, 1:c / 4]

[0029] X2[:,1:w-1,c / 4+1:c / 2]←X 2 [:, 2:w, c / 4+1:c / 2]

[0030] X 2 [2:h,:c / 2:3c / 4]←X 2 [1:h-1,:,c / 2:3c / 4]

[0031] X 2 [1:h-1,:,3c / 4:c]←X 2 [2:h,:,3c / 4:c] (3);

[0032] SS1(·) and SS2(·) complement each other.

[0033] Optionally, the step of training the YOLOV8 target detection original model using historical images collected at the construction site includes:

[0034] Performing enhancement processing on the collected historical images of the construction site to obtain an enhanced target image;

[0035] Use the LabelMe image annotation tool to create accurate bounding boxes and category labels for the objects to be detected in each target image;

[0036] Convert the JSON file generated by LabelMe annotation into a TXT file in YOLO format;

[0037] The YOLOV8 object detection original model is trained using an enhanced image set containing bounding boxes and category labels of the objects to be detected.

[0038] Optionally, the steps of converting the JSON file generated by LabelMe annotation into a TXT file in YOLO format include:

[0039] Iterate over each object in the LabelMe JSON file and extract the coordinates of the category and bounding box;

[0040] Convert the coordinates to relative values ​​with respect to the image width and height;

[0041] Write the converted information into a TXT file in YOLO format.

[0042] Optionally, the step of enhancing the collected historical images of the construction site includes:

[0043] The historical images are enhanced by means of size correction, photometric distortion and geometric distortion;

[0044] When processing the size, the image is preprocessed by resizing and normalizing;

[0045] Adjust image brightness, contrast, hue, saturation, and noise when dealing with photometric distortion;

[0046] Added random scaling, cropping, flipping and selection when dealing with geometric distortions.

[0047] Optionally, the steps of training the YOLOV8 target detection original model using the enhanced image set include:

[0048] Use random seeds to divide the enhanced image set into training set, validation set and test set;

[0049] The original model is trained using the training set, and the optimized loss function is used in an iterative manner to obtain a trained target detection model;

[0050] During the training process, the validation set is used to evaluate the performance of the detection model and adjust the model's hyperparameters;

[0051] Compare the performance of different training strategies on the validation set to select the final object detection model.

[0052] Optionally, during model training, the target detection network is optimized using a combination of cross entropy loss and dice loss. The combined loss of cross entropy loss and dice loss is expressed as:

[0053]

[0054] in, represents the initial loss combination; L Ce represents the classification cross entropy loss; L Dice represents the soft dice loss; I represents an image without a classification label; I′ represents an image with a classification table;

[0055] In addition, the inter-class distance optimization loss Lclass Distinguish boundary pixels; with the above total loss L cons In the case of , the total objective loss function of the training network is expressed as:

[0056]

[0057] Among them, γ cons and γ class is the weighting coefficient, and its values ​​are 0.5 and 0.7 respectively.

[0058] In a second aspect, in another embodiment of the present invention, a target detection system for smart construction site security is provided, the target detection system comprising:

[0059] The model building module is used to build a basic network for object detection based on YOLOV8. The S2-MLPv2 attention mechanism of the multi-layer spatial displacement-aware visual backbone network is integrated into the feature fusion module of the YOLOV8 basic network. The fully convolutional spatial pyramid convolution module is used to replace the spatial pyramid pooling module connecting the backbone and neck in the YOLOV8 model to obtain the original model of YOLOV8 object detection.

[0060] A model training module is used to train the YOLOV8 target detection original model using historical images collected on the construction site to obtain a trained target detection model;

[0061] The target behavior detection module inputs the real-time images to be detected collected at the construction site into the trained target detection model, detects the target violations at the construction site in real time, and classifies and locates the detected behaviors;

[0062] The early warning output module is used to trigger the early warning system and output a violation image when the target behavior detection module detects target violation behavior at the construction site.

[0063] Compared with the prior art, the target detection method and system of the present invention applied to smart construction site security have the following beneficial effects:

[0064] First, the target detection model provided by the present invention can be applied to smart construction sites to monitor various behaviors on the construction site in real time, and timely discover potential safety hazards, such as not wearing safety helmets, dangerous behaviors of workers, etc., and promptly issue alarms or take corresponding preventive measures. This method greatly improves the efficiency and accuracy of construction site safety management;

[0065] Second, the present invention constructs a target detection model based on YOLOv8, and integrates the S2-MLPv2 attention mechanism of the visual backbone network with multi-layer spatial displacement perception, and a scheme using a fully convolutional spatial pyramid convolution module (FC-SPP). The multi-layer spatial displacement perception capability enables the model to process features of different scales; due to the introduction of the attention mechanism and the FC-SPP module, the model can better handle various complex scenes and diversified targets, which helps to improve the generalization ability of the model in different environments; therefore, the target detection model of the present invention can maintain real-time performance while improving the target detection accuracy, and is suitable for a variety of complex scenes and diversified target detection tasks;

[0066] Second, in model training, the use of a combination of cross entropy loss and dice loss to optimize the target detection network can simultaneously optimize the model's detection performance and classification performance. This combined loss function enables the model to focus on the accuracy of category prediction and the accuracy of bounding box positioning during training, thereby improving the detection effect of the target detection model. BRIEF DESCRIPTION OF THE DRAWINGS

[0067] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present invention.

[0068] Figure 1 This is a flow chart of an implementation of a target detection method for smart construction site security according to the present invention;

[0069] Figure 2 This is the spatial structure diagram of the attention mechanism S2-MLPv2 of the present invention;

[0070] Figure 3 A schematic diagram of the process of training the YOLOV8 target detection original model in the present invention;

[0071] Figure 4 This is a schematic diagram of the process of converting the JSON file generated by LabelMe annotation into a TXT file in YOLO format in the present invention;

[0072] Figure 5 It is a schematic diagram of the process of enhancing the historical images collected at the construction site according to the present invention;

[0073] Figure 6 A schematic diagram of the process of training the YOLOV8 target detection original model using the enhanced image set in the present invention;

[0074] Figure 7 This is a structural block diagram of a target detection system applied to smart construction site security in the present invention. DETAILED DESCRIPTION

[0075] Below, the present application is further described in conjunction with the accompanying drawings and specific implementation methods. It should be noted that, under the premise of no conflict, the various embodiments or technical features described below can be arbitrarily combined to form a new embodiment.

[0076] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the embodiments of the present invention are further described in detail below in combination with specific embodiments and with reference to the accompanying drawings. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0077] It should be noted that all expressions using "first" and "second" in the embodiments of the present invention are intended to distinguish two non-identical entities or non-identical parameters with the same name. It can be seen that "first" and "second" are only for the convenience of expression and should not be understood as limitations on the embodiments of the present invention. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, other steps or units inherent to a process, method, system, product or device that includes a series of steps or units.

[0078] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0079] The flowcharts shown in the accompanying drawings are only examples and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps may also be decomposed, combined or partially merged, so the actual execution order may change according to actual conditions.

[0080] In conjunction with the accompanying drawings, some embodiments of the present application are described in detail below. In the absence of conflict, the following embodiments and features in the embodiments can be combined with each other.

[0081] At present, the target detection algorithm based on computer vision and machine learning has a significant effect on the recognition of construction site targets, but there are still some bottleneck problems: the images obtained at the construction site do not fully consider the challenges of other noises in the complex environmental conditions of the construction site to target detection, which may affect the effectiveness of subsequent target detection.

[0082] To solve the above problems, the present invention improves the basic network of YOLOV8. Specifically, the S2-MLPv2 attention mechanism of the multi-layer spatial displacement perception visual backbone network is integrated into the feature fusion module of the YOLOV8 basic network, and the spatial pyramid pooling module connecting the backbone and the neck in the YOLOV8 model is replaced by a fully convolutional spatial pyramid convolution module to obtain the YOLOV8 target detection original model; then the YOLOV8 target detection original model is trained using historical images collected on the construction site to obtain a trained target detection model; further, the real-time image to be detected collected on the construction site is input into the trained target detection model, the target violation behavior on the construction site is detected in real time, and the detected behavior is classified and located, and the early warning system is triggered at the same time, and the violation image is output.

[0083] Through the above scheme, the present invention can monitor various behaviors on the construction site in real time, promptly discover potential safety hazards, such as not wearing a safety helmet, dangerous behaviors of workers, etc., and promptly issue an alarm or take corresponding preventive measures. This method greatly improves the efficiency and accuracy of construction site safety management; the multi-layer spatial displacement perception capability enables the model to process features of different scales; due to the introduction of the attention mechanism and the FC-SPP module, the model can better handle various complex scenarios and diverse targets, which helps to improve the generalization ability of the model in different environments.

[0084] The specific implementation of the target detection method of the present invention is described in detail below in conjunction with specific embodiments.

[0085] like Figure 1 and Figure 2 As shown, in one embodiment of the present invention, a target detection method applied to smart construction site security includes the following steps:

[0086] Step S101: construct a basic network for target detection based on YOLOV8, integrate the multi-layer spatial displacement-aware visual backbone network S2-MLPv2 attention mechanism into the feature fusion module of the YOLOV8 basic network, and use the fully convolutional spatial pyramid convolution module to replace the spatial pyramid pooling module connecting the backbone and neck in the YOLOV8 model to obtain the original model of YOLOV8 target detection;

[0087] The present invention constructs a target detection model based on YOLOv8, and integrates a multi-layer spatial displacement perception visual backbone network S2-MLPv2 attention mechanism, and a solution using a fully convolutional spatial pyramid convolution module (FC-SPP). The multi-layer spatial displacement perception capability enables the model to process features of different scales; due to the introduction of the attention mechanism and the FC-SPP module, the model can better process various complex scenes and diversified targets, which helps to improve the generalization ability of the model in different environments; therefore, the target detection model of the present invention can maintain real-time performance while improving target detection accuracy, and is suitable for a variety of complex scenes and diversified target detection tasks.

[0088] In the S2-MLPv2 attention mechanism, the feature map of channel C is expanded to a 3C channel feature map; the expanded feature map is divided into three parts along the channel dimension, and different spatial displacement operations are applied to each part; through the split attention operation, the shifted parts are merged to generate a C channel feature map.

[0089] Specifically, in the embodiment of the present invention, a feature graph X∈R is first given w×h×c , and then expand the X channel from c to 3c through a multilayer perceptron:

[0090]

[0091] in, refers to the expanded feature map; MLP refers to the multi-layer perceptron; w refers to the width of the feature map; h refers to the height of the feature map; c refers to the channel of the feature map;

[0092] Furthermore, the extended feature map The channel dimension is divided into three equal parts:

[0093] Part I:

[0094] Part II:

[0095] Part III:

[0096] Furthermore, the embodiment of the present invention changes the positions of X1 and X2 through two spatial displacement layers SS1(·) and SS2(·); SS1(·) performs the following spatial displacement operation:

[0097] X[1:h-1,:,1:c / 4]→X[2:h,:,1:c / 4]

[0098] X[2:h,:,c / 4+1:c / 2]→X[1:h-1,:,1:c / 4+1:c / 2]

[0099] X[:,1:w-1,c / 2:3c / 4]→X[:,2:w,c / 2:3c / 4]

[0100] X[:, 2: w, 3c / 4: c]→X[:, 1: w-1, 3c / 4: c] (2);

[0101] SS2(·) performs an asymmetric spatial shift operation on SS1(·).

[0102] Accordingly, in the embodiment of the present invention, the specific steps of SS2(·) performing an asymmetric spatial displacement operation on SS1(·) include:

[0103] Given a feature map X 2 , SS2(X 2 ) does the following:

[0104] X 2 [:, 2:w, 1:c / 4]←X 2 [:, 1:w-1, 1:c / 4]

[0105] X 2 [:,1:w-1,c / 4+1:c / 2]←X 2 [:, 2:w, c / 4+1:c / 2]

[0106] X 2 [2:h,:,c / 2:3c / 4]←X 2 [1:h-1,:,c / 2:3c / 4]

[0107]

[0108] SS1(·) and SS2(·) complement each other.

[0109] For further information, please refer to Figure 1 , the target detection method of the embodiment of the present invention further includes:

[0110] Step S102: training the YOLOV8 target detection original model using historical images collected at the construction site to obtain a trained target detection model;

[0111] Step S103: Input the real-time images to be detected collected at the construction site into the trained target detection model, detect the target violation behaviors at the construction site in real time, classify and locate the detected behaviors, trigger the early warning system, and output the violation images.

[0112] The present invention uses an improved YOLOV8DE deep learning target detection algorithm to analyze the real-time video stream of the construction site and identify targets such as workers in the image; the model receives video stream data from the camera, processes each frame of the image, identifies the target, identifies the target status, and updates the status label corresponding to the target in real time.

[0113] When the model of the present invention detects a violation, the system will automatically trigger an early warning mechanism and send a notification to the project manager through sound, light signals or directly so that timely measures can be taken.

[0114] Preferably, the early warning system can be integrated with the construction site’s broadcast system, SMS platform or mobile application to ensure that information can be quickly conveyed to relevant personnel.

[0115] Furthermore, the present invention will capture and save images or video clips of violations as evidence records to facilitate subsequent analysis and accountability. These images can be used for safety training and education to remind workers to pay attention to safety regulations.

[0116] It can be understood that the target detection model provided by the present invention is applied to a smart construction site to monitor various behaviors on the construction site in real time, promptly discover potential safety hazards, such as not wearing a safety helmet, dangerous behaviors of workers, etc., and promptly issue an alarm or take corresponding preventive measures. Adopting this method in a smart construction site can greatly improve the efficiency and accuracy of construction site safety management and provide a safer and more efficient working environment for the construction site.

[0117] Further, such as Figure 3 As shown, in some embodiments of the present invention, the step of training the YOLOV8 target detection original model using historical images collected at the construction site includes:

[0118] Step S201: performing enhancement processing on the collected historical image of the construction site to obtain an enhanced target image;

[0119] Step S202: Use the LabelMe image annotation tool to create accurate bounding boxes and category labels for the target to be detected in each target image;

[0120] Labelme is an image annotation tool used to provide annotation data for the target detection model algorithm of the present invention. Labelme supports multiple annotation types, including rectangular boxes, polygons, points and lines, etc. For the target detection task of the smart construction site of the present invention, the rectangular box (Rectangle) annotation type is selected; when performing rectangular box annotation, a bounding box is drawn to create a rectangle around the target object. Labelme allows the user to adjust the size and position of the bounding box to ensure that it accurately covers the target object; for each bounding box, the user needs to assign a label to it, that is, the category of the object; Labelme allows the user to select from a predefined list of categories, and can also create new categories.

[0121] Labelme supports saving annotation information in multiple formats, including JSON, XML, etc. For training data in YOLO format, you can choose to save it in JSON format; when saving, Labelme will create an annotation file with the same name as the original image, which contains information such as the location, size, and category of the bounding box.

[0122] Export the labeled data to a specific format for training object detection models. For example, you can convert a JSON file to a YOLO-formatted labeled file.

[0123] Through the above steps, you can use Labelme to create high-quality labeled data for the YOLOv8 object detection algorithm. This data will be used to train the model so that it can accurately identify and locate the target objects in the image.

[0124] For further information, please refer to Figure 3 The present invention further includes the step of training the YOLOV8 target detection original model using historical images collected at the construction site:

[0125] Step S203: Convert the JSON file generated by LabelMe annotation into a TXT file in YOLO format;

[0126] Among them, LabelMe's JSON file contains the image path, size, and category and coordinate information of each target. These coordinates are usually absolute pixel coordinates starting from the upper left corner of the image. The TXT file in YOLO format requires the category index, center point coordinates (relative to the ratio of image width and height), width and height (also relative to the ratio of image size) of each target.

[0127] Prepare a Python script to read the JSON file, parse the data in it, and generate a TXT file according to the YOLO format requirements. Specifically, convert the annotation information in each JSON file into the YOLO format and save it as a TXT file.

[0128] Step S204: The YOLOV8 target detection original model is trained using the enhanced image set formed by the bounding box and category label containing the target to be detected.

[0129] like Figure 4 As shown, in some embodiments of the present invention, the step of converting the JSON file generated by LabelMe annotation into a TXT file in YOLO format includes:

[0130] Step S301: traverse each object in the LabelMe JSON file and extract the coordinates of the category and bounding box;

[0131] Step S302: converting the coordinates into relative values ​​relative to the width and height of the image;

[0132] Step S303: Write the converted information into a TXT file in YOLO format.

[0133] like Figure 5 As shown, in some embodiments of the present invention, the step of enhancing the collected historical images of the construction site includes:

[0134] Step S401: enhancing the historical image by means of size correction, photometric distortion and geometric distortion;

[0135] Step S402: When processing the size, perform pre-processing operations of resizing and normalizing the image;

[0136] In the specific implementation of step S402, the preprocessing operations of resizing and normalizing the image can ensure the consistency of the input data, accelerate the model training process, and improve the performance of the model; for image resizing: all input images are adjusted to the fixed size required by the model, and the image size can be adjusted by interpolation methods such as bilinear interpolation, nearest neighbor interpolation, etc.; ensure that the adjusted image size meets the input requirements of the YOLOv8 model; for example, YOLOv8 may require a fixed input size, such as 416x416 pixels.

[0137] Normalizing the image pixel values ​​so that their range is within a certain range, usually between 0 and 1, or -1 to 1, helps the stability and convergence speed of model training; normalization can be achieved by subtracting the average value (mean normalization) or the maximum value (maximum-minimum normalization) of the image.

[0138] Step S403: when processing photometric distortion, adjusting the brightness, contrast, hue, saturation and noise of the image;

[0139] Step S404: When processing geometric distortion, random scaling, cropping, flipping and selection are added to increase the diversity of the dataset and improve the generalization ability of the model.

[0140] like Figure 6 As shown, in an embodiment of the present invention, the steps of training the YOLOV8 target detection original model using the enhanced image set include:

[0141] Step S501: using random seeds to divide the enhanced image set into a training set, a validation set and a test set;

[0142] Exemplarily, the division ratio of the present invention includes 70% training set, 15% validation set and 15% test set, and this ratio can also be adjusted as needed;

[0143] Step S502: training the original model using the training set, using the optimized loss function, and training in an iterative manner to obtain a trained target detection model;

[0144] Step S503: during the training process, the validation set is used to evaluate the performance of the detection model and adjust the hyperparameters of the model;

[0145] Step S504: Compare the performance of different training strategies on the validation set to select the final object detection model.

[0146] Furthermore, in model training, the target detection network is optimized using a combination of cross entropy loss and dice loss. The combined loss of cross entropy loss and dice loss is expressed as:

[0147]

[0148] in, represents the initial loss combination; L Ce represents the classification cross entropy loss; L Dice represents the soft dice loss; I represents an image without a classification label; I′ represents an image with a classification table;

[0149] In addition, the inter-class distance optimization loss L class Distinguish boundary pixels; with the above total loss L cons In the case of , the total objective loss function of the training network is expressed as:

[0150]

[0151] Among them, γ cons and γ class is the weighting coefficient, and its values ​​are 0.5 and 0.7 respectively.

[0152] In the YOLOv8 target detection model of the present invention, when the cross-entropy loss (Cross-Entropy Loss) and the dice loss (Dice Loss) are combined, the performance of the model in target classification and bounding box positioning can be improved:

[0153] The cross entropy loss function is used for classification tasks and measures the difference between the probability distribution predicted by the model and the probability distribution of the true label. The cross entropy loss encourages the model to learn a more accurate category probability distribution, thereby improving the model's ability to recognize the target category. It can also effectively deal with the problem of category imbalance and ensure that each category receives appropriate attention.

[0154] The dice loss function is used to deal with the bounding box positioning problem. The dice loss measures the similarity between the predicted bounding box and the true bounding box by calculating the ratio of the intersection to the union between the two. The dice loss function of the present invention is more robust to small deviations of the bounding box, which helps the model to locate the target more accurately during training.

[0155] Therefore, the present invention combines the cross entropy loss and the dice loss. In model training, the target detection network is optimized using the combination of the cross entropy loss and the dice loss, which can simultaneously optimize the detection performance and classification performance of the model. This combined loss function enables the model to focus on the accuracy of category prediction and the accuracy of bounding box positioning during training, thereby providing the detection effect of the target detection model.

[0156] like Figure 7 As shown, in another embodiment provided by the present invention, a target detection system for smart construction site security is provided, and the target detection system includes:

[0157] Model construction module 601 is used to construct a basic network for target detection based on YOLOV8, integrate the multi-layer spatial displacement-aware visual backbone network S2-MLPv2 attention mechanism into the feature fusion module of the YOLOV8 basic network, and use a fully convolutional spatial pyramid convolution module to replace the spatial pyramid pooling module connecting the backbone and the neck in the YOLOV8 model to obtain the original model of YOLOV8 target detection;

[0158] A model training module 602 is used to train the YOLOV8 target detection original model using historical images collected at the construction site to obtain a trained target detection model;

[0159] The target behavior detection module 603 inputs the real-time images to be detected collected at the construction site into the trained target detection model, detects the target illegal behaviors at the construction site in real time, and classifies and locates the detected behaviors;

[0160] The early warning output module 604 is used to trigger the early warning system and output a violation image when the target behavior detection module detects a target violation behavior at the construction site.

[0161] The target detection system for smart construction site security of the present invention has broad application prospects in the field of smart construction site management, can significantly improve the efficiency and accuracy of target detection, ensure safe production on the construction site, and provide a higher level of support for life and production on the construction site.

[0162] In another embodiment provided by the present invention, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, the target detection method for smart construction site security according to any one of the above embodiments is implemented, and the method includes the following steps:

[0163] Build a basic network for object detection based on YOLOV8, integrate the multi-layer spatial displacement-aware visual backbone network S2-MLPv2 attention mechanism into the feature fusion module of the YOLOV8 basic network, and use the fully convolutional spatial pyramid convolution module to replace the spatial pyramid pooling module connecting the backbone and neck in the YOLOV8 model to obtain the original model of YOLOV8 object detection;

[0164] The YOLOV8 target detection original model is trained using historical images collected at the construction site to obtain a trained target detection model;

[0165] The real-time images to be detected collected at the construction site are input into the trained target detection model to detect the target violations at the construction site in real time, classify and locate the detected behaviors, trigger the early warning system, and output the violation images.

[0166] The computer device includes a processor and a memory, and may also include: an input system and an output system. The processor, memory, input system and output system may be connected via a bus or other means, and the input system may receive input digital or character information, and generate signal input related to target detection applied to smart construction site security. The output system may include display devices such as display screens.

[0167] As a non-volatile computer-readable storage medium, the memory can be used to store non-volatile software programs, non-volatile computer executable programs and modules, such as the program instructions / modules corresponding to the target detection method applied to smart construction site security in the embodiment of the present application. The memory may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created by the use of the target detection method applied to smart construction site security, etc. In addition, the memory may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some embodiments, the memory may optionally include a memory remotely arranged relative to the processor, and these remote memories may be connected to the local module via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0168] The processor may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chip in some embodiments. The processor is generally used to control the overall operation of the computer device. In this embodiment, the processor is used to run the program code stored in the memory or process data. The processors of the multiple computer devices of the computer device of this embodiment execute various functional applications and data processing of the server by running non-volatile software programs, instructions and modules stored in the memory, that is, implementing the steps of the target detection method applied to smart construction site security in the above method embodiment.

[0169] It should be understood that, unless they conflict with each other, all the embodiments, features and advantages described above for the target detection method for smart construction site security according to the present invention are also applicable to the target detection system for smart construction site security according to the present invention.

[0170] It will also be appreciated by those skilled in the art that various exemplary logic blocks, modules, circuits and algorithm steps described in conjunction with the disclosure herein can be implemented as electronic hardware, computer software or a combination of the two. In order to clearly illustrate this interchangeability of hardware and software, a general description has been given to the functions of various schematic components, blocks, modules, circuits and steps. Whether this function is implemented as software or hardware depends on specific applications and the design constraints imposed on the entire system. Those skilled in the art can implement the function in various ways for each specific application, but this implementation decision should not be interpreted as causing a departure from the disclosed scope of the embodiments of the present invention.

[0171] Finally, it should be noted that the computer-readable storage medium (e.g., memory) herein may be a volatile memory or a nonvolatile memory, or may include both a volatile memory and a nonvolatile memory. As an example and not by way of limitation, a nonvolatile memory may include a read-only memory (ROM), a programmable ROM (PROM), an electrically programmable ROM (EPROM), an electrically erasable programmable ROM (EEPROM), or a flash memory. A volatile memory may include a random access memory (RAM), which may act as an external cache memory. As an example and not by way of limitation, RAM may be obtained in a variety of forms, such as synchronous RAM (DRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), and direct Rambus RAM (DRRAM). The storage devices of the disclosed aspects are intended to include, but are not limited to, these and other suitable types of memory.

[0172] The various exemplary logic blocks, modules, and circuits described in conjunction with the disclosure herein may be implemented or executed using the following components designed to perform such functions: a general purpose processor, a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic device, discrete gate or transistor logic, discrete hardware components, or any combination of these components. A general purpose processor may be a microprocessor, but alternatively, the processor may be any conventional processor, controller, microcontroller, or state machine. The processor may also be implemented as a combination of computing devices, for example, a combination of a DSP and a microprocessor, a plurality of microprocessors, one or more microprocessors in conjunction with a DSP, and / or any other such configuration.

[0173] The above are exemplary embodiments disclosed in the present invention, but it should be noted that various changes and modifications may be made without departing from the scope disclosed in the embodiments of the present invention as defined in the claims. The functions, steps and / or actions of the method claims according to the disclosed embodiments described herein do not need to be performed in any particular order. In addition, although the elements disclosed in the embodiments of the present invention may be described or required in individual form, they may also be understood as multiple unless explicitly limited to the singular.

[0174] It should be understood that, as used herein, the singular form "a" or "an" is intended to include the plural form as well, unless the context clearly supports an exception. It should also be understood that, as used herein, "and / or" refers to any and all possible combinations of one or more of the items listed in association. The serial numbers of the embodiments disclosed in the above embodiments of the present invention are for description only and do not represent the advantages and disadvantages of the embodiments.

[0175] A person skilled in the art should understand that the discussion of any of the above embodiments is only exemplary and is not intended to imply that the scope of the disclosure of the embodiments of the present invention (including the claims) is limited to these examples; under the concept of the embodiments of the present invention, the technical features in the above embodiments or different embodiments can also be combined, and there are many other changes in different aspects of the embodiments of the present invention as above, which are not provided in detail for the sake of simplicity. Therefore, any omissions, modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the embodiments of the present invention should be included in the protection scope of the embodiments of the present invention.

Claims

1. A target detection method applied to smart construction site security, characterized by: The target detection method comprises the following steps: Step S101: construct a basic network for target detection based on YOLOV8, integrate the multi-layer spatial displacement-aware visual backbone network S2-MLPv2 attention mechanism into the feature fusion module of the YOLOV8 basic network, and use a fully convolutional spatial pyramid convolution module to replace the spatial pyramid pooling module connecting the backbone and the neck in the YOLOV8 model to obtain the original model of YOLOV8 target detection; in the S2-MLPv2 attention mechanism, the feature map of channel C is expanded to a 3C channel feature map; the expanded feature map is divided into three parts along the channel dimension, and different spatial displacement operations are applied to each part; through the split attention operation, the shifted parts are merged to generate a C channel feature map; Step S102: training the YOLOV8 target detection original model using historical images collected at the construction site to obtain a trained target detection model; Step S103: input the real-time image to be detected collected at the construction site into the trained target detection model, detect the target violation behavior at the construction site in real time, classify and locate the detected behavior, trigger the early warning system, and output the violation image; Given a feature map X∈R w×h×c , expand the X channel from c to 3c through a multilayer perceptron: in, refers to the expanded feature map; MLP refers to the multi-layer perceptron; w refers to the width of the feature map; h refers to the height of the feature map; c refers to the channel of the feature map; The expanded feature map The channel dimension is divided into three equal parts: Part I: Part II: Part III: The positions of X1 and X2 are changed by two spatial displacement layers SS1(·) and SS2(·); SS1(·) performs the following spatial displacement operation: X[1:h-1,:,1:c / 4]→X[2:h,:,1:c / 4] X[2:h,:,c / 4+1:c / 2]→X[1:h-1,:,c / 4+1:c / 2] X[:,1:w-1,c / 2:3c / 4]→X[:,2:w,c / 2:3c / 4] X[:,2:w,3c / 4:c]→X[;,1:w-1,3c / 4:c] (2); SS2(·) performs an asymmetric spatial shift operation on SS1(·); The specific steps of SS2(·) performing an asymmetric spatial displacement operation on SS1(·) include: Given a feature map X2, SS2(X2) performs: X2[:,2:w,1:c / 4]←X2[:,1:w-1,1:c / 4] X2[:,1:w-1,c / 4+1:c / 2]←X2[:,2:w,c / 4+1:c / 2] X2[2:h,:,c / 2:3c / 4]←X2[1:h-1,:,c / 2:3c / 4] X2[1:h-1,:,3c / 4:c]-X2[2:h,:,3c / 4:c] (3); SS1(·) and SS2(·) complement each other; The steps of training the YOLOV8 target detection original model using historical images collected at the construction site include: Performing enhancement processing on the collected historical images of the construction site to obtain an enhanced target image; Use the LabelMe image annotation tool to create accurate bounding boxes and category labels for the objects to be detected in each target image; Convert the JSON file generated by LabelMe annotation into a TXT file in YOLO format; The YOLOV8 object detection original model is trained using the enhanced image set formed by the bounding box and category label of the object to be detected; The steps to convert the JSON file generated by LabelMe annotation into a TXT file in YOLO format include: Iterate over each object in the LabelMe JSON file and extract the coordinates of the category and bounding box; Convert the coordinates to relative values ​​with respect to the image width and height; Write the converted information into a TXT file in YOLO format; The steps of enhancing the collected historical images of the construction site include: The historical images are enhanced by means of size correction, photometric distortion and geometric distortion; When processing the size, the image is preprocessed by resizing and normalizing; Adjust image brightness, contrast, hue, saturation, and noise when dealing with photometric distortion; Added random scaling, cropping, flipping and selection when dealing with geometric distortions; The steps for training the YOLOV8 target detection original model using the enhanced image set include: Use random seeds to divide the enhanced image set into training set, validation set and test set; The original model is trained using the training set, and the optimized loss function is used in an iterative manner to obtain a trained target detection model; During the training process, the validation set is used to evaluate the performance of the detection model and adjust the model's hyperparameters; Compare the performance of different training strategies on the validation set to select the final object detection model; In model training, the target detection network is optimized using a combination of cross entropy loss and dice loss. The combined loss of cross entropy loss and dice loss is expressed as: in, represents the initial loss combination; L Ce represents the classification cross entropy loss; L Dice represents the soft dice loss; I represents an image without a classification label; I′ represents an image with a classification table; In addition, the inter-class distance optimization loss L class Distinguish boundary pixels; with a total loss L cons In the case of , the total objective loss function of the training network is expressed as: Among them, γ cons and γ class is the weighting coefficient, and its values ​​are 0.5 and 0.7 respectively.

2. A target detection system according to the target detection method for smart construction site security as claimed in claim 1, characterized in that: The target detection system includes: The model building module is used to build a basic network for object detection based on YOLOV8. The S2-MLPv2 attention mechanism of the multi-layer spatial displacement-aware visual backbone network is integrated into the feature fusion module of the YOLOV8 basic network. The fully convolutional spatial pyramid convolution module is used to replace the spatial pyramid pooling module connecting the backbone and neck in the YOLOV8 model to obtain the original model of YOLOV8 object detection. A model training module is used to train the YOLOV8 target detection original model using historical images collected on the construction site to obtain a trained target detection model; The target behavior detection module inputs the real-time images to be detected collected at the construction site into the trained target detection model, detects the target violations at the construction site in real time, and classifies and locates the detected behaviors; The early warning output module is used to trigger the early warning system and output a violation image when the target behavior detection module detects target violation behavior at the construction site.

Citation Information

Patent Citations

  • Infrared image target identification method and system for power transmission and transformation equipment

    CN116681885A

Cited By

  • A pipe gallery operation construction behavior detection method based on target detection

    CN122715232A