Steel coil detection method and device in shielding scene, electronic equipment and storage medium
By setting up an object detection algorithm in an occlusion scenario and determining the target box position data, the difficulty of traditional algorithms in identifying and counting steel coils in an occlusion scenario is solved, and higher detection accuracy and system stability are achieved.
Patent Information
- Application Number
- CN202411419565.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-11
- Publication Date
- 2025-03-04
AI Technical Summary
In occlusion scenarios, traditional machine vision coil counting algorithms are difficult to accurately identify and count, resulting in inaccuracy and error in detection results.
By obtaining the steel coil monitoring images of the occluded scene captured in real-time, combining preset improved methods and default detection algorithms, setting the object detection algorithm to determine the target box position data, thereby accurately calculating the number of steel coils.
It significantly improves the detection accuracy of steel coils in shading scenarios, improves the reliability and stability of the detection system, reduces the situation of false detection and missed detection, and can work stably under different conditions.
Smart Images

Figure CN119559567A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and for example, to a method, device, electronic device and storage medium for detecting steel coils in an occluded scene. Background Art
[0002] With the rapid development of social economy, the demand for automated and intelligent production in the manufacturing and logistics industries is growing. Although traditional manual visual monitoring and detection methods have played an important role in the past, they have gradually revealed their limitations in the face of the high efficiency and high precision requirements of modern production. Especially in the links of warehousing management, logistics and transportation, a large number of repetitive and high-intensity tasks pose a huge challenge to the physical strength and attention of personnel. At the same time, the fatigue and error of human vision also lead to a decrease in detection efficiency and accuracy. In order to meet this challenge, machine vision technology came into being and rose rapidly. By simulating and surpassing the visual function of the human eye, machine vision technology uses high-definition cameras to capture images, and combines advanced image processing algorithms and artificial intelligence technology to realize the automatic identification, positioning, measurement and counting of target objects. In modern warehousing management, the application of machine vision technology is particularly extensive. Especially in the scene of vehicle entry and exit, machine vision technology has shown significant advantages in counting tasks of bulk goods such as steel coils. The traditional manual counting method is not only time-consuming and labor-intensive, but also easily interfered by human factors, resulting in inaccurate counting results. The machine vision inspection system can capture the images of steel coils loaded on the vehicle in real time through high-definition cameras, analyze and process the images using image processing algorithms, and automatically identify and accurately calculate the number of steel coils.
[0003] In the related technology, although the steel coil counting algorithm based on machine vision has achieved remarkable results in steel images taken from the side, its recognition ability still faces challenges when facing complex scenes such as frontal shooting or occlusion caused by close arrangement of steel coils. The occlusion problem not only increases the difficulty of capturing the shape characteristics of the steel coil, but also may cause confusion in object recognition and deviation in counting results. Summary of the invention
[0004] The present application aims to provide a steel coil detection method, device, electronic equipment and storage medium in an occluded scenario.
[0005] According to one aspect of the present application, a steel coil detection method in an occlusion scene is proposed, including: obtaining a steel coil monitoring image of the occlusion scene taken in real time; setting a target detection algorithm according to a preset improvement method and a preset default detection algorithm; determining target frame position data according to the target detection algorithm and the steel coil monitoring image; and determining the number of steel coils according to the target frame position data.
[0006] According to some embodiments, a target detection algorithm is set according to a preset improvement method and a preset default detection algorithm, including: obtaining the improvement method, and setting a detection algorithm framework according to the improvement method; determining a loss value according to the improvement method and the detection algorithm framework; determining a target detection algorithm according to the default detection algorithm, the detection algorithm framework and the loss value.
[0007] According to some embodiments, a detection algorithm framework is set according to an improved method, including: based on the improved method, feature extraction is performed on multiple historical steel coil monitoring images to determine multiple occluded image features; feature fusion is performed on multiple occluded image features, and steel coil target information is predicted; post-processing is performed on the predicted steel coil target information to determine the detection algorithm framework.
[0008] According to some embodiments, post-processing is performed on the predicted steel coil target information to determine the detection algorithm framework, including: determining a plurality of preset bounding boxes from the steel coil target information; determining a plurality of target bounding boxes from the plurality of preset bounding boxes according to a preset post-processing method; wherein the target bounding box is a preset bounding box with a confidence greater than a first threshold, or an overlap less than a second threshold; obtaining the predicted category of the target bounding box, the bounding box position information and the corresponding confidence, and determining the detection algorithm framework.
[0009] According to some embodiments, a loss value is determined according to an improvement method and a detection algorithm framework, including: obtaining a preset default loss function according to the improvement method; determining a steel coil count prediction result and a steel coil count real labeled data in a detection process according to the detection algorithm framework; determining a loss value according to the default loss function, the steel coil count prediction result and the steel coil count real labeled data.
[0010] According to some embodiments, a loss value is determined based on a default loss function, a steel coil count prediction result, and real labeled data of steel coil count, including: initializing the default loss function to determine a target loss function; according to the target loss function, using the steel coil count prediction result and real labeled data of steel coil count, calculating attraction loss, repulsion loss, and smoothing loss for the real box and the predicted box in the detection algorithm framework to determine the loss value.
[0011] According to some embodiments, the target detection algorithm is configured in the target detection model; according to the target detection algorithm and the steel coil monitoring image, the target frame position data is determined, including: inputting the steel coil monitoring image into the target detection model to output the target frame position data.
[0012] According to one aspect of the present application, a steel coil detection device in an obstruction scenario is proposed, comprising:
[0013] An image acquisition module, used to acquire a real-time monitoring image of the steel coil of the obstruction scene;
[0014] An algorithm setting module, used to set a target detection algorithm according to a preset improvement method and a preset default detection algorithm;
[0015] A position determination module is used to determine the target frame position data based on the target detection algorithm and the steel coil monitoring image;
[0016] The quantity determination module is used to determine the quantity of steel coils according to the target frame position data.
[0017] Optionally, the algorithm setting module is specifically used to:
[0018] Obtain improvement methods and set the detection algorithm framework according to the improvement methods;
[0019] Determine the loss value based on the improvement method and detection algorithm framework;
[0020] Determine the target detection algorithm based on the default detection algorithm, detection algorithm framework, and loss value.
[0021] Optionally, when the algorithm setting module sets the detection algorithm framework according to the improved method, it can be specifically used for:
[0022] Based on the improved method, feature extraction is performed on multiple historical steel coil monitoring images to determine multiple occluded image features;
[0023] Perform feature fusion on multiple occluded image features and predict the target information of the steel coil;
[0024] Post-processing is performed on the predicted steel coil target information to determine the detection algorithm framework.
[0025] Optionally, the algorithm setting module is specifically used to:
[0026] determining a plurality of preset bounding boxes from the steel coil target information;
[0027] According to a preset post-processing method, a plurality of target bounding boxes are determined from the plurality of preset bounding boxes; wherein the target bounding box is a preset bounding box whose confidence is greater than a first threshold or whose overlap is less than a second threshold;
[0028] Obtain the predicted category, bounding box location information, and corresponding confidence of the target bounding box to determine the detection algorithm framework.
[0029] Optionally, the algorithm setting module, when determining the loss value according to the improvement method and the detection algorithm framework, is specifically used to:
[0030] According to the improvement method, obtain the preset default loss function;
[0031] According to the detection algorithm framework, determine the steel coil count prediction results and the steel coil count real labeling data during the detection process;
[0032] The loss value is determined based on the default loss function, the steel coil count prediction results, and the actual labeled data of the steel coil count.
[0033] Optionally, the algorithm setting module is specifically used to: determine the loss value according to the default loss function, the steel coil count prediction result and the steel coil count real labeled data;
[0034] Initialize the default loss function to determine the target loss function;
[0035] According to the target loss function, the steel coil counting prediction results and the real labeled data of steel coil counting are used to calculate the attraction loss, repulsion loss and smoothing loss of the real box and the predicted box in the detection algorithm framework to determine the loss value.
[0036] Optionally, the target detection algorithm is configured in the target detection model; the position determination module is specifically used for:
[0037] The steel coil monitoring image is input into the target detection model to output the target box position data.
[0038] According to one aspect of the present application, an electronic device is proposed, which includes: a processor; a memory storing a computer program, and when the computer program is executed by the processor, the processor executes the steel coil detection method in the occlusion scenario as described above.
[0039] According to one aspect of the present application, a non-transitory computer-readable medium is provided, on which readable instructions are stored. When the instructions are executed by a processor, the processor executes the steel coil detection method in the occlusion scenario as described above.
[0040] It should be understood that the foregoing general description and the following detailed description are exemplary only and are not restrictive of the present application.
[0041] Beneficial effects:
[0042] Through the above embodiments provided by the present application, the occlusion problem in the steel coil monitoring image can be handled more effectively through the fusion of the preset improvement method and the default detection algorithm. Occlusion is a common challenge in automated detection, especially in complex industrial environments. Occlusion between steel coils or between steel coils and other objects will seriously affect the accuracy of the detection results. By optimizing the target detection algorithm, the present application can more accurately identify obscured or partially obscured steel coils, thereby significantly improving the detection accuracy. In the face of changing industrial field environments, such as lighting changes, shadow effects, background clutter, etc., the present application makes the target detection algorithm more robust through targeted improvements. It can work stably under different conditions, reduce false detections and missed detections, and improve the reliability and stability of the detection system. Through accurate target frame position data determination, the present application can quickly and accurately locate the position of the steel coil, and then quickly calculate the number of steel coils. This is crucial for industrial production processes that require real-time monitoring and efficient management, and helps to improve production efficiency and management level. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without exceeding the scope of protection required by the present application.
[0044] Figure 1 A flow chart of a method for detecting a steel coil in an occlusion scenario provided in an embodiment of the present application;
[0045] Figure 2 In the embodiment of the present application, in step S11, according to the improved method, in the process of implementing the detection algorithm framework, post-processing is performed on the predicted steel coil target information to determine the implementation flow chart of the detection algorithm framework;
[0046] Figure 3 A flowchart for determining a loss value according to an improved method and a detection algorithm framework in step S11 provided in an embodiment of the present application;
[0047] Figure 4 A flowchart for implementing step S113 provided in an embodiment of the present application;
[0048] Figure 5 A block diagram of a steel coil detection device in an occlusion scenario provided in an embodiment of the present application;
[0049] Figure 6 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0050] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in many forms and should not be construed as limited to the embodiments set forth herein; rather, these embodiments are provided so that this application will be comprehensive and complete and will fully convey the concepts of the example embodiments to those skilled in the art. The same reference numerals in the figures represent the same or similar parts, and thus their repeated description will be omitted.
[0051] In addition, described feature, structure or characteristic can be combined in one or more embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present application. However, those skilled in the art will appreciate that the technical scheme of the present application can be put into practice without one or more of the specific details, or other methods, components, devices, steps, etc. can be adopted. In other cases, known methods, devices, realizations or operations are not shown or described in detail to avoid blurring the various aspects of the application.
[0052] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities may be implemented in software form, or in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.
[0053] The flowcharts shown in the accompanying drawings are only exemplary 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 can be decomposed, and some operations / steps can be combined or partially combined, so the actual execution order may change according to actual conditions.
[0054] It should be understood that although the terms first, second, third, etc. may be used herein to describe various components, these components should not be limited by these terms. These terms are used to distinguish one component from another component. Therefore, the first component discussed below can be referred to as the second component without departing from the teachings of the concepts of the present application. As used herein, the term "and / or" includes any one of the associated listed items and all combinations of one or more.
[0055] For specific implementation methods, please refer to the following embodiments.
[0056] Figure 1 This is a flow chart of a steel coil detection method under an obstruction scenario provided in an embodiment of the present application. The method of this embodiment can be applied to a detection server. Figure 1 As shown, the method includes: step S10, step S11, step S12 and step S13.
[0057] In step S10, a steel coil monitoring image of the obstruction scene captured in real time is acquired.
[0058] In this application, high-definition cameras can be set at multiple locations, including at least the warehouse entrance. These high-definition cameras can capture vehicles entering and leaving and steel coils loaded on vehicles, and the captured images include monitoring images of steel coils that block the scene.
[0059] According to the example embodiment, the high-definition camera can capture the steel coil monitoring image in real time, and then send the steel coil monitoring image to the detection server, which receives it accordingly.
[0060] In step S11, a target detection algorithm is set according to a preset improvement method and a preset default detection algorithm.
[0061] In the present application, the preset default detection algorithm may be a traditional YOLOv8 algorithm, and the preset improvement method may correspond to an improvement on a loss function, etc.
[0062] According to an example embodiment, a script based on a default detection algorithm and modified using a preset improvement method can be pre-set and stored. The script of the preset improvement method can be directly called to upgrade the default detection algorithm to implement the setting process of the target detection algorithm.
[0063] In step S12, the target frame position data is determined based on the target detection algorithm and the steel coil monitoring image.
[0064] In the present application, the target frame corresponding to the target frame position data may be a square frame, and the data may include coordinate data of the points at the upper left corner and lower right corner of the target frame corresponding to the steel coil in the image.
[0065] According to an example embodiment, a target detection algorithm may be used to process the steel coil monitoring image to obtain target frame position data.
[0066] In some implementations, the target detection algorithm may be a model such as a convolutional neural network, which inputs the steel coil monitoring image into the target detection algorithm and then outputs the target frame position data.
[0067] In other implementations, the target detection algorithm may be an improved YOLO algorithm, which regards target detection as a single regression problem, directly predicts bounding boxes from the steel coil monitoring image, and then obtains target box position data.
[0068] In step S13, the number of steel coils is determined according to the target frame position data.
[0069] According to an example embodiment, the number of target frames may be directly extracted from the target frame position data, and each target frame may correspond to a steel coil, thereby determining the number of steel coils.
[0070] This application can more effectively handle the occlusion problem in the steel coil monitoring image by integrating the preset improvement method and the default detection algorithm. Occlusion is a common challenge in automated detection, especially in complex industrial environments. Occlusion between steel coils or between steel coils and other objects will seriously affect the accuracy of the detection results. This application can more accurately identify obscured or partially obscured steel coils by optimizing the target detection algorithm, thereby significantly improving the detection accuracy. In the face of changing industrial field environments, such as lighting changes, shadow effects, background clutter, etc., this application makes the target detection algorithm more robust through targeted improvements. It can work stably under different conditions, reduce false detections and missed detections, and improve the reliability and stability of the detection system. Through precise target frame position data determination, this application can quickly and accurately locate the position of the steel coil, and then quickly calculate the number of steel coils. This is crucial for industrial production processes that require real-time monitoring and efficient management, and helps to improve production efficiency and management level.
[0071] According to some embodiments, step S11 can be specifically implemented through the following steps: obtaining an improvement method, and setting a detection algorithm framework according to the improvement method; determining a loss value according to the improvement method and the detection algorithm framework; determining a target detection algorithm according to a default detection algorithm, the detection algorithm framework and the loss value.
[0072] In some implementations, the preset improvement methods may include optimization directions such as network structure optimization, attention mechanism optimization, data enhancement, and anchor box optimization. Based on these preset optimization directions, the basic framework of the target detection algorithm is set. For example, if YOLOv4 is selected as the default detection algorithm and FPN and SE-Net are introduced for improvement, it is necessary to add FPN modules and SE modules on the basis of YOLOv4 and adjust the corresponding network structure. In other implementations, YOLOv8 can be selected as the default detection algorithm.
[0073] Extract the loss function from the improvement method to guide the optimization of the detection algorithm framework. The loss function can include multiple parts, such as classification loss, positioning loss, and other losses, such as confidence, etc., based on which the loss value is calculated. Call the preset script, adjust the default detection algorithm framework to the detection algorithm framework, and train the algorithm under the guidance of the loss value, such as continuously adjusting the model parameters to minimize the loss to the loss value. Use the algorithm after training as the target detection algorithm.
[0074] This application introduces a preset improvement method, which can significantly improve the adaptability of the target detection algorithm when detecting steel coils in occluded scenes, and can enable the algorithm to better cope with challenges such as complex environments, occlusion problems, and changes in lighting, thereby improving the accuracy and robustness of detection. By combining the default detection algorithm and the preset improvement method, this application can build a more stable and easy-to-train model framework, thereby improving the overall performance and reliability of the model.
[0075] According to some embodiments, in step S11, a detection algorithm framework is set according to an improved method, which can be specifically implemented through the following steps: based on the improved method, feature extraction is performed on multiple historical steel coil monitoring images to determine multiple occlusion image features; feature fusion is performed on multiple occlusion image features, and steel coil target information is predicted; post-processing is performed on the predicted steel coil target information to determine the detection algorithm framework.
[0076] In the present application, each historical steel coil monitoring image contains the features of the steel coil, and the occluded image features can be used to represent the overlapping features of at least two steel coils in the image.
[0077] According to some embodiments, multiple historical steel coil monitoring images can be processed according to a preset improvement method, such as introducing an attention mechanism, optimizing a convolutional neural network structure, or using a specific feature extraction module to obtain multiple occlusion image features. In some implementations, an improved convolutional layer, pooling layer, or fully connected layer can be used to capture steel coil features under occlusion in the image.
[0078] The occluded image features extracted from multiple images are fused. In some implementations, fusion can be achieved by feature splicing, weighted summation, or by using the feature fusion layer in deep learning. Based on the fused features, the prediction module of the default detection algorithm is called to locate and classify the steel coil target. Parameters such as anchor boxes and bounding box regression can be set according to the framework of the default detection algorithm to optimize the prediction results. The predicted steel coil target information can then be post-processed, including the use of non-maximum suppression to eliminate redundant bounding boxes, and also includes operations such as fine-tuning of the bounding box. After the post-processing is completed, the detection algorithm framework is obtained.
[0079] This application significantly enhances the robustness of the detection algorithm in an occluded environment by extracting features from multiple historical steel coil monitoring images, and paying special attention to the recognition of occluded image features. Even when the steel coil is partially occluded, the algorithm can accurately detect and identify the existence and location of the steel coil, improving the accuracy and reliability of the detection. The effective fusion of multiple occluded image features not only enriches the feature representation of the steel coil target, but also reduces false detections and missed detections caused by insufficient single feature information. The use of feature fusion strategies enables the algorithm to understand the information in the image more comprehensively, improving the overall performance and stability of target detection. The steel coil target information is predicted based on the fused features, making the prediction results more accurate. Post-processing is performed on the predicted steel coil target information, such as non-maximum suppression, bounding box fine-tuning, etc., to further improve the accuracy and visualization of the detection results.
[0080] According to some embodiments, reference Figure 2 In step S11, according to the improved method, during the implementation of setting the detection algorithm framework, post-processing can be performed on the predicted steel coil target information to determine the detection algorithm framework. This step can be specifically implemented through steps S110 and S111.
[0081] In step S110, multiple preset bounding boxes are determined from the steel coil target information; according to a preset post-processing method, multiple target bounding boxes are determined from the multiple preset bounding boxes; wherein the target bounding box is a preset bounding box with a confidence greater than a first threshold or an overlap less than a second threshold.
[0082] In the present application, the first threshold and the second threshold can be pre-set, and when the confidence is less than or equal to the first threshold, it can indicate that the confidence of the bounding box is low. When the overlap is greater than or equal to the second threshold, it can indicate that the overlap of the bounding box is high.
[0083] According to the example embodiment, multiple preset bounding boxes and the confidence of each preset bounding box can be extracted from the steel coil target information, and the bounding boxes with low confidence or overlap can be filtered out by non-maximum values to retain the boxes with higher prediction accuracy and use them as target bounding boxes.
[0084] In step S111, the predicted category, bounding box position information and corresponding confidence of the target bounding box are obtained to determine the detection algorithm framework.
[0085] In this application, the category of the bounding box can be the category of the object in the preset bounding box, such as steel coil, front of the car, rear of the car, etc., and the predicted category corresponding to the target bounding box is steel coil. The bounding box position information includes the coordinates and size of the bounding box, which is used to indicate the specific position of the steel coil target in the image.
[0086] According to the example embodiment, the object within the target bounding box can be determined through image analysis, and then the predicted category can be determined by comparing the features with various preset object features. The bounding box position information and the corresponding confidence level in the steel coil target information are directly obtained, and the modules corresponding to the predicted category, bounding box position information and confidence level respectively constitute the detection algorithm framework.
[0087] This application uses a preset post-processing method to select target bounding boxes with higher confidence or lower overlap from multiple preset bounding boxes, effectively reducing false detections and repeated detections, ensuring the accuracy and reliability of the final detection results, and improving the accuracy of steel coil target detection. By setting the confidence threshold and overlap threshold, the post-processing process can automatically adapt to steel coil monitoring images of different complexities and occlusion levels, enhancing the robustness of the detection algorithm, allowing the algorithm to maintain stable performance in different scenarios, and improving its practicality and generalization ability.
[0088] According to some embodiments, reference Figure 3 In step S11, the loss value is determined according to the improvement method and the detection algorithm framework, which can be specifically implemented through steps S112 and S113.
[0089] In step S112, according to the improved method, a preset default loss function is obtained; according to the detection algorithm framework, the steel coil count prediction result and the steel coil count real annotation data in the detection process are determined.
[0090] In this application, the steel coil count prediction result can be the predicted value obtained after processing the image through the detection algorithm framework, which represents the estimation of the number of steel coils in the image. The steel coil count real annotated data is the real data used to evaluate the performance of the model, which represents the actual value of the number of steel coils in the image. These data are usually obtained by manual annotation or sensors and other devices.
[0091] According to the example embodiment, according to the improved method, the preset default loss function is correspondingly searched and obtained. In some implementations, the corresponding loss function can be searched based on the requirements and characteristics included in the improved method, with the requirements and characteristics as labels. The input image is processed using the detection algorithm framework to generate a steel coil count prediction result. The steel coil count real annotation data corresponding to the input data is obtained.
[0092] In step S113, the loss value is determined according to the default loss function, the steel coil count prediction result and the steel coil count real labeled data.
[0093] According to an example embodiment, based on a default loss function, a loss value is determined based on the difference between the steel coil count prediction result and the steel coil count real labeled data.
[0094] In some implementations, a preset script corresponding to the default loss function may be searched, the parameters of the preset script may be supplemented using the steel coil count prediction results and the actual annotated data of the steel coil count, and then the script may be run to determine the loss value.
[0095] This application obtains the preset default loss function according to the improved method, which can ensure that the design of the loss function is more in line with the needs of the actual problem. This targeted design helps the model focus more on the learning of key features during the training process, thereby improving the accuracy and robustness of the model in the steel coil counting task. The determination of the detection algorithm framework makes the steel coil counting prediction results more reliable and accurate. Combined with the preset default loss function, it is possible to more accurately evaluate the difference between the prediction results and the actual labeled data, thereby guiding the model to continuously optimize during the training process to reduce this difference and improve the prediction accuracy. By calculating the loss value, the performance of the model at different stages can be quantitatively evaluated, providing strong support for the optimization and iteration of the model.
[0096] According to some embodiments, reference Figure 4 , step S113 can be specifically implemented through step S1130 and step S1131.
[0097] In step S1130 , the default loss function is initialized to determine the target loss function.
[0098] According to the example embodiment, the default loss function used can first be directly obtained from the improved method. Then the detection algorithm framework can be initialized. In some implementations, three parameters can be predefined: alpha, beta and sigma, which are used to adjust the weights and thresholds of different loss components in the framework. In addition, a small constant eps can be pre-set to avoid zero division errors.
[0099] Then forward propagation can be performed to calculate the repulsion loss between a given true box and a predicted box. In some implementations, the intersection over union (IOU) between the true box and the predicted box and the IOU between each predicted box can be calculated. The true box corresponding to the maximum IOU between each predicted box and the true box is found, and the maximum IOU is set to zero.
[0100] Find out whether there is a valid second largest IOU, that is, box_iou.sum in the script is not zero. If there is a second largest IOU, calculate the attraction loss (Attr) between the predicted box and the corresponding real box, the repulsion loss (RepGT) between the predicted box corresponding to the second largest IOU and the main real box, and the repulsion loss (RepBox) between the predicted box corresponding to the second largest IOU and other predicted boxes. These losses can correspond to the target loss function. If there is no second largest IOU, only the repulsion loss (RepGT) between the predicted box corresponding to the second largest IOU and the main real box and the repulsion loss (RepBox) between the predicted box corresponding to the second largest IOU and other predicted boxes are calculated. These losses can correspond to the target loss function.
[0101] In step S1131, according to the target loss function, using the steel coil count prediction results and the real annotation data of the steel coil count, the attraction loss, repulsion loss and smoothing loss are calculated for the real box and the prediction box in the detection algorithm framework to determine the loss value.
[0102] According to an example embodiment, multiple prediction boxes can be extracted from the steel coil count prediction results, and multiple real boxes can be extracted from the steel coil count real annotation data. In the process of calculating the attraction loss between the prediction box and the corresponding real box, each prediction box and the corresponding real box are first traversed, and a prediction box and the corresponding real box are regarded as a pair of boxes. For each pair of boxes, the smoothed L1 loss between them is calculated, and all smoothed L1 losses are added and averaged to obtain the total attraction loss. In some implementations, in the process of calculating the smoothed L1 loss between two values, the absolute value of the difference between the predicted value and the true value can be calculated, and the square loss or linear loss is decided based on the comparison of the absolute value with the above-mentioned pre-defined beta (default is 1.0), and then the calculated loss value is returned.
[0103] In the process of calculating the exclusion loss of the predicted box and the main real box, first traverse each predicted box and the corresponding real box, and calculate the intersection-overlap ratio of each pair of boxes. According to the intersection-overlap ratio and the sigma threshold defined above, find out which pre-set method is used to calculate the loss, such as logarithmic loss or linear loss. Then all losses can be added and averaged to get the total exclusion loss with the real box.
[0104] In the process of calculating the repulsion loss between the prediction box and other prediction boxes, that is, between the prediction boxes, all prediction box pairs are traversed, the overlap between each pair of prediction boxes is calculated, and according to the overlap and the above-defined sigma threshold, the pre-set method for calculating the loss is correspondingly found, such as logarithmic loss or linear loss. All losses are added and averaged to obtain the total repulsion loss between the prediction boxes.
[0105] This application introduces attraction loss so that the algorithm pays more attention to attracting the prediction box, that is, the steel coil position predicted by the model, to the real box, that is, near the real position of the annotated steel coil during the training process. This can improve the model's positioning accuracy of the steel coil position and reduce the deviation between the prediction box and the real box. The attraction loss, repulsion loss and smoothing loss are combined to form a comprehensive target loss function. This combination can more comprehensively evaluate the performance of the algorithm in the steel coil counting task, focusing not only on the accuracy of the prediction results, but also on detailed information such as the position and shape of the prediction box. By comprehensively considering multiple loss factors, the algorithm can learn richer feature information during the training process, thereby improving its generalization ability in different data sets and scenarios.
[0106] According to some embodiments, the target detection algorithm is configured in the target detection model; step S12 can be specifically implemented by: inputting the steel coil monitoring image into the target detection model to output the target frame position data.
[0107] The target detection algorithm in this application can be configured in a model improved based on the YOLOv8 algorithm.
[0108] According to an example embodiment, when the target detection algorithm is a target detection model, the steel coil monitoring image can be input into the target detection model, and the target detection model can perform operations such as loss calculation according to the above process and output target frame position data.
[0109] The present application automatically processes the steel coil monitoring image through the target detection model, quickly and accurately identifies the position of the steel coil in the image, and outputs the corresponding target frame position data, thereby improving processing efficiency and accuracy.
[0110] The following describes an apparatus embodiment of the present application, which can be used to execute the method embodiment of the present application. For details not disclosed in the apparatus embodiment of the present application, reference can be made to the method embodiment of the present application.
[0111] Figure 5 FIG. 2 is a block diagram of a steel coil detection device in an obstruction scenario according to an exemplary embodiment. Figure 5 As shown, the steel coil detection device 500 in the occlusion scene includes an image acquisition module 501, an algorithm setting module 502, a position determination module 503 and a quantity determination module 504.
[0112] An image acquisition module 501 is used to acquire a real-time monitoring image of a steel coil of an obstruction scene;
[0113] An algorithm setting module 502, used to set a target detection algorithm according to a preset improvement method and a preset default detection algorithm;
[0114] The position determination module 503 is used to determine the target frame position data according to the target detection algorithm and the steel coil monitoring image;
[0115] The quantity determination module 504 is used to determine the quantity of the steel coils according to the target frame position data.
[0116] Optionally, the algorithm setting module 502 is specifically used for:
[0117] Obtain improvement methods and set the detection algorithm framework according to the improvement methods;
[0118] Determine the loss value based on the improvement method and detection algorithm framework;
[0119] Determine the target detection algorithm based on the default detection algorithm, detection algorithm framework, and loss value.
[0120] Optionally, when the algorithm setting module 502 sets the detection algorithm framework according to the improved method, it can be specifically used for:
[0121] Based on the improved method, feature extraction is performed on multiple historical steel coil monitoring images to determine multiple occluded image features;
[0122] Perform feature fusion on multiple occluded image features and predict the target information of the steel coil;
[0123] Post-processing is performed on the predicted steel coil target information to determine the detection algorithm framework.
[0124] Optionally, the algorithm setting module 502 is specifically used to:
[0125] determining a plurality of preset bounding boxes from the steel coil target information;
[0126] According to a preset post-processing method, a plurality of target bounding boxes are determined from the plurality of preset bounding boxes; wherein the target bounding box is a preset bounding box whose confidence is greater than a first threshold or whose overlap is less than a second threshold;
[0127] Obtain the predicted category, bounding box location information, and corresponding confidence of the target bounding box to determine the detection algorithm framework.
[0128] Optionally, the algorithm setting module 502, when determining the loss value according to the improved method and the detection algorithm framework, is specifically used to:
[0129] According to the improvement method, obtain the preset default loss function;
[0130] According to the detection algorithm framework, determine the steel coil count prediction results and the steel coil count real labeling data during the detection process;
[0131] The loss value is determined based on the default loss function, the steel coil count prediction results, and the actual labeled data of the steel coil count.
[0132] Optionally, the algorithm setting module 502 is specifically used to: determine the loss value according to the default loss function, the steel coil count prediction result and the steel coil count real labeling data:
[0133] Initialize the default loss function to determine the target loss function;
[0134] According to the target loss function, the steel coil counting prediction results and the real labeled data of steel coil counting are used to calculate the attraction loss, repulsion loss and smoothing loss of the real box and the predicted box in the detection algorithm framework to determine the loss value.
[0135] Optionally, the target detection algorithm is configured in the target detection model; the position determination module 503 is specifically used for:
[0136] The steel coil monitoring image is input into the target detection model to output the target box position data.
[0137] The device performs functions similar to the method provided above. For other functions, please refer to the previous description and will not be repeated here.
[0138] Figure 6 A schematic diagram of the structure of an electronic device according to an exemplary embodiment is shown. Figure 6 As shown, the electronic device 600 of this embodiment may include: a memory 601 and a processor 602 .
[0139] The memory 601 stores a computer program. When the computer program is executed by the processor 602, the processor 602 executes the method in the above embodiment.
[0140] The processor 602 and the memory 601 are connected, for example, via a bus.
[0141] Optionally, the electronic device 600 may further include a transceiver. It should be noted that in actual applications, the number of transceivers is not limited to one, and the structure of the electronic device 600 does not constitute a limitation on the embodiments of the present application.
[0142] The processor 602 may be a CPU (Central Processing Unit), a general-purpose processor, a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array), or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof. It may implement or execute various exemplary logic blocks, modules, and circuits described in conjunction with the disclosure of this application. The processor 602 may also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, and the like.
[0143] The bus may include a path to transmit information between the above components. The bus may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.
[0144] The memory 601 can be a ROM (Read Only Memory) or other types of static storage devices that can store static information and instructions, a RAM (Random Access Memory) or other types of dynamic storage devices that can store information and instructions, or an EEPROM (Electrically Erasable Programmable Read Only Memory), a CD-ROM (Compact Disc Read Only Memory) or other optical disk storage, optical disk storage (including compressed optical disk, laser disk, optical disk, digital versatile disk, Blu-ray disk, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited to these.
[0145] The memory 601 is used to store the application code for executing the solution of the present application, and the execution is controlled by the processor 602. The processor 602 is used to execute the application code stored in the memory 601 to implement the contents shown in the above method embodiment.
[0146] The electronic devices include, but are not limited to, mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), and fixed terminals such as digital TVs, desktop computers, etc. It can also be a server, etc. Figure 6 The electronic device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0147] The electronic device of this embodiment can be used to execute the method of any of the above embodiments, and its implementation principle and technical effect are similar, which will not be described in detail here.
[0148] The present application also provides a non-transitory computer-readable storage medium having computer-readable instructions stored thereon. When the aforementioned instructions are executed by a processor, the processor executes the method in the above embodiment.
[0149] Those skilled in the art can understand that all or part of the steps of implementing the above-mentioned method embodiments can be completed by hardware related to program instructions. The aforementioned program can be stored in a non-transient computer-readable storage medium. When the program is executed, the steps of the above-mentioned method embodiments are executed; and the aforementioned storage medium includes: ROM, RAM, disk or optical disk and other media that can store program codes.
[0150] The embodiments of the present application are described in detail above. Specific examples are used herein to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method and its core idea of the present application. At the same time, changes or deformations made by those skilled in the art based on the ideas of the present application, the specific implementation methods and the scope of application of the present application, all belong to the scope of protection of the present application. In summary, the content of this specification should not be construed as a limitation on the present application.
Claims
1. A method for detecting steel coils in an occluded scene, characterized in that: include: Acquire the steel coil monitoring image of the obstruction scene captured in real time; Set the target detection algorithm according to the preset improvement method and the preset default detection algorithm; Determine target frame position data according to the target detection algorithm and the steel coil monitoring image; The number of steel coils is determined according to the target frame position data.
2. The method according to claim 1, characterized in that The target detection algorithm is set according to the preset improvement method and the preset default detection algorithm, including: Obtaining the improvement method, and setting a detection algorithm framework according to the improvement method; Determine the loss value according to the improved method and the detection algorithm framework; The target detection algorithm is determined according to the default detection algorithm, the detection algorithm framework and the loss value.
3. The method according to claim 2, characterized in that According to the improved method, a detection algorithm framework is set, including: Based on the improved method, feature extraction is performed on multiple historical steel coil monitoring images to determine multiple occluded image features; Performing feature fusion on the multiple occluded image features and predicting the target information of the steel coil; Post-processing is performed on the predicted steel coil target information to determine the detection algorithm framework.
4. The method according to claim 3, characterized in that The post-processing of the predicted steel coil target information to determine the detection algorithm framework includes: Determining a plurality of preset bounding boxes from the steel coil target information; According to a preset post-processing method, a plurality of target bounding boxes are determined from the plurality of preset bounding boxes; wherein the target bounding boxes are preset bounding boxes whose confidence is greater than a first threshold or whose overlap is less than a second threshold; The predicted category, bounding box location information, and corresponding confidence level of the target bounding box are obtained to determine a detection algorithm framework.
5. The method according to claim 2, characterized in that: Determining the loss value according to the improved method and the detection algorithm framework includes: According to the improved method, a preset default loss function is obtained; According to the detection algorithm framework, determining the steel coil count prediction result and the steel coil count real labeling data during the detection process; The loss value is determined according to the default loss function, the steel coil count prediction result and the steel coil count real labeled data.
6. The method according to claim 5, characterized in that The determining the loss value according to the default loss function, the steel coil count prediction result and the steel coil count real labeling data includes: Initializing the default loss function to determine a target loss function; According to the target loss function, using the steel coil count prediction result and the steel coil count real annotation data, the real box and the predicted box in the detection algorithm framework are calculated for attraction loss, repulsion loss and smoothing loss to determine the loss value.
7. The method according to claim 1, characterized in that The target detection algorithm is configured in the target detection model; the target frame position data is determined according to the target detection algorithm and the steel coil monitoring image, including: The steel coil monitoring image is input into the target detection model to output target frame position data.
8. A steel coil detection device in an obstructed scene, characterized in that: include: An image acquisition module, used to acquire a real-time monitoring image of the steel coil of the obstruction scene; An algorithm setting module, used to set a target detection algorithm according to a preset improvement method and a preset default detection algorithm; A position determination module, used to determine the target frame position data according to the target detection algorithm and the steel coil monitoring image; The quantity determination module is used to determine the quantity of the steel coils according to the target frame position data.
9. An electronic device, characterized in that: include: processor; A memory storing a computer program, which, when executed by the processor, enables the processor to execute the steel coil detection method in an occlusion scenario as described in any one of claims 1 to 7.
10. A non-transitory computer-readable storage medium, characterized in that: Computer-readable instructions are stored thereon, and when the instructions are executed by a processor, the processor executes the steel coil detection method in an occlusion scenario as described in any one of claims 1-7.
Citation Information
Cited By
Strip steel tail positioning method and device, electronic equipment, storage medium and coiling control system
CN120339401A