A YOLOv8-based crown block hook identification method and system

By improving the data acquisition, annotation, and structure optimization of the YOLOv8 model, and combining self-supervised pre-training and model quantization pruning, the problems of insufficient accuracy and real-time performance in crane hook recognition were solved, achieving high-precision, robust, and real-time crane hook recognition.

CN120807959BActive Publication Date: 2026-01-27SHANDONG BOANG INFORMATION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510945083.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-07-09
Publication Date
2026-01-27
Estimated Expiration
2045-07-09

AI Technical Summary

Technical Problem

Existing technologies have low accuracy in identifying crane hooks in complex environments, weak generalization ability, and insufficient real-time performance, making it difficult to meet the safety and automation requirements of industrial cranes.

Method used

An improved YOLOv8 model is adopted, which improves the recognition accuracy and real-time performance in industrial scenarios by data collection and annotation, lightweight attention mechanism, local detail enhancement branch, dynamic anchor box adaptive mechanism and improved loss function, combined with self-supervised pre-training and model quantization pruning.

Benefits of technology

It improves the accuracy of crane hook recognition, shortens frame processing time, enhances the robustness of the model in complex environments, and is suitable for real-time deployment of edge devices.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120807959B_ABST
    Figure CN120807959B_ABST
Patent Text Reader

Abstract

The application discloses a kind of YOLOv8-based headstock hook identification method and system, comprising the following steps: S1: data acquisition and annotation;S2: model structure innovation;S3: self-supervised pre-training mechanism;S4: model training and deployment optimization;Including data acquisition and annotation module, model construction and optimization module, self-supervised pre-training module and model training and deployment module.The application enhances the ability of detail extraction through LAF and LDEB module, improves the accuracy of hook identification;After model light weight optimization, frame processing time is shortened by more than 30%, suitable for edge deployment;It can stably identify the target in complex environment such as strong light, shadow, shielding, etc.;Model structure has strong adaptability, and can be quickly migrated to other hoisting target identification tasks.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of industrial lifting technology, and in particular to a method and system for identifying overhead crane hooks based on YOLOv8. Background Technology

[0002] In the industrial lifting field, the overhead crane hook (also known as a crane hook or lifting hook) is a key component of cranes (such as overhead cranes, bridge cranes, gantry cranes, etc.) used to receive, lift, and hoist loads. It is typically installed on the crane's boom or hook system and connects to the crane's ropes, wire ropes, chains, etc., to complete the lifting, moving, and placement of items. The positioning and status identification of the overhead crane hook are crucial for ensuring operational safety and improving automation levels.

[0003] Currently, conventional image processing methods have limited accuracy in complex environments. While deep learning methods have made progress, they generally suffer from low detection accuracy, weak generalization ability, and insufficient real-time performance. Therefore, there is an urgent need for a crane hook recognition method and system based on an improved YOLOv8 model to solve the above problems and improve detection accuracy, robustness, and inference speed. Summary of the Invention

[0004] The purpose of this invention is to overcome the shortcomings of the existing technology and to propose a crane hook identification method and system based on YOLOv8.

[0005] To achieve the above objectives, the present invention adopts the following technical solution:

[0006] A method for identifying overhead crane hooks based on YOLOv8 includes the following steps:

[0007] S1: Data Acquisition and Labeling: Video frames of the overhead crane hook under different postures, lighting and backgrounds are collected using cameras and then manually labeled to build a high-quality dataset.

[0008] S2: Model Structure Innovation: Based on the original YOLOv8 structure, the following improvements are proposed: Lightweight Attention Fusion (LAF) module, Local Detail Enhancement Branch (LDEB), Dynamic Anchor Adaptation (DAA) mechanism, and improved loss function;

[0009] S3: Self-supervised pre-training mechanism (Industrial Pretext Task Pretraining): Construct self-supervised tasks, such as "hook direction prediction" and "hook occlusion prediction"; perform pre-training on large-scale unlabeled industrial video data, and transfer the pre-trained weights to the YOLOv8 backbone network to improve the initial convergence performance and feature representation ability, and improve the model's transferability and generalization performance in industrial scenarios.

