Rolov8 umbrella opening identification method and system based on spatial position constraint optimization
By optimizing the network structure of the YOLO v8 algorithm and introducing key point branches and spatial position constraint losses, the calculation complexity and feature overlapping problems of illegal umbrella behavior detection in the existing technology are solved, and higher recognition accuracy and detection efficiency are achieved.
Patent Information
- Application Number
- CN202411653310.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-19
- Publication Date
- 2025-03-28
AI Technical Summary
When the prior art detects personnel's illegal umbrella holding behavior, the calculation complexity is high and it is difficult to effectively solve the problem of overlapping characteristics between the 'man', 'umbrella' and 'man's umbrella', resulting in the model's misidentification in some cases.
By optimizing the network structure of the YOLO v8 object detection algorithm, introducing key point branches and spatial position constraint losses, and assisting model training, the accuracy and detection efficiency of the model's identification of illegal umbrellas is significantly improved.
The accuracy and detection efficiency of the model's identification of illegal umbrellas is improved, the generalization and robustness of the model is enhanced, feature overlapping problems are reduced, and real-time performance is improved.
Smart Images

Figure CN119723280A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of image recognition, and in particular relates to a YOLOv8 umbrella recognition method and system based on spatial position constraint optimization. Background Art
[0002] In many production and work environments, especially in factories, warehouses, construction sites and other places, employees often carry rain gear, especially umbrellas, when entering the work area under bad weather conditions (such as rainy or snowy days). However, improper use of rain gear, especially illegal umbrella-holding behavior, not only affects work efficiency, but also may bring serious production safety hazards. Especially in some special working environments, such as substations, illegal umbrella-holding behavior may even cause fatal electric shock accidents. These include (1) the inability to find the location of equipment or tools in time due to obstructed vision, resulting in operational errors and causing mechanical failures or safety accidents; (2) Umbrellas take up a large space, which easily causes channel congestion, delaying emergency response in emergency situations and delaying rescue time, increasing accident losses; (3) The rainwater carried by umbrellas may carry pollutants such as mud and oil, which drip into the work area, and the equipment and tools may be corroded, shortening their service life and increasing maintenance costs. (4) In places with dense high-voltage electrical equipment such as substations, holding umbrellas in rainy days may cause the metal umbrella pole to contact live equipment, causing electric shock accidents. The increased conductivity of wet umbrellas further increases the risk of electric shock. At the same time, raindrops falling on electrical equipment may cause equipment short circuits, leading to serious accidents such as fires or explosions, endangering the lives of employees and the integrity of equipment.
[0003] At present, the detection technology of illegal umbrella-holding behavior is mainly implemented by YOLO series algorithms. Such technologies can usually be summarized into two strategies: one is to treat each potential target (such as a person or an umbrella) as a detection object, perform data annotation and training, and finally determine whether it is illegal umbrella-holding through complex logical rules; the other method classifies the target into three categories: "umbrella", "person" and "person holding an umbrella", and directly performs multi-category detection. However, both strategies have significant limitations. Among them, the first method has a sharp increase in computational complexity when facing a crowded environment because it needs to perform a large number of logical judgments, which seriously affects the real-time performance of the system. The second method fails to effectively solve the problem of feature overlap between "person", "umbrella" and "person holding an umbrella", resulting in the model mistakenly identifying independent people or umbrellas as a single entity in some cases, or conversely mistakenly segmenting the same entity into multiple independent targets. Summary of the invention
[0004] To solve the above problems, the purpose of the present invention is to provide a YOLOv8 umbrella recognition method and system based on spatial position constraint optimization, which significantly improves the accuracy and detection efficiency of the model in identifying people holding umbrellas in violation of regulations by optimizing the network structure of the YOLOv8 target detection algorithm and introducing key point branches and spatial position constraint losses to assist model training during the training process.
[0005] The technical solution provided by the present invention is: a YOLOv8 umbrella recognition method based on spatial position constraint optimization, comprising the following steps:
[0006] Acquire video data in real time and perform preprocessing;
[0007] Input the preprocessed video data into a trained YOLO v8 detection model, wherein the Backbone network in the CSPDarknet of the trained YOLO v8 detection model is replaced by the Swin-Transformer backbone, and the Conv convolution in the PAFPN network is replaced by the deformable convolution;
[0008] The YOLO v8 detection model outputs detection results based on video data acquired in real time.
[0009] Preferably, the YOLO v8 detection model designs a spatial position constraint loss for the key point detection branch in the loss function to optimize the feature overlap problem between the category of people holding umbrellas illegally and the person and the umbrella. The total loss function includes calculating the category confidence loss, the box coordinate loss, the key point distance loss and the key point spatial position constraint loss.
[0010] Preferably, the loss function formula of the YOLO v8 detection model is:
[0011] L all_loss =E cls_loss +E box_reg_loss +E points_reg_loss +E points_spc_loss
[0012] Among them, E points_spc_loss It is the spatial position constraint loss of the newly added key points.
[0013] Preferably, the key point spatial position constraint loss E points_spc_loss It consists of three parts:
[0014] The loss calculation of the point in the corresponding detection box is:
[0015]
[0016] f(x, y) = f(x) + f(y)
[0017] Where (x, y) represents the predicted key point coordinates, (xg_min, yg_min) and (xg_max, yg_max) are the upper left corner and lower right corner coordinates of the corresponding real rectangular box respectively;
[0018] The loss for the part where the value of the center point of the umbrella is greater than the value of the center point of the human body is calculated as follows:
[0019]
[0020] where y umbrella and head They represent the vertical coordinates of the predicted values of the umbrella key points and the human key points respectively, and λ0 represents the penalty coefficient. This part of the loss is only involved in the loss calculation when the sample is a person holding an umbrella;
[0021] The proportion loss of two points in the vertical and horizontal directions is calculated as follows:
[0022]
[0023] Where (x umbrella ,y umbrella ) and (x head ,y head ) represent the predicted values of umbrella key points and human key points, W and H are the width and height of the corresponding real frame, λ1 and λ2 are the corresponding proportional boundary coefficients;
[0024] The calculation formula of spatial position constraint loss is:
[0025] E points_spc_loss =f(x,y)+h(y umbrella ,y head )+g(y umbrella ,y head )+g(x umbrella ,x head ).
[0026] Preferably, before acquiring the video data in real time, the following is performed:
[0027] Construct a dataset of people, umbrellas, people holding umbrellas, and key points with annotations and labels; collect and organize video data from multiple surveillance perspectives, manually capture pictures of various scales and postures in different scenes, use the open source annotation tool labelme to annotate the pictures, and construct a dataset that meets the needs of neural networks;
[0028] Based on the open source dataset, the YOLO v8 detection model is pre-trained using the coco dataset, the generated pre-trained model weights are retained, and then the pre-trained modified model is loaded on the new illegal umbrella-holding dataset for secondary training, and the neural network training parameters are fine-tuned until the model converges.
[0029] Preferably, two key points are marked with point, and information on whether they are blocked is attached. If they do not exist, it is 0; if they exist and are blocked, it is -1; if they exist and are not blocked, it is 1. After marking, a txt file is generated for each picture, and each line represents the category of the object, the rectangular box, and the key point information.
[0030] Preferably, before acquiring the video data in real time, the following steps are also performed:
[0031] For the trained YOLO v8 detection model, after removing the key point branch, the detection effect of the model is verified on the test set, and difficult samples are collected based on the detection results. The training parameters of the model are further fine-tuned to continue training to achieve the optimal performance of the model.
[0032] Based on the same concept, the present invention also provides a yolov8 umbrella recognition system based on spatial position constraint optimization, including:
[0033] Data acquisition module, used to acquire video data in real time and perform preprocessing;
[0034] A detection module, used for inputting the preprocessed video data into a trained YOLO v8 detection model, wherein the Backbone network in the CSPDarknet of the trained YOLO v8 detection model is replaced by a Swin-Transformer backbone, and the Conv convolution in the PAFPN network is replaced by a deformable convolution;
[0035] The result output module is used to output the detection result based on the video data acquired in real time through the YOLO v8 detection model.
[0036] Based on the same concept, the present invention also provides an electronic device, comprising:
[0037] A memory, the memory being used to store a processing program;
[0038] A processor, wherein when executing the processing program, the processor implements any one of the above-mentioned yolov8 umbrella recognition methods based on spatial position constraint optimization.
[0039] Based on the same concept, the present invention also provides a readable storage medium, on which a processing program is stored. When the processing program is executed by a processor, any one of the above-mentioned yolov8 umbrella recognition methods based on spatial position constraint optimization is implemented.
[0040] Due to the adoption of the above technical solution, the present invention has the following advantages and positive effects compared with the prior art:
[0041] YOLO v8 has been improved specifically for the umbrella recognition task. By introducing key point branches and adding spatial position constraints of key points in the loss function, the anti-interference ability of the loss function in the training process is improved, and the detection model training is assisted to improve the detection effect of the model. In addition, in order to enhance the feature extraction ability of the original YOLO v8 in the task of holding an umbrella, the backbone network is replaced with swin-transformer to better capture the long-distance dependency and spatial relationship between objects such as people and umbrellas. At the same time, in the feature enhancement network, all standard convolution modules are replaced with deformable convolution modules to more flexibly focus on the details of non-rigid objects such as human bodies and umbrellas. During training, the key point branch can effectively eliminate the problem of overlapping features between classes when the model extracts features of three types of objects: people, umbrellas, and people holding umbrellas. When deploying reasoning, the key point branch can be eliminated, and only the detection branch is retained, so no additional reasoning cost is introduced. After the above improvements, the generalization and robustness of the detection model can be improved to a certain extent. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] The specific embodiments of the present invention are further described in detail below with reference to the accompanying drawings, wherein:
[0043] Figure 1 The training, deployment and operation flow chart of the yolov8 detection model of the present invention;
[0044] Figure 2 This is a schematic diagram of the Swin-Transformer backbone of the present invention;
[0045] Figure 3 Schematic diagram of deformable convolution of the present invention;
[0046] Figure 4 This is a schematic diagram of the network structure optimization of the yolov8 detection model of the present invention;
[0047] Figure 5 This is a schematic diagram of sample data annotation in the present invention. DETAILED DESCRIPTION
[0048] The present invention is further described in detail below in conjunction with the accompanying drawings and specific embodiments. The advantages and features of the present invention will become more apparent from the following description and claims. It should be noted that the drawings are all in a very simplified form and use non-precise ratios, which are only used to conveniently and clearly assist in explaining the purpose of the embodiments of the present invention.
[0049] It should be noted that all directional indications in the embodiments of the present invention (such as up, down, left, right, front, back, etc.) are only used to explain the relative position relationship, movement status, etc. between the components under a certain specific posture (as shown in the accompanying drawings). If the specific posture changes, the directional indication will also change accordingly.
[0050] First embodiment
[0051] This embodiment provides a yolov8 umbrella recognition method based on spatial position constraint optimization, including the following steps:
[0052] Acquire video data in real time and perform preprocessing;
[0053] Input the preprocessed video data into a trained YOLO v8 detection model, wherein the Backbone network in the CSPDarknet of the trained YOLO v8 detection model is replaced by the Swin-Transformer backbone, and the Conv convolution in the PAFPN network is replaced by the deformable convolution;
[0054] The YOLO v8 detection model outputs detection results based on video data acquired in real time.
[0055] The technical solution of this embodiment makes targeted improvements to YOLO v8 for the umbrella recognition task, using Swin Transformer to replace the traditional CSPDarknet backbone network. This change can better capture long-distance dependencies and spatial connections between objects, and is particularly suitable for target detection tasks in complex backgrounds. Specifically, the original YOLOv8 backbone network CSPDarknet is replaced by the Swin-Transformer backbone. The schematic diagram of the Swin-Transformer backbone is shown in the figure. Figure 2As shown. First, Patch Merging is used to group each nxn adjacent patch and connect them in depth. This effectively downsamples the input by 2 times, converting the input from the shape of H x W x C to (H / n)x(W / n)x(n^2*C), where H, W, and C refer to the height, width, and channel depth, respectively. The number of channels is then adjusted through a linear layer and then fed into SwinTransformerBlock for feature extraction. A 32-fold downsampling is achieved by looping through four stages. Given that "people", "umbrellas", and "people holding umbrellas" are all non-rigid objects, the PAFPN feature pyramid network is improved, and some convolutional layers are replaced by deformable convolutions, which helps the model to more keenly perceive subtle changes in objects and improve the detection effect of non-rigid targets. In order to enhance the feature extraction capability of the original YOLO v8 in the task of people holding umbrellas, the backbone network is replaced with swin-transformer to better capture the long-distance dependency and spatial relationship between objects such as people and umbrellas. At the same time, in the feature enhancement network, all standard convolution modules are replaced with deformable convolution modules to more flexibly focus on the details of non-rigid objects such as human bodies and umbrellas. Figure 2 This is a schematic diagram of the Swin-Transformer backbone of the present invention, see Figure 3 shows a schematic diagram of deformable convolution, see Figure 4 A schematic diagram of the network structure optimization of the yolov8 detection model is shown.
[0056] Preferably, the YOLO v8 detection model designs a spatial position constraint loss for the key point detection branch in the loss function to optimize the feature overlap problem between the category of people holding umbrellas illegally and the person and the umbrella. The total loss function includes calculating the category confidence loss, the box coordinate loss, the key point distance loss and the key point spatial position constraint loss.
[0057] The technical solution of this embodiment introduces key point branches and spatial position constraints, and innovatively introduces a key point branch specifically used to predict the center position of the human head and the top of the umbrella. By introducing the key point branch and adding the key point spatial position constraint term to the loss function, the anti-interference ability of the loss function in the training process is improved, and the detection model training is assisted to improve the detection effect of the model.
[0058] Preferably, the loss function formula of the YOLO v8 detection model is:
[0059] L all_loss =E cls_loss +E box_reg_loss +E points_reg_loss +E points_spc_loss
[0060] Among them, E points_spc_lossIt is the spatial position constraint loss of the newly added key points.
[0061] The technical solution of this embodiment is based on the previous embodiment, and a spatial position constraint loss function is designed. This loss function can effectively reduce the feature confusion between "people holding umbrellas" and the other two types of targets, thereby improving the recognition ability of the model in complex scenarios.
[0062] Preferably, the key point spatial position constraint loss Epoints_spc_loss includes three parts:
[0063] The loss calculation of the point in the corresponding detection box is:
[0064]
[0065] f(x, y) = f(x) + f(y)
[0066] Where (x, y) represents the predicted key point coordinates, (xg_min, yg_min) and (xg_max, yg_max) are the upper left corner and lower right corner coordinates of the corresponding real rectangular box respectively;
[0067] The loss for the part where the value of the center point of the umbrella is greater than the value of the center point of the human body is calculated as follows:
[0068]
[0069] where y umbrella and head The vertical coordinates represent the predicted values of the umbrella key points and the human key points respectively, and λ0 represents the penalty coefficient, whose value is 0.1. This part of the loss is only involved in the loss calculation when the sample is a person holding an umbrella;
[0070] The proportion loss of two points in the vertical and horizontal directions is calculated as follows:
[0071]
[0072] Where (x umbrella ,y umbrella ) and (x head ,y head ) represent the predicted values of umbrella key points and human key points, W and H represent the width and height of the corresponding real box, λ1 and λ2 represent the corresponding proportional boundary coefficients, and their values are 0.6 and 0.4 respectively. This loss is only involved in the loss calculation when the sample is a person holding an umbrella.
[0073] The calculation formula of spatial position constraint loss is:
[0074] E points_spc_loss =f(x,y)+h(y umbrella ,yhead )+g(y umbrella ,y head )+g(x umbrella ,x head ).
[0075] Preferably, before acquiring the video data in real time, the following is performed:
[0076] Construct a dataset of people, umbrellas, people holding umbrellas, and key points with annotations and labels; collect and organize video data from multiple surveillance perspectives, manually capture pictures of various scales and postures in different scenes, use the open source annotation tool labelme to annotate the pictures, and construct a dataset that meets the needs of neural networks;
[0077] Based on the open source dataset, the YOLO v8 detection model is pre-trained using the coco dataset, the generated pre-trained model weights are retained, and then the pre-trained modified model is loaded on the new illegal umbrella-holding dataset for secondary training, and the neural network training parameters are fine-tuned until the model converges.
[0078] Due to the modification of the neural network structure of the feature extraction neural network CSPDarknet (see Figure 5 As shown in the figure, it is impossible to use the original YOLOv8 to fine-tune the new dataset based on the pre-trained model weights. Therefore, the new network architecture is pre-trained using the coco dataset, and the generated pre-trained model weights are retained, so that the backbone has a more generalized object feature extraction capability. Subsequently, based on the pre-trained model, the model is retrained on the self-built key point detection and annotation training set of people holding umbrellas, and the neural network training parameters are fine-tuned until the neural network converges, and the model weights generated during the secondary training process are retained.
[0079] Preferably, two key points are marked with point, and information on whether they are blocked is attached. If they do not exist, it is 0; if they exist and are blocked, it is -1; if they exist and are not blocked, it is 1. After marking, a txt file is generated for each picture, and each line represents the category of the object, the rectangular box, and the key point information.
[0080] Specifically, we collected more than 100 videos containing umbrella holding and human activities in actual monitoring scenarios, and manually captured 5,000 pictures containing people, umbrellas, and people holding umbrellas from the videos. We used the open source annotation tool labelme to manually annotate the pictures, and framed the human body in the picture with a rectangular frame that contained the overall outline and was as close to the edge of the outline as possible, and indicated the categories as Human, Umbrella, and HumanWithUmbrella. We then labeled the two key points with point and attached information on whether they were blocked: 0 if not present, -1 if blocked, and 1 if not blocked. After labeling, a txt file will be generated for each picture, and each line represents the category of the object, the rectangular frame, and the key point information. The specific composition is as follows: Figure 5 shown.
[0081] Preferably, before acquiring the video data in real time, the following steps are also performed:
[0082] For the trained YOLO v8 detection model, after removing the key point branch, the detection effect of the model is verified on the test set, and difficult samples are collected based on the detection results. The training parameters of the model are further fine-tuned to continue training to achieve the optimal performance of the model.
[0083] Finally, the surveillance video containing the human umbrella-holding activity is input, and the optimal model weight is loaded to detect the video. The human umbrella-holding behavior is located on the image and output for display. Although an additional key point branch is added during the training phase, this branch is removed during the model deployment phase, leaving only the core detection function. This maintains the lightweight characteristics of the model while ensuring high-precision detection results.
[0084] See also Figure 1 , showing the entire process of training, deployment and operation of the yolov8 detection model of the present invention.
[0085] Based on the same concept, the present invention also provides a yolov8 umbrella recognition system based on spatial position constraint optimization, including:
[0086] Data acquisition module, used to acquire video data in real time and perform preprocessing;
[0087] A detection module, used for inputting the preprocessed video data into a trained YOLO v8 detection model, wherein the Backbone network in the CSPDarknet of the trained YOLO v8 detection model is replaced by a Swin-Transformer backbone, and the Conv convolution in the PAFPN network is replaced by a deformable convolution;
[0088] The result output module is used to output the detection result based on the video data acquired in real time through the YOLO v8 detection model.
[0089] Based on the same concept, the present invention also provides an electronic device, comprising: a memory, the memory being used to store a processing program; a processor, the processor implementing any one of the above-mentioned yolov8 umbrella recognition methods based on spatial position constraint optimization when executing the processing program.
[0090] Based on the same concept, the present invention also provides a readable storage medium, on which a processing program is stored. When the processing program is executed by a processor, any one of the above-mentioned yolov8 umbrella recognition methods based on spatial position constraint optimization is implemented.
[0091] If the yolov8 umbrella recognition method based on spatial position constraint optimization is implemented in the form of program instructions 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 this embodiment is essentially or part of the contribution to the prior art or all or part of the technical solution can be embodied in the form of software, and the computer software is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present disclosure. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk, and other media that can store program codes.
[0092] Those skilled in the art can clearly understand that, for the sake of convenience and brevity in description, the identification content specifically executed by the above-described system and device can refer to the corresponding process in the aforementioned method embodiment.
[0093] The embodiments of the present invention are described in detail above in conjunction with the accompanying drawings, but the present invention is not limited to the above embodiments. Even if various changes are made to the present invention, if these changes fall within the scope of the claims of the present invention and their equivalents, they still fall within the protection scope of the present invention.
Claims
1. A yolov8 umbrella recognition method based on spatial position constraint optimization, characterized in that: The following steps are involved: Acquire video data in real time and perform preprocessing; Input the preprocessed video data into a trained YOLO v8 detection model, wherein the Backbone network in the CSPDarknet of the trained YOLOv8 detection model is replaced by the Swin-Transformer backbone, and the Conv convolution in the PAFPN network is replaced by the deformable convolution; The YOLO v8 detection model outputs detection results based on video data acquired in real time.
2. The yolov8 umbrella recognition method based on spatial position constraint optimization according to claim 1 is characterized in that: The YOLO v8 detection model designs a spatial position constraint loss for the key point detection branch in the loss function to optimize the feature overlap problem between the category of people holding umbrellas illegally and the person and the umbrella. The overall loss function includes calculating category confidence loss, box coordinate loss, key point distance loss and key point spatial position constraint loss.
3. The yolov8 umbrella recognition method based on spatial position constraint optimization according to claim 2 is characterized in that: The loss function formula of the YOLO v8 detection model is: Lall_loss=Ecls_loss+Ebox_reg_loss+Epoints_reg_loss+Epoints_spc_loss Among them, Epoints_spc_loss is the newly added key point spatial position constraint loss.
4. The yolov8 umbrella recognition method based on spatial position constraint optimization according to claim 3 is characterized in that: The key point spatial position constraint loss Epoints_spc_loss consists of three parts: The loss calculation of the point in the corresponding detection box is: f(x,y)=f(x)+f(y) Where (x, y) represents the predicted key point coordinates, (xg_min, yg_min) and (xg_max, yg_max) are the upper left corner and lower right corner coordinates of the corresponding real rectangular box respectively; The loss for the part where the value of the center point of the umbrella is greater than the value of the center point of the human body is calculated as follows: where y umbrella and head They represent the vertical coordinates of the predicted values of the umbrella key points and the human key points respectively, and λ0 represents the penalty coefficient. This part of the loss is only involved in the loss calculation when the sample is a person holding an umbrella; The proportion loss of two points in the vertical and horizontal directions is calculated as follows: Where (x umbrella ,y umbrella ) and (x head ,y head ) represent the predicted values of umbrella key points and human key points, W and H are the width and height of the corresponding real frame, λ1 and λ2 are the corresponding proportional boundary coefficients; The calculation formula of spatial position constraint loss is: E points_spc_loss =f(x,y)+h(y umbrella ,y head )+g(y umbrella ,y head )+g(x umbrella ,x head )。 5. The yolov8 umbrella recognition method based on spatial position constraint optimization according to claim 1 is characterized in that: Before acquiring video data in real time: Construct a dataset of people, umbrellas, people holding umbrellas, and key points with annotations and labels; collect and organize video data from multiple surveillance perspectives, manually capture pictures of various scales and postures in different scenes, use the open source annotation tool labelme to annotate the pictures, and construct a dataset that meets the needs of neural networks; Based on the open source dataset, the YOLO v8 detection model is pre-trained using the coco dataset, the generated pre-trained model weights are retained, and then the pre-trained modified model is loaded on the new illegal umbrella-holding dataset for secondary training, and the neural network training parameters are fine-tuned until the model converges.
6. The yolov8 umbrella recognition method based on spatial position constraint optimization according to claim 5 is characterized in that: The two key points are marked with point, and the information of whether they are blocked is attached. If they do not exist, it is 0, if they exist but are blocked, it is -1, and if they exist but are not blocked, it is 1. After marking, a txt file is generated for each picture, and each line represents the category of the object, the rectangular box, and the key point information.
7. The yolov8 umbrella recognition method based on spatial position constraint optimization according to claim 6 is characterized in that: Before obtaining video data in real time, the following steps are also performed: For the trained YOLO v8 detection model, after removing the key point branch, the detection effect of the model is verified on the test set, and difficult samples are collected based on the detection results. The training parameters of the model are further fine-tuned to continue training to achieve the optimal performance of the model.
8. A yolov8 umbrella recognition system based on spatial position constraint optimization, characterized in that: include: Data acquisition module, used to acquire video data in real time and perform preprocessing; A detection module, used for inputting the preprocessed video data into a trained YOLO v8 detection model, wherein the Backbone network in the CSPDarknet of the trained YOLO v8 detection model is replaced by a Swin-Transformer backbone, and the Conv convolution in the PAFPN network is replaced by a deformable convolution; The result output module is used to output the detection result based on the video data acquired in real time through the YOLO v8 detection model.
9. An electronic device, characterized in that: include: A memory, the memory being used to store a processing program; A processor, wherein when executing the processing program, the processor implements the YOLOv8 umbrella recognition method based on spatial position constraint optimization as described in any one of claims 1 to 7.
10. A readable storage medium, characterized in that: The readable storage medium stores a processing program, and when the processing program is executed by the processor, the yolov8 umbrella recognition method based on spatial position constraint optimization as described in any one of claims 1 to 7 is implemented.