[0010] S4: Model Training and Deployment Optimization: Improve training efficiency with mixed precision training, and perform model quantization and pruning to adapt to real-time deployment on edge devices.

[0011] As a further technical solution of the present invention, S1 specifically includes:

[0012] S11: During the data acquisition phase, the camera operates at a frame rate of... Capture video frames of the overhead crane hook to ensure that the dynamic changes of the overhead crane hook can be fully captured in the time dimension;

[0013] S12: For data annotation, a refined manual annotation method is adopted, as follows: Define annotation precision parameters. A consistency algorithm is introduced to calculate the consistency index c of annotation results for the same video frame by different annotators; when constructing a high-quality dataset, data augmentation algorithms are used, including random rotation angles. The algorithms, including random scaling factor s and random translation distance d, are used to process the original video frames, expand the dataset size, and enhance the model's ability to recognize crane hooks in different postures.

[0014] As a further technical solution of the present invention, S2 specifically includes:

[0015] S21: Lightweight Attention Fusion (LAF) module: A lightweight attention module is introduced between the Backbone and Neck to effectively enhance the model's ability to perceive small targets (such as hook edges, bends, locks, and other minute details) and suppress background interference.

[0016] S22: Local Detail Enhancement Branch (LDEB): A new auxiliary branch that focuses on extracting features of hook edges and connecting parts, which are then fused with the main features to improve target recognition capabilities;

[0017] S23: Dynamic Anchor Adaptation (DAA): Optimizes anchor frame parameters through online learning to improve adaptability to hooks of different sizes;

[0018] S24: Improved loss function: Introduce position-sensitive IoU loss (Pos-IoU Loss) to more accurately assess the hook center of gravity prediction error.

[0019] As a further technical solution of the present invention, S21 specifically includes:

[0020] S211: Define the number of channels of the input feature map as C, the width as W, and the height as H, that is, the size of the input feature map is... ;

[0021] S212: Introduce convolution operations to calculate channel attention weights; the convolution kernel size is... Step size is Fill with The number of channels remains unchanged;

[0022] S213: Calculate the attention weight feature map of the output. ;

[0023] S214: Multiply and fuse the attention weight feature map with the input feature map element by element to obtain the enhanced feature map.

[0024] As a further technical solution of the present invention, S22 specifically includes: adding parallel local enhancement branches to the original YOLOv8 Neck layer, introducing Dilated Convolution into the branch structure to expand the receptive field without losing resolution; combining the Swing Transformer module to introduce a local window attention mechanism to improve the expressiveness of local structures; and finally fusing it into the main feature map through Concat to solve the problem of missed detection under hook occlusion, partial blurring or rotation posture.

[0025] As a further technical solution of the present invention, S23 specifically includes:

[0026] S231: Define the number of anchor frames as n _ anchors, the initial anchor frame parameter is the width and height ;

[0027] S232: Optimize anchor frame parameters through online learning; the calculation formula is as follows: Where: t is the number of iterations, For learning rate, and These are the estimated actual width and height of the hooks for the current batch, respectively.

[0028] As a further technical solution of the present invention, S24 specifically includes:

[0029] S241: Define the position parameter of the prediction box as the center coordinates. and width ,high The position parameters of the real bounding box are and ;

[0030] S242: The formula for calculating the location-sensitive IoU loss is: , where IoU is the intersection-union ratio of the predicted bounding box and the ground truth bounding box.

[0031] As a further technical solution of the present invention, S3 specifically includes:

[0032] S31: Construct self-supervised tasks, taking "hook direction prediction" and "hook occlusion prediction" as examples;

[0033] S32: Pre-training on large-scale unlabeled industrial video data:

[0034] S321: Define the pre-training learning rate as lr _ pre, training epochs _ pre, the batch size for each training round is batch _ size _ pre;

[0035] S322: During training, the loss function of the self-supervised task described above is optimized. and Update the model parameters;

[0036] S33: After pre-training, the pre-trained weights are transferred to the YOLOv8 backbone network, and the transfer learning rate is defined as Ir. _ transfer, fine-tuning the number of training epochs. _ fine _ tune, the batch size for each training round is batch. _ size _ fine _ tune.

[0037] As a further technical solution of the present invention, S4 specifically includes:

[0038] S41: Mixed Precision Training: Defines the total number of iterations during model training as... The initial learning rate is The number of training samples in each batch is Mixed-precision training was employed, with the loss scaling factor set to [value missing]. This is used to prevent gradient underflow; when updating the gradient, the scaled gradient is calculated first. Then, the gradient is reduced back to the normal range, and the model parameters are updated.

[0039] S42: Model Quantization: Quantizes the model, converting 32-bit floating-point (FP32) weights to 8-bit integers (INT8); defines quantization parameters. and The quantized weights are ;

[0040] S43: Model Pruning: A weight-based pruning method is used, with the pruning rate defined as prune. _ rate (value range 0-1), i.e., prune _ The rate ratio has small weights; the absolute value threshold for calculating the weights. Set the weights with absolute values ​​less than thr to 0; calculate the sparsity of the pruned model. ;

[0041] S44: Model Deployment Optimization: Define the computing power parameter of the edge device as compute. _ capability, measured in GFLOPS; Based on the device's computing power, the quantized and pruned model is adapted and optimized to ensure that the inference time on edge devices meets real-time requirements, i.e., inference time... ,in This sets a real-time threshold; simultaneously, it ensures that the model's detection accuracy degradation on edge devices does not exceed a set tolerance. .

[0042] A crane hook recognition system based on YOLOv8 includes a data acquisition and annotation module, a model building and optimization module, a self-supervised pre-training module, and a model training and deployment module;

[0043] The data acquisition and annotation module uses a high-definition camera to acquire video frames of the overhead crane hook from multiple angles, annotates key parts, and expands the dataset with the help of data augmentation technology to improve the model's adaptability to different scenarios.

[0044] The model building and optimization module is used to improve upon YOLOv8 by incorporating a lightweight attention mechanism, a local detail enhancement branch, a dynamic anchor box adaptive mechanism, and an improved loss function, thereby enhancing the model's ability to perceive small targets and extract features.

[0045] The self-supervised pre-training module is used to construct a self-supervised task, pre-train on large-scale unlabeled industrial video data, and transfer the pre-trained weights to the YOLOv8 backbone network to improve feature extraction and generalization capabilities.

[0046] The model training and deployment module employs hybrid precision training to improve efficiency, reduces computational and storage requirements through model quantization and pruning, and is ultimately deployed on edge devices to ensure real-time performance and accuracy.

[0047] The beneficial effects of this invention are as follows:

[0048] 1. Higher accuracy: Enhanced detail extraction capabilities through LAF and LDEB modules improve hook recognition accuracy.

[0049] 2. Strong real-time performance: After the model is optimized for lightweight design, the frame processing time is reduced by more than 30%, making it suitable for edge deployment.

[0050] 3. High robustness: It can stably identify targets in complex environments such as strong light, shadow, and occlusion.

[0051] 4. High scalability: The model structure is highly adaptable and can be quickly migrated to other lifting target recognition tasks. Attached Figure Description

[0052] Figure 1 The flowchart shows a crane hook identification method based on YOLOv8 proposed in this invention.

[0053] Figure 2 This is a block diagram of a crane hook identification system based on YOLOv8 proposed in this invention. Detailed Implementation

[0054] To make the technical means, creative features, objectives and effects of this invention easier to understand, the invention will be further described below in conjunction with specific embodiments.

[0055] Please see the appendix Figure 1 A method for identifying overhead crane hooks based on YOLOv8 includes the following steps:

[0056] S1: Data Acquisition and Labeling: Video frames of the overhead crane hook under different postures, lighting and backgrounds are collected using cameras and then manually labeled to build a high-quality dataset.

[0057] S11: During the data acquisition phase, the camera operates at a frame rate of... (Unit: frames / second) The value range is 15-30) to collect video frames of the overhead crane hook to ensure that the dynamic changes of the overhead crane hook can be fully captured in the time dimension;

[0058] S12: For data annotation, a refined manual annotation method is adopted, as follows:

[0059] Define annotation precision parameters : Correctly labeled pixel count / Actual total pixel count of the crane hook ,Require To ensure the quality of labeling;

[0060] An annotation consistency algorithm is introduced to calculate the consistency index c of annotation results from different annotators on the same video frame; c - (Number of pixels with differences / Total number of pixels on the crane hook), when If necessary, the annotations must be redone until the requirements are met;

[0061] When constructing high-quality datasets, data augmentation algorithms are employed, including random rotation angles. ( The values ​​of are -30° to 30°, the random scaling ratio s (s ranges from 0.8 to 1.2), and the random translation distance d (d ranges from -20 to 20 pixels). These algorithms are used to process the original video frames, expand the dataset size, and enhance the model's ability to recognize crane hooks in different postures.

[0062] S2: Model Structure Innovation: Based on the original YOLOv8 structure, the following improvements are proposed: Lightweight Attention Fusion (LAF) module, Local Detail Enhancement Branch (LDEB), Dynamic Anchor Adaptation (DAA) mechanism, and improved loss function;

[0063] S21: Lightweight Attention Fusion (LAF) module: A lightweight attention module is introduced between the Backbone and Neck to effectively enhance the model's ability to perceive small targets (such as hook edges, bends, locks, and other minute details) and suppress background interference.

[0064] S211: Define the number of channels of the input feature map as C, the width as W, and the height as H, that is, the size of the input feature map is... ;

[0065] S212: Introduce convolution operations to calculate channel attention weights; the convolution kernel size is... Step size is Fill with The number of channels remains unchanged;

[0066] S213: Calculate the attention weight feature map of the output. : ,in: For the input feature map, and These are the kernel weights and bias parameters, respectively. For activation functions;

[0067] S214: Multiply the attention weight feature map element-wise with the input feature map to obtain the enhanced feature map. The calculation formula is as follows: ,in This indicates an element-wise multiplication operation.

[0068] S22: Local Detail Enhancement Branch (LDEB): A new auxiliary branch that focuses on extracting features of hook edges and connecting parts, which are then fused with the main features to improve target recognition capabilities;

[0069] Parallel local enhancement branches are added to the original YOLOv8 Neck layer. The branch structure introduces Dilated Convolution to expand the receptive field without losing resolution. Combined with the Swing Transformer module, a local window attention mechanism is introduced to improve the expressiveness of local structures. Finally, the features are fused into the backbone feature map through Concat to solve the problem of missed detection under hook occlusion, partial blur or rotation pose.

[0070] S221: In the parallel local enhancement branch structure in the Neck layer, dilated convolution is introduced, with the dilation rate defined as d, and the formula for calculating dilated convolution is:

[0071] ,in: The weights are the dilated convolution kernel weights. The output feature map is obtained from dilated convolution;

[0072] S222: Combining the Swing Transformer module, the local window size is defined as...

[0073] Attention is calculated within a local window using the following formula:

[0074] Where Q and K are the query matrix and key matrix, respectively. For the dimension of attention head, It is a value matrix. This is the local window attention weight matrix;

[0075] S223: Finally, the local enhanced branch feature map is fused with the main feature map using the Concat method. The calculation formula is as follows: Concat ,in: The main feature map Output feature maps for local enhancement branches.

[0076] S23: Dynamic Anchor Adaptation (DAA): Optimizes anchor frame parameters through online learning to improve adaptability to hooks of different sizes;

[0077] S231: Define the number of anchor frames as n _ anchors, the initial anchor frame parameter is the width and height ;

[0078] S232: Optimize anchor frame parameters through online learning; the calculation formula is as follows: Where: t is the number of iterations, For learning rate, and These are the estimated actual width and height of the hooks for the current batch, respectively.

[0079] S24: Improved loss function: Introduce position-sensitive IoU loss (Pos-IoU Loss) to more accurately assess hook center of gravity prediction error;

[0080] S241: Define the position parameter of the prediction box as the center coordinates. and width ,high The position parameters of the real bounding box are and ;

[0081] S242: The formula for calculating the location-sensitive IoU loss is: , where IoU is the intersection-union ratio of the predicted bounding box and the ground truth bounding box.

[0082] S3: Self-supervised pre-training mechanism (Industrial Pretext Task Pretraining): Construct self-supervised tasks, such as "hook direction prediction" and "hook occlusion prediction"; perform pre-training on large-scale unlabeled industrial video data, and transfer the pre-trained weights to the YOLOv8 backbone network to improve the initial convergence performance and feature representation ability, and improve the model's transferability and generalization performance in industrial scenarios.

[0083] S31: Construct self-supervised tasks, taking "hook direction prediction" and "hook occlusion prediction" as examples;

[0084] When constructing the self-supervised task "Hook Direction Prediction":

[0085] S311a: Define the original video frame as l, perform a rotation operation on l, and the rotation angle is... Generate the rotated image l _ rot;

[0086] S312a: Constructing a rotating label y _ rot, when rotating angle At that time, y _ rot respectively correspond to ;

[0087] S313a: Design a small Convolutional Neural Network (CNN) model M _ The `rot` parameter is used to predict rotation angles. The model structure consists of two convolutional layers and one fully connected layer. The kernel size of each convolutional layer is defined as... and The step sizes are s1 and s2, the number of output channels are c1 and c2, and the number of neurons in the fully connected layer is n; Model M _ The input to rot is I _ rot, the output is the predicted rotation angle label y _ rot;

[0088] S314a: Define the loss function The cross-pick loss is calculated using the following formula: ,in: The number of training samples. Indicates the first One sample, Indicates the category of rotation angle, rot, One-hot encoding for the real label. rot, The predicted class probabilities by the model;

[0089] When constructing the self-supervised task "Hook occlusion prediction":

[0090] S311b: Defines the original video frame as 1, and uses an occlusion operation with an occlusion block size of... The square occlusion area of ​​the hook head is used to generate the occluded image I. _ occ;

[0091] S312b: Constructing occlusion label y _ occ, when the hook is obstructed, y _ occ is 1, otherwise it is 0;

[0092] S313b: Design a small CNN model M _OCC is used to predict whether the hook is occluded. The model structure includes a convolutional layer and a fully connected layer. The kernel size of the convolutional layer is defined as... The step size is s3, the number of output channels is c3, and the number of neurons in the fully connected layer is n; Model M _ The input to occ is I _ occ, the output is the predicted occlusion label y _ occ;

[0093] S314b: Define the loss function The binary cross-entropy loss is calculated using the following formula: ,in: The number of training samples. Indicates the first One sample, For real labels, The occlusion probability predicted by the model;

[0094] S32: Pre-training on large-scale unlabeled industrial video data:

[0095] S321: Define the pre-training learning rate as lr _ pre, training epochs _ pre, the batch size for each training round is batch _ size _ pre;

[0096] S322: During training, the loss function of the self-supervised task described above is optimized. and Update the model parameters;

[0097] S33: After pre-training, the pre-trained weights are transferred to the YOLOv8 backbone network, and the transfer learning rate is defined as Ir. _ transfer, fine-tuning the number of training epochs. _ fine _ tune, the batch size for each training round is batch. _ size _ fine _ tune;

[0098] To improve the model's transferability and generalization performance in industrial scenarios, a feature extraction capability improvement index is defined. The calculation formula is: ,in: This indicates the feature extraction capability of the YOLOv8 backbone network before migration. This indicates the feature extraction capability of the YOLOv8 backbone network after fine-tuning following the migration.

[0099] Feature extraction capability can be evaluated by calculating the similarity between the feature map and the true label on the validation set. The similarity calculation formula is as follows:

[0100]

[0101] Where M and N are the height and width of the feature map, respectively, F represents the feature map, and L represents the feature representation of the ground truth label.

[0102] Feature extraction evaluation: In addition to calculating the similarity between the feature map and the true label, other evaluation metrics (such as precision, recall, F1-score, etc.) can be added. These metrics can more comprehensively reflect the performance of the model.

[0103] S4: Model training and deployment optimization: Improve training efficiency by using mixed precision training, and quantize and prune the model to adapt to real-time deployment on edge devices;

[0104] S41: Mixed Precision Training: Defines the total number of iterations during model training as... The initial learning rate is The number of training samples in each batch is Mixed-precision training was employed, with the loss scaling factor set to [value missing]. This is used to prevent gradient underflow, and the calculation formula is: Where L is the original loss value; when updating the gradient, the scaled gradient is calculated first. Where W is the model parameter, the gradient is then reduced back to the normal range: Update model parameters: Where t is the current iteration number, The current learning rate is calculated using the following formula: , where power is the power parameter of the learning rate decay;

[0105] S42: Model Quantization: Quantizes the model, converting 32-bit floating-point (FP32) weights to 8-bit integers (INT8); defines quantization parameters. and The calculation formula is: ,in: and The extreme values ​​of the weight range, The quantization bit depth (value is 8); the quantized weights are... : ,in: The original 32-bit floating-point (FP32) weights of the model are shown;

[0106] S43: Model Pruning: A weight-based pruning method is used, with the pruning rate defined as prune. _ rate (value range 0-1), i.e., prune _ The rate ratio has small weights; the absolute value threshold for calculating the weights. percentile ,prune _ rate Set the weights with absolute values ​​less than thr to 0; calculate the sparsity of the pruned model. : ;in: The number of weights with a value of zero after pruning the model, i.e. the number of weights removed by pruning. This represents the total number of weights in the model before pruning, which is the original number of all weight parameters in the model.

[0107] Pruning strategy: The pruning rate can be adjusted based on the network's sparsity requirements. Excessive pruning may lead to a significant drop in model performance. Therefore, the pruning process can be gradually adjusted, and validation tests should be conducted.

[0108] Dynamic pruning: Some methods support dynamic pruning, which gradually removes unimportant weights during training.

[0109] S44: Model Deployment Optimization: Define the computing power parameter of the edge device as compute. _ capability, measured in GFLOPS; Based on the device's computing power, the quantized and pruned model is adapted and optimized to ensure that the inference time on edge devices meets real-time requirements, i.e., inference time... ,in This sets a real-time threshold; simultaneously, it ensures that the model's detection accuracy degradation on edge devices does not exceed a set tolerance. The calculation formula is: ,in: The detection accuracy of the original model on the validation set. To improve the detection accuracy of models deployed on edge devices.

[0110] Hardware adaptation: Select appropriate quantization and pruning parameters based on the device's computing capabilities (such as memory and computing power). Some edge devices may have hardware optimization support for the quantized INT8 weights, which can further accelerate inference.

[0111] Accuracy Guarantee: To strike a balance between accuracy and real-time performance, experiments can be conducted during pruning and quantization to find the optimal equilibrium. Post-deployment performance monitoring can be considered to ensure that both real-time performance and accuracy meet requirements.

[0112] Please see Figure 2 A crane hook recognition system based on YOLOv8 includes a data acquisition and annotation module, a model building and optimization module, a self-supervised pre-training module, and a model training and deployment module.

[0113] The data acquisition and annotation module uses high-definition cameras to acquire video frames of the overhead crane hook from multiple angles, annotates key parts, and expands the dataset with the help of data augmentation technology to improve the model's adaptability to different scenarios.

[0114] The model building and optimization module is used to improve upon YOLOv8 by incorporating a lightweight attention mechanism, a local detail enhancement branch, a dynamic anchor box adaptive mechanism, and an improved loss function, thereby enhancing the model's ability to perceive small targets and extract features.

[0115] The self-supervised pre-training module is used to construct self-supervised tasks, pre-train on large-scale unlabeled industrial video data, and transfer the pre-trained weights to the YOLOv8 backbone network to improve feature extraction and generalization capabilities.

[0116] The model training and deployment module uses hybrid precision training to improve efficiency, reduces computation and storage requirements through model quantization and pruning, and is finally deployed on edge devices to ensure real-time performance and accuracy.

[0117] As can be seen from the above description, the above embodiments of the present invention achieve the following technical effects: higher accuracy: by enhancing the detail extraction capability through LAF and LDEB modules, the hook recognition accuracy is improved.

[0118] High real-time performance: After the model is optimized for lightweight design, the frame processing time is reduced by more than 30%, making it suitable for edge deployment.

[0119] Highly robust: It can stably identify targets in complex environments such as strong light, shadow, and occlusion.

[0120] Highly scalable: The model structure is highly adaptable and can be quickly migrated to other lifting target recognition tasks.

[0121] Those skilled in the art should understand that the discussion of any of the above embodiments is merely exemplary and is not intended to imply that the scope of the invention (including the claims) is limited to these examples; within the framework of the invention, the technical features of the above embodiments or different embodiments can also be combined, the steps can be implemented in any order, and there are many other variations of the different aspects of the invention as described above, which are not provided in the details for the sake of brevity.

[0122] This invention is intended to cover all such substitutions, modifications, and variations falling within the broad scope of the claims. Therefore, any omissions, modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this invention should be included within the scope of protection of this invention.

Claims

1. A method for identifying overhead crane hooks based on YOLOv8, characterized in that, The specific steps include the following: S1: Data Acquisition and Labeling: Video frames of the overhead crane hook under different postures, lighting and backgrounds were acquired using a camera and then manually labeled to build a high-quality dataset. S2: Model Structure Innovation: Based on the original YOLOv8 structure, the following improvements are proposed: lightweight attention mechanism module, local detail enhancement branch, dynamic anchor box adaptive mechanism, and improved loss function; S3: Self-supervised pre-training mechanism: Construct a self-supervised task, perform pre-training on large-scale unlabeled industrial video data, and transfer the pre-trained weights to the YOLOv8 backbone network; S4: Model training and deployment optimization: Improve training efficiency by using mixed precision training, and quantize and prune the model to adapt to real-time deployment on edge devices; S1 specifically includes: S11: During the data acquisition phase, the camera operates at a frame rate of... Capture video frames of the overhead crane hook to ensure that the dynamic changes of the overhead crane hook can be fully captured in the time dimension; S12: For data annotation, a refined manual annotation method is adopted, as follows: Define annotation precision parameters. A consistency algorithm is introduced to calculate the consistency index c of annotation results for the same video frame by different annotators; when constructing a high-quality dataset, data augmentation algorithms are used, including random rotation angles. The random scaling factor s and the random translation distance d; S2 specifically includes: S21: Lightweight attention mechanism module: A lightweight attention module is introduced between the Backbone and Neck to effectively enhance the model's ability to perceive small targets; S22: Local Detail Enhancement Branch: A new auxiliary branch is added, which focuses on extracting features of hook edges and connection parts, and improves target recognition ability after being fused with the main features; S23: Dynamic anchor frame adaptive mechanism: Optimizes anchor frame parameters through online learning to improve adaptability to hooks of different sizes; S24: Improved loss function: Introduce position-sensitive IoU loss to more accurately assess hook center of gravity prediction error; S21 specifically includes: S211: Define the number of channels of the input feature map as C, the width as W, and the height as H, that is, the size of the input feature map is... ; S212: Introduce convolution operations to calculate channel attention weights; the convolution kernel size is... Step size is Fill with The number of channels remains unchanged; S213: Calculate the attention weight feature map of the output. ; S214: Multiply and fuse the attention weight feature map with the input feature map element by element to obtain the enhanced feature map; S22 specifically includes: adding parallel local enhancement branches to the original YOLOv8 Neck layer, introducing Dilated Convolution into the branch structure to expand the receptive field without losing resolution; combining the Swing Transformer module to introduce a local window attention mechanism to improve the expressiveness of local structures; and finally fusing it into the backbone feature map through Concat.

2. The crane hook identification method based on YOLOv8 according to claim 1, characterized in that, S23 specifically includes: S231: Define the number of anchor frames as n _ anchors, the initial anchor frame parameter is the width and height ; S232: Optimize anchor frame parameters through online learning; the calculation formula is as follows: Where: t is the number of iterations, For learning rate, and These are the estimated actual width and height of the hooks for the current batch, respectively.

3. The crane hook identification method based on YOLOv8 according to claim 2, characterized in that, S24 specifically includes: S241: Define the position parameter of the prediction box as the center coordinates. and width ,high The position parameters of the real bounding box are and ; S242: The formula for calculating the location-sensitive IoU loss is: , where IoU is the intersection-union ratio of the predicted bounding box and the ground truth bounding box.

4. The crane hook identification method based on YOLOv8 according to claim 1, characterized in that, S3 specifically includes: S31: Construct a self-supervised task, including hook direction prediction and hook occlusion prediction; S32: Pre-training on large-scale unlabeled industrial video data: S321: Define the pre-training learning rate as lr _ pre, training epochs _ pre, the batch size for each training round is batch _ size _ pre; S322: During training, the loss function of the self-supervised task described above is optimized. and Update the model parameters; S33: After pre-training, the pre-trained weights are transferred to the YOLOv8 backbone network, and the transfer learning rate is defined as Ir. _ transfer, fine-tuning the number of training epochs. _ fine _ tune, the batch size for each training round is batch. _ size _ fine _ tune.

5. The crane hook identification method based on YOLOv8 according to claim 1, characterized in that, S4 specifically includes: S41: Mixed Precision Training: Defines the total number of iterations during model training as... The initial learning rate is The number of training samples in each batch is Mixed precision training was used, and the loss scaling factor was set to [value missing]. When updating the gradient, first calculate the scaled gradient. Then, the gradient is reduced back to the normal range, and the model parameters are updated. S42: Model Quantization: Quantizes the model, converting 32-bit floating-point weights to 8-bit integers and defining quantization parameters. and The quantized weights are ; S43: Model Pruning: A weight-based pruning method is used, with the pruning rate defined as prune. _ rate, i.e., prune _ The rate ratio has small weights; the absolute value threshold for calculating the weights. Set the weights with absolute values ​​less than thr to 0; calculate the sparsity of the pruned model. ; S44: Model Deployment Optimization: Define the computing power parameter of the edge device as compute. _ Capability; Based on the device's computing power, adapt and optimize the quantized and pruned model to ensure that the inference time of the model on the edge device meets the real-time requirements; at the same time, ensure that the decrease in detection accuracy of the model on the edge device does not exceed the set tolerance. .

6. A YOLOv8-based overhead crane hook identification system, used to implement the YOLOv8-based overhead crane hook identification method as described in any one of claims 1-5, characterized in that, It includes modules for data acquisition and annotation, model building and optimization, self-supervised pre-training, and model training and deployment. The data acquisition and annotation module uses a high-definition camera to acquire video frames of the overhead crane hook from multiple angles and annotates key parts. The model building and optimization module is used to improve upon YOLOv8 by incorporating a lightweight attention mechanism, a local detail enhancement branch, a dynamic anchor box adaptive mechanism, and an improved loss function. The self-supervised pre-training module is used to construct a self-supervised task, pre-train on large-scale unlabeled industrial video data, and transfer the pre-trained weights to the YOLOv8 backbone network. The model training and deployment module employs hybrid precision training to improve efficiency, reduces computational and storage requirements through model quantization and pruning, and is ultimately deployed on edge devices to ensure real-time performance and accuracy.

Citation Information

Patent Citations

  • Improved yolov5-based aerial insulator orientation identification method

    CN115690542A

  • Fan blade defect detection method and system based on improved SSD model

    WO2023173598A1