A Real-Time Coil Detection Method Based on Edge Computing
By acquiring multi-view images in real time on edge computing devices and performing validity verification and fusion processing, combined with the improved YOLOv8 model, the problem of insufficient image quality assessment in traditional coil detection methods is solved, achieving higher detection accuracy and reliability of inventory status analysis.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SHAO XING XIAN DIAN LI SHE BEI YOU XIAN GONG SI
- Filing Date
- 2026-04-27
- Publication Date
- 2026-05-26
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Traditional real-time coil detection methods suffer from problems such as perspective deviation, lighting changes, occlusion, and image blurring in complex warehouse environments, leading to a decrease in the accuracy of target detection model recognition. Furthermore, the lack of reliability verification and secondary validation of detection results can easily result in inaccurate statistical results.
By acquiring multi-view images in real time on edge computing devices, image validity verification and fusion processing are performed. The improved YOLOv8 model is used for detection, combined with KAZE feature extraction, density clustering and wavelet transform fusion algorithms, to output detection results and perform state anomaly judgment and quantity correction.
It improves the accuracy and reliability of coil detection, reduces the identification bias of the detection model, and enhances the accuracy of inventory status analysis and the real-time performance of the system.
Smart Images

Figure CN122089741A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of computer vision and edge computing technology, and in particular to a real-time coil detection method based on edge computing. Background Technology
[0002] With the continuous improvement of industrial automation and the rapid development of intelligent warehouse management systems, the demand for real-time monitoring and intelligent management of material storage status in production, manufacturing, and logistics warehousing is increasing. In power, cable manufacturing, communication equipment manufacturing, and large-scale industrial production processes, wire reels, as important carriers for cable storage and transportation, are typically stacked in batches in storage areas or production workshops. To ensure production continuity and warehouse scheduling efficiency, enterprises need to continuously monitor and statistically analyze the storage status, quantity changes, and inventory of wire reels.
[0003] In existing technologies, traditional real-time coil detection methods often involve deploying camera equipment in the storage area to collect images and combining them with target detection algorithms to identify and count the materials in the images. However, in practical applications, due to factors such as complex storage environments, dense coil stacking, and diverse shooting angles, the collected images often suffer from phenomena such as perspective deviation, lighting changes, occlusion, and image blurring. The lack of effective screening and evaluation of image quality can easily lead to a decrease in the accuracy of target detection models.
[0004] In addition, traditional real-time coil detection methods mainly focus on target identification itself, and pay insufficient attention to the reliability verification of detection results and inventory status analysis. When coils stick together, overlap or partially obscure each other, the detection model may produce quantity identification deviation. Traditional systems often lack a mechanism for secondary verification and correction of detection results, which can easily lead to inaccurate statistical results. Summary of the Invention
[0005] To address the shortcomings of traditional real-time coil detection methods in practical applications, which often suffer from issues such as viewing angle deviations, lighting variations, occlusion, and image blurring due to complex warehousing environments, dense coil stacking, and diverse shooting angles, and lack of effective image quality screening and evaluation, leading to decreased accuracy of target detection models, and because these methods primarily focus on target recognition while neglecting reliability verification and inventory status analysis, the detection model may produce quantity recognition errors when coils adhere, overlap, or partially occlude. Furthermore, traditional systems often lack mechanisms for secondary verification and correction of detection results, resulting in inaccurate statistical results. Therefore, this invention provides a real-time coil detection method based on edge computing.
[0006] The technical solution provided by this invention is as follows: S1: Real-time acquisition of multiple images of the reel storage area from different perspectives; S2: Verify the validity of the images stored in each reel; S3: Perform image fusion processing on the images of the storage areas of each verified reel to obtain a fused image of the reel storage area; S4: Transmit the image of the fusion line disk storage area to the edge computing device; S5: By using a coil detection model pre-deployed on an edge computing device, the image of the fused coil storage area is detected, and the detection results including the coil detection box, coil position coordinates, and number of coils are output. S6: Based on the detection results, determine the abnormal state of the coil region in the image of the fused coil storage area; if the abnormal state of the coil is determined, correct the number of coils and output the corrected detection result; otherwise, output the detection result.
[0007] The beneficial effects of the technical solution provided by this invention include: In this embodiment of the invention, multiple images of the coil storage area from different perspectives are acquired in real time, and the validity of each image is verified. This avoids the problems of perspective deviation, lighting changes, occlusion, and image blurring that often occur in actual applications. It enables effective screening and evaluation of image quality, making it less likely to cause a decrease in the accuracy of the target detection model. Based on the detection results, the coil area in the fused coil storage area image is judged to be in an abnormal state. While focusing on target recognition itself, the reliability verification of the detection results and inventory status analysis are also considered. When coils stick together, overlap, or partially occlude, the deviation in quantity recognition generated by the detection model is reduced. It has a mechanism for secondary verification and correction of the detection results, improving the accuracy of the statistical results. Attached Figure Description
[0008] Figure 1 A flowchart illustrating a real-time coil detection method based on edge computing provided in an embodiment of the present invention; Figure 2 This is a schematic diagram of the structure of an improved YOLOv8 model provided in an embodiment of the present invention; Figure 3 This is a schematic diagram of the structure of an enhanced lightweight spatial pyramid pooling module provided in an embodiment of the present invention; Figure 4 This is a schematic diagram of the structure of a lightweight multi-scale feature fusion module provided in an embodiment of the present invention; Figure 5 This is a schematic diagram of a real-time coil detection system based on edge computing, provided in an embodiment of the present invention. Detailed Implementation
[0009] Reference manual attached Figure 1 The diagram shows a flowchart of a real-time coil detection method based on edge computing provided by an embodiment of the present invention.
[0010] This invention provides a real-time coil detection method based on edge computing, the method comprising: S1: Real-time acquisition of multiple images of the reel storage area from different perspectives.
[0011] Specifically, multiple image acquisition devices are deployed around the coil storage area in the production or storage area, and these devices are installed according to different observation angles so that the field of view of each image acquisition device can cover different sides or different heights of the coil storage area. During system operation, the image acquisition devices synchronously or quasi-synchronously acquire images of the coil storage area according to a preset acquisition cycle, thereby obtaining multiple images of the coil storage area from different perspectives in real time. These multiple images of the coil storage area are then used as input data for subsequent image validity verification, image fusion, and coil detection processing.
[0012] In one possible implementation, after S1 and before S2, step S1A is further included: S1A: Perform image preprocessing on the images of the storage areas of each reel. Image preprocessing includes image size normalization, image brightness equalization, and image noise suppression.
[0013] It should be noted that image size normalization, image brightness equalization, and image noise suppression are all mature existing technologies, and will not be elaborated upon here.
[0014] S2: Verify the validity of the images stored in each reel.
[0015] In one possible implementation, S2 specifically includes sub-steps S201 to S206: S201: Using the image of the coil storage area as the image to be verified, perform KAZE feature extraction on the image to be verified and the pre-constructed template image of the coil area to obtain the set of feature points of the image to be verified, the set of descriptors of the image to be verified, the set of feature points of the template image, and the set of descriptors of the template image.
[0016] Specifically, the image of the storage area of the wire reel is used as the image to be verified, and grayscale processing and scale space construction processing are performed on the image and the pre-constructed template image of the wire reel area respectively. Multi-scale representation is established in the image to be verified and the template image based on nonlinear diffusion filtering. Stable key points are detected in each scale space as feature points through the KAZE feature extraction algorithm, and corresponding feature descriptors are constructed based on the gradient distribution information of the neighborhood of the key points. Thus, the set of feature points of the image to be verified and its corresponding set of descriptors of the image to be verified, as well as the set of feature points of the template image and its corresponding set of descriptors of the template image are obtained, so as to provide basic data for subsequent feature matching and geometric relationship estimation.
[0017] It should be noted that the KAZE feature extraction algorithm is an image feature detection and description method based on a nonlinear scale space. It smooths the image at different scales through nonlinear diffusion filtering, thereby suppressing noise while preserving the image's edge structure information. Stable keypoints are detected as feature points in the constructed multi-scale representation. Subsequently, feature descriptors with scale invariance and a certain degree of rotation invariance are constructed based on the gradient distribution information of the keypoint neighborhood to characterize the local structural features of the image. This enables stable extraction of image features under different viewpoints, scale changes, and illumination variations, and is widely used in visual tasks such as image matching, object recognition, and geometric relationship estimation.
[0018] S202: The template feature point set is clustered using a density-based clustering algorithm to obtain multiple template feature clusters, and the template image descriptor subset corresponding to each template feature cluster is extracted as the template feature descriptor subset.
[0019] It should be noted that the density-based clustering algorithm DBSCAN (Density-Based Spatial Clustering of Applications with Noise) is an unsupervised learning method that clusters samples based on their distribution density in the feature space. By setting neighborhood radius and minimum sample number parameters, it identifies samples with a sufficient number of neighboring points within a given neighborhood as core points. Based on these core points, it continuously expands to form a sample set with achievable density, thus constructing multiple feature clusters with spatial connectivity. Simultaneously, isolated samples that do not meet the density condition are identified as noise points. This algorithm does not require pre-setting the number of clusters, can effectively discover cluster structures of arbitrary shapes, and has good noise robustness. It is suitable for spatially partitioning template feature point sets to obtain template feature clusters with structural consistency.
[0020] Specifically, each feature point in the template image feature point set is used as input data according to its spatial coordinates in the template image. A density-based clustering algorithm is used to spatially cluster the feature points. By calculating the neighborhood distance between feature points and determining the density connectivity based on the preset neighborhood radius and minimum number of sample points, feature points that are spatially close and have relatively high density are grouped into the same feature cluster, thus obtaining multiple template feature clusters. Subsequently, based on the feature point index contained in each template feature cluster, descriptor data matching the corresponding feature points is extracted from the template image descriptor subset, and these descriptor subsets are used to construct the template feature descriptor subsets corresponding to each template feature cluster for subsequent feature matching and target region localization.
[0021] S203: Perform nearest neighbor matching between the image descriptor subset to be verified and the template feature descriptor subset to obtain the matching descriptor subset, and extract the set of image feature points corresponding to the matching descriptor subset as the matching feature point set.
[0022] Specifically, each descriptor in the image descriptor set to be verified is used as a query vector, and each descriptor in the template feature descriptor set is used as a candidate vector. The similarity distance between the query descriptor and the candidate descriptors is calculated using a nearest neighbor matching method based on a distance metric, where Euclidean distance or Hamming distance can be used as the matching metric. Then, for each query descriptor, the template descriptor with the smallest distance is selected as its nearest neighbor matching result. The matching results are then filtered using a distance ratio constraint or a matching threshold to remove matching pairs with low similarity or ambiguity, thus obtaining a set of matched descriptors. After obtaining the set of matched descriptors, the corresponding feature points in the image to be verified are extracted based on the correspondence between descriptors and feature points, and a set of matched feature points is constructed for subsequent feature cluster matching and geometric relationship calculation.
[0023] S204: Cluster the set of matching feature points using a density-based clustering algorithm to obtain multiple matching feature clusters, and construct a set of feature point pairs based on the correspondence between feature points in the template feature cluster and feature points in the matching feature cluster.
[0024] Specifically, the spatial coordinates of each feature point in the matching feature point set are used as input data. A density-based clustering algorithm is employed to spatially cluster the matching feature points. By calculating the neighborhood distance between feature points and determining the density connectivity based on a preset neighborhood radius and minimum sample size, matching feature points that are spatially close and have density connectivity are grouped into the same matching feature cluster, thus obtaining multiple matching feature clusters. Subsequently, based on the descriptor correspondence established in the matching descriptor set, feature points in the template feature cluster are associated and matched with corresponding feature points in the matching feature cluster. The coordinate information of each corresponding feature point in the template image and the image to be verified is extracted, constructing a one-to-one correspondence between template feature points and matching feature points, thereby forming a feature point pair set for subsequent homography matrix calculation and target region projection.
[0025] S205: Calculate the homography matrix based on the set of feature point pairs, and project the corner points of the template image of the coil region onto the image to be verified based on the homography matrix to generate the projection box of the coil region.
[0026] Specifically, based on the correspondence between the coordinates of feature points in the template image and the coordinates of matching feature points in the image to be verified, two sets of corresponding point coordinate matrices are constructed. A homography matrix estimation algorithm based on Random Sample Consensus (RANSAC) is then used to iteratively solve for the corresponding points. By eliminating mismatched points, a stable geometric transformation model is obtained, thereby calculating the homography matrix between the template image plane and the image to be verified. Subsequently, the coordinates of the four pre-labeled corner points in the template image of the coil region are transformed using the homography matrix and mapped to the coordinate system of the image to be verified. The corresponding target region boundary is then constructed based on the mapped corner point positions, thus generating a projection box for the coil region to determine its spatial location in the image to be verified.
[0027] S206: Based on feature matching quality, feature cluster correspondence integrity, reprojection error, and the geometric rationality of the projection box, calculate the image validity score and determine whether the image validity score is greater than or equal to the preset image validity score. If so, the verification is successful, and the image to be verified is determined to be a valid image. Otherwise, the verification is deemed to have failed, and the image to be verified is determined to be an invalid image.
[0028] It should be noted that the image validity score refers to the evaluation value obtained by comprehensively calculating multiple indicators such as feature matching quality, feature structure integrity, geometric transformation consistency, and target area projection box rationality for each acquired image of the coil storage area. It is used to reflect whether the image has reliable target recognition and detection conditions.
[0029] It should be noted that those skilled in the art can set the preset image validity score according to actual needs, and this invention does not limit this.
[0030] Specifically, a feature matching quality score is calculated based on the ratio of the number of matching feature points in the matching descriptor subset to the total number of template feature points, reflecting the degree of feature similarity between the image to be verified and the template image. A feature cluster correspondence integrity score is calculated based on the ratio of the number of successfully established matching feature clusters to the total number of template feature clusters, characterizing the completeness of the target structure in the image to be verified. The average reprojection error between the predicted position of the template feature points after projection through the homography matrix and the actual matching feature points is calculated based on the feature point pair set, and a reprojection error score is obtained to characterize the consistency and accuracy of the geometric transformation. A projection frame geometric rationality score is calculated based on factors such as whether the projection frame of the coil region is within the image boundary, the difference between the aspect ratio of the projection frame and the template aspect ratio, the area ratio of the projection frame, and the regularity of the projection frame shape. After obtaining the above scores, the image validity score is obtained by weighted summing of the feature matching quality score, the feature cluster correspondence integrity score, the reprojection error score, and the projection frame geometric rationality score.
[0031] Optionally, the formula for calculating the image validity score is as follows: ; in, Indicates the image validity score. This represents the weighting coefficients of the feature matching quality score. This represents the feature matching quality score. The weight coefficients representing the completeness of the feature cluster correspondence. Indicates the completeness of the feature cluster correspondence. This represents the weighting coefficient for the reprojection error score. This indicates the reprojection error score. The weighting coefficients representing the geometric rationality score of the projection frame. This indicates the score for the geometric rationality of the projection frame. This indicates the number of matching feature point pairs in the matching descriptor subset. This represents the total number of feature points in the feature point set of the template image. This represents the number of matching feature clusters that successfully established a correspondence. This represents the total number of template feature clusters. This indicates taking the maximum value. This represents the reprojection error penalty coefficient. This represents the average reprojection error. This indicates the number of feature point pairs in the feature point pair set. Indicates the first in the image to be verified i Coordinates of matching feature points, Represents the homography matrix. The first element in the template image representing the coil region i Coordinates of feature points The weighting coefficients representing the boundary compliance score. Indicates the boundary compliance score. This represents the weighting coefficient for the aspect ratio rationality score. This indicates the score for the reasonableness of the aspect ratio. The weighting coefficients representing the area reasonableness score. The score indicates the reasonableness of the area. The weighting coefficients representing the shape regularity score. Indicates the score for shape regularity. This represents the aspect ratio difference penalty coefficient. This indicates the degree of difference between the aspect ratio of the projection frame and the aspect ratio of the template image. Represents the logarithmic function. This indicates the aspect ratio of the projection frame of the coil area. This represents the aspect ratio of the template image for the wire coil region. The boundary compliance score evaluates whether the generated wire coil region projection frame is within the valid boundary range of the image to be verified, avoiding situations where the projection frame exceeds the boundary or the target region is missing. The aspect ratio reasonableness score characterizes the degree of difference between the aspect ratio of the projection frame and the aspect ratio of the wire coil region template image, determining whether the target region has undergone significant deformation after geometric transformation. The area reasonableness score evaluates whether the proportional relationship between the area of the projection frame and the overall area of the image to be verified is within a reasonable range, avoiding mismatches caused by projection frames that are too large or too small. The shape regularity score evaluates whether the geometric shape of the projection frame approximates a regular rectangle or convex polygon structure, thus reflecting the shape stability and geometric consistency of the projection frame after homography transformation.
[0032] It should be noted that the image validity score is calculated by weighting and fusing four evaluation indicators: feature matching quality, feature cluster correspondence integrity, geometric transformation consistency, and the geometric rationality of the target region's projection frame. Specifically, the feature matching quality score is calculated by the ratio of the number of matched feature points to the total number of template feature points, reflecting the degree of feature similarity between the image to be verified and the template image. The feature cluster correspondence integrity score is calculated by the ratio of the number of successfully corresponding matched feature clusters to the total number of template feature clusters, characterizing the completeness of the target structure in the image to be verified. The reprojection error score is obtained by calculating the average reprojection error between the predicted position of the template feature points after homography matrix mapping and the actual matched feature points, evaluating the stability and accuracy of the geometric transformation model. Simultaneously, the geometric rationality score of the projection frame is calculated by combining factors such as the compliance of the projection frame boundary, the rationality of the aspect ratio, the area ratio, and the regularity of the shape, thus comprehensively reflecting the spatial location, structural integrity, and geometric consistency of the coil region in the image to be verified. By constructing an image validity score through the above-mentioned multi-index weighted fusion method, the image quality can be comprehensively evaluated from multiple dimensions such as feature matching reliability, structural integrity, and geometric mapping stability. This effectively filters out invalid images with problems such as blurring, occlusion, viewpoint deviation, or abnormal lighting, improves the image data quality entering the subsequent image fusion and target detection stages, and thus enhances the recognition accuracy and system operation stability of the coil detection model.
[0033] It should be noted that those skilled in the art can set it according to actual needs. , , as well as The size is not limited in this invention.
[0034] In this embodiment of the invention, by sequentially performing KAZE feature extraction, feature point density clustering, descriptor nearest neighbor matching, matching feature cluster association, homography matrix estimation, and image validity score calculation on the acquired image of the coil storage area, the image quality can be systematically verified from multiple levels, including feature structure, spatial distribution, and geometric consistency. Specifically, KAZE feature extraction can obtain stable feature points with scale and rotation invariance in multi-scale space, thereby improving the stability of feature descriptions between images from different viewpoints. Spatial clustering of template feature points and matching feature points using a density-based clustering algorithm can effectively identify feature regions with structural correlations, improving the robustness of target structure recognition. Through descriptor nearest neighbor matching and matching feature point pair construction, a reliable correspondence between the template image and the image to be verified can be established. Estimating the homography matrix using the RANSAC algorithm and generating the coil region projection box can further verify the spatial geometric consistency of the target region. Finally, an image validity score is calculated by considering multiple indicators, including feature matching quality, feature cluster correspondence completeness, reprojection error, and geometric rationality of the projection frame. This score is then compared with a preset threshold to pre-filter invalid images with issues such as blurriness, occlusion, viewpoint deviation, or missing targets before they enter subsequent image fusion and coil detection. This processing method ensures high-quality input images for image fusion and target detection, improving the recognition accuracy and operational stability of the coil detection model on edge computing devices. It also reduces the computational cost and false detection risks associated with invalid images, thereby enhancing the overall reliability of coil quantity statistics and inventory anomaly detection.
[0035] S3: Perform image fusion processing on the images of the storage areas of each verified reel to obtain a fused image of the storage areas of the reel.
[0036] In one possible implementation, S3 specifically refers to: The wavelet transform fusion algorithm is used to perform image fusion processing on the images of the storage areas of each verified reel, resulting in a fused image of the reel storage area.
[0037] It should be noted that wavelet transform fusion algorithm is an image fusion method based on multi-scale signal decomposition and reconstruction. Its basic principle is to use wavelet transform to decompose the input image into sub-band coefficients of different scales and frequencies. The low-frequency sub-band mainly contains the overall contour and brightness information of the image, while the high-frequency sub-band mainly contains edge, texture, and detail information. Subsequently, according to preset fusion rules, the corresponding sub-band coefficients from images from different viewpoints are selected or weighted to retain high-quality feature components in each image. Finally, the fused sub-band coefficients are reconstructed using inverse wavelet transform, thereby generating a fused image containing information from multiple sources. By employing the wavelet transform fusion algorithm, the edge details and texture features of the target region can be effectively enhanced while maintaining the overall structural information of the image, improving the information integrity and clarity of the fused image, and providing a more stable and reliable image input for subsequent coil detection and state analysis. The wavelet transform fusion algorithm is a mature existing technology, and will not be elaborated further in this invention.
[0038] S4: Transmit the image of the fusion line disk storage area to the edge computing device.
[0039] S5: By using a coil detection model pre-deployed on an edge computing device, the image of the fused coil storage area is detected, and the detection results including the coil detection box, coil position coordinates, and number of coils are output.
[0040] It should be noted that the input of the coil detection model is the image of the fused coil storage area, and the output is the detection result including the coil detection box, coil position coordinates, and the number of coils.
[0041] In this embodiment of the invention, by transmitting the image of the fused reel storage area to an edge computing device and utilizing a reel detection model pre-deployed on the edge computing device to perform real-time detection on the fused image, target recognition and quantity statistics can be completed near the data source. This reduces network latency and bandwidth consumption caused by transmitting image data to the cloud server, improving the overall system response speed and processing efficiency. Simultaneously, by directly executing the reel detection model on the edge computing device, the reel detection frame, reel position coordinates, and reel quantity can be quickly output. This allows the system to obtain real-time status information of the reel storage area, providing a timely and reliable data foundation for subsequent reel status anomaly judgment and inventory anomaly early warning, thereby improving the real-time performance, stability, and operational reliability of the entire reel monitoring system.
[0042] Reference manual attached Figure 2 The diagram shows a structural schematic of an improved YOLOv8 model provided in an embodiment of the present invention.
[0043] Reference manual attached Figure 3The diagram shows a structural schematic of an enhanced lightweight spatial pyramid pooling module provided in an embodiment of the present invention.
[0044] Reference manual attached Figure 4 The diagram shows a structural schematic of a lightweight multi-scale feature fusion module provided in an embodiment of the present invention.
[0045] It should be noted that the instruction manual includes... Figures 2 to 4 In this diagram, Backbone represents the improved backbone network, Input represents the input layer, Conv represents the convolutional module, C2f represents the C2F module, E-LSPPM represents the enhanced lightweight spatial pyramid pooling module, Neck represents the improved neck network, Upsample represents the upsampling layer, Concat represents the feature concatenation layer, LMSFFM represents the lightweight multi-scale feature fusion module, Head represents the improved detection head network, DBBHead represents the parameterized detection head, LMSConvBlock represents the lightweight multi-scale convolutional block, and MaxPool represents the maximum pooling layer. 2d represents a two-dimensional max pooling layer, EMA represents a multi-scale spatial attention mechanism layer, Output represents the output, LMSConv2d represents a lightweight multi-scale two-dimensional convolutional module, BatchNorm2d represents a two-dimensional batch normalization layer, 3×3Conv2d represents a 3×3 two-dimensional convolutional layer, 5×5Conv2d represents a 5×5 two-dimensional convolutional layer, ⊕ represents an element-wise addition layer, 1×1Conv2d represents a 1×1 two-dimensional convolutional layer, Split represents a split layer (feature segmentation layer), and LMSResBottle represents a lightweight multi-scale residual bottleneck module.
[0046] It should be noted that EMA comprehensively models the response information of input features at different spatial scales, calculates the importance weights of each spatial location, and performs weighted adjustments to the feature map. This enhances the feature representation ability of key regions, suppresses irrelevant background information, and enables the network to focus more on spatial locations that are significant for defect identification. EMA is a mature existing technology, and will not be elaborated upon here.
[0047] Optionally, the coil detection model is specifically the improved YOLOv8 model.
[0048] In one possible implementation, the construction of the improved YOLOv8 model specifically includes: The fast spatial pyramid pooling module of the backbone network in the original YOLOv8 model is replaced with an enhanced lightweight spatial pyramid pooling module to construct an improved backbone network.
[0049] The improved backbone network includes: a first convolutional module, a second convolutional module, a first C2f module, a third convolutional module, a second C2f module, a fourth convolutional module, a third C2f module, a fifth convolutional module, a fourth C2f module, and an enhanced lightweight spatial pyramid pooling module, all connected in sequence.
[0050] Furthermore, the enhanced lightweight spatial pyramid pooling module specifically includes: a first lightweight multi-scale convolutional block, a first two-dimensional max pooling layer, a second two-dimensional max pooling layer, a third two-dimensional max pooling layer, a seventh feature splicing layer, a second lightweight multi-scale convolutional block, and a multi-scale spatial attention mechanism layer connected in sequence. The first two-dimensional max pooling layer and the second two-dimensional max pooling layer are respectively connected to the seventh feature splicing layer.
[0051] Furthermore, the lightweight multi-scale convolutional block specifically includes: a first lightweight multi-scale two-dimensional convolutional module, a two-dimensional batch normalization layer, and a second lightweight multi-scale two-dimensional convolutional module connected in sequence.
[0052] Furthermore, the lightweight multi-scale 2D convolutional module specifically includes: a first sub-channel branch, a second sub-channel branch containing a 3×3 2D convolutional layer, a third sub-channel branch, a fourth sub-channel branch containing a 5×5 2D convolutional layer, a first element-wise addition layer, and a 1×1 2D convolutional layer. Specifically, the lightweight multi-scale 2D convolutional module splits the input feature map along the channel dimension into four independent sub-channels in a manner that "equally divides the total number of channels," and assigns each of the four sub-channels to one of the four branches. The first and third sub-channel branches are direct branches to directly preserve the original features and avoid loss of shallow details. The second sub-channel branch extracts mid-scale spatial features through a 3×3 2D convolutional layer, and the fourth sub-channel branch extracts large-scale spatial features through a 5×5 2D convolutional layer. The output features of the four branches are then fed into an element-wise addition layer for initial aggregation, and finally, a 1×1 2D convolutional layer integrates and unifies the dimensions of the aggregated multi-source features.
[0053] In this embodiment of the invention, the constructed improved backbone network, by introducing an enhanced lightweight spatial pyramid pooling module and a lightweight multi-scale convolutional structure, is beneficial to improving the feature representation capability and detection stability in the coil detection task. Specifically, by introducing an enhanced lightweight spatial pyramid pooling module at the end of the backbone network, multi-level two-dimensional max pooling layers are used to extract spatial information from different receptive fields. Key region features are enhanced through feature concatenation and a multi-scale spatial attention mechanism, thereby enhancing the model's ability to perceive coil targets at different scales and improving the detection performance of distant, small-scale, or partially occluded coils. Simultaneously, the lightweight multi-scale two-dimensional convolutional module constructs multiple parallel branches through channel splitting. The direct-pass branch preserves original detailed information, the 3×3 convolutional branch extracts mid-scale structural features, and the 5×5 convolutional branch extracts large-scale spatial features. Feature fusion and dimensionality unification are then achieved through element-wise addition and 1×1 convolution, effectively fusing multi-scale information while reducing computational complexity. Therefore, this improved backbone network can not only enhance the feature representation ability of wire reels in complex warehousing environments, improve detection accuracy and robustness, but also maintain low computational overhead in edge computing device deployment scenarios, thereby achieving real-time and stable wire reel detection.
[0054] Multiple convolutional modules are added between the neck network and the backbone network of the original YOLOv8 model. An additional upsampling layer, multiple feature concatenation layers, multiple C2f modules, and one convolutional module are added to the neck network. All C2f modules in the neck network are replaced with lightweight multi-scale feature fusion modules to construct an improved neck network.
[0055] The improved neck network comprises, in sequence: a first upsampling layer, a first feature concatenation layer, a first lightweight multi-scale feature fusion module, a second upsampling layer, a second feature concatenation layer, a second lightweight multi-scale feature fusion module, a third upsampling layer, a third feature concatenation layer, a third lightweight multi-scale feature fusion module, a sixth convolutional module, a fourth feature concatenation layer, a fourth lightweight multi-scale feature fusion module, a seventh convolutional module, a fifth feature concatenation layer, a fifth lightweight multi-scale feature fusion module, an eighth convolutional module, a sixth feature concatenation layer, and a sixth lightweight multi-scale feature fusion module. The first upsampling layer... The layer is also connected to the enhanced lightweight spatial pyramid pooling module through the ninth convolution module. The ninth convolution module is also connected to the sixth feature splicing layer. The first feature splicing layer is also connected to the third C2f module through the tenth convolution module. The tenth convolution module and the first lightweight multi-scale feature fusion module are also connected to the fifth feature splicing layer. The second feature splicing layer is also connected to the second C2f module through the eleventh convolution module. The eleventh convolution module and the second lightweight multi-scale feature fusion module are also connected to the fourth feature splicing layer. The third feature splicing layer is also connected to the first C2f module through the twelfth convolution module.
[0056] Furthermore, the lightweight multi-scale feature fusion module specifically includes: a third lightweight multi-scale convolutional block, a Split layer, a first lightweight multi-scale residual bottleneck module, a second lightweight multi-scale residual bottleneck module, an eighth feature splicing layer, and a fourth lightweight multi-scale convolutional block connected in sequence.
[0057] Furthermore, the lightweight multi-scale residual bottleneck module specifically includes: a fifth lightweight multi-scale convolutional block, a sixth lightweight multi-scale convolutional block, and a second element-wise addition layer connected in sequence. Through residual connection, the input feature map of the fifth lightweight multi-scale convolutional block and the output feature map of the sixth lightweight multi-scale convolutional block are fused element-wise in the second element-wise addition layer.
[0058] In this embodiment of the invention, constructing the improved neck network enhances the model's ability to fuse multi-scale features of coil targets and adapt to complex scenes, thereby improving the accuracy and stability of coil detection. Specifically, by adding multiple convolutional modules between the backbone network and the neck network, and introducing additional upsampling layers and multi-level feature concatenation structures in the neck network, feature information from different levels can interact and fuse across layers over a wider range, thereby enhancing the model's ability to represent coil targets at different scales and improving the recognition effect for distant, small-scale, or partially occluded coils. Simultaneously, the original C2f module is replaced with a lightweight multi-scale feature fusion module, enabling the feature fusion process to extract spatial information from different receptive fields through multi-scale convolutional structures. Furthermore, the split structure and residual bottleneck module achieve feature branching and progressive fusion, improving the richness of feature representation while preserving key details. In addition, the lightweight multi-scale residual bottleneck module achieves element-wise addition and fusion of input features and deep features through residual connections, helping to alleviate the gradient vanishing problem during deep network training and improving feature transfer efficiency. Therefore, the improved neck network can more effectively integrate multi-scale spatial features in complex warehousing environments, improve the model's ability to perceive the edge structure, morphological features and local details of the coil target, and achieve more stable detection performance while maintaining low computational complexity, thus making it more suitable for real-time coil detection tasks on edge computing devices.
[0059] An improved detector head network is constructed by adding a detector head to the detector head network of the original YOLOv8 model and replacing all detector heads in the original detector head network with reparameterized detector heads.
[0060] The improved detector head network includes: a first-level parameterized detector head, a second-level parameterized detector head, a third-level parameterized detector head, and a fourth-level parameterized detector head. The first-level parameterized detector head is connected to the third lightweight multi-scale feature fusion module, the second-level parameterized detector head is connected to the fourth lightweight multi-scale feature fusion module, the third-level parameterized detector head is connected to the fifth lightweight multi-scale feature fusion module, and the fourth-level parameterized detector head is connected to the sixth lightweight multi-scale feature fusion module.
[0061] It should be noted that reparameterized detection heads are already a mature existing technology, and will not be described in detail here.
[0062] In this embodiment of the invention, constructing the improved detection head network enhances the model's ability to detect coil targets at different scales and improves the accuracy and real-time performance of the detection results. Specifically, by adding a new detection head to the original YOLOv8 detection head network, the network can simultaneously predict information from feature maps at different levels, thereby enhancing the model's ability to detect coil targets at multiple scales, especially improving the recognition effect of small-scale or distant coil targets. Simultaneously, replacing the original detection head with a reparameterized detection head allows the network to enhance feature representation capabilities through a multi-branch structure during training, and to convert the multi-branch structure into a single convolutional structure through structural reparameterization during inference, thus improving the model's expressive power and inference efficiency without increasing inference computational complexity. Furthermore, the multiparameterized detection head is connected to lightweight multi-scale feature fusion modules at different levels, ensuring that features at each scale are fully utilized during the detection stage, thereby improving the model's ability to recognize coil edge structures, contour features, and local details. Therefore, this improved detection head network can not only improve the accuracy and robustness of coil detection, but also maintain a high inference speed in edge computing device deployment scenarios, achieving real-time and stable coil detection.
[0063] An improved YOLOv8 model is constructed based on an improved backbone network, an improved neck network, and an improved detection head network.
[0064] S6: Based on the detection results, determine the state anomaly of the coil region in the fused coil storage area image. If an anomaly is detected, correct the number of coils and output the corrected detection result. Otherwise, output the original detection result.
[0065] In one possible implementation, S6 specifically includes sub-steps S601 to S607: S601: Based on the detection frame and position coordinates of the coil, crop the candidate region image of the coil from the image of the fused coil storage area, and expand the boundary of the candidate region image of the coil according to a preset expansion ratio to obtain the image of the coil region to be determined.
[0066] It should be noted that those skilled in the art can set the size of the preset expansion ratio according to actual needs, and this invention does not limit it.
[0067] Specifically, based on the coordinate information of the coil detection box output by the coil detection model and the corresponding coordinates of the coil center position, the image region corresponding to the coil detection box is extracted from the fused coil storage area image as the coil candidate region image. The coil detection box is typically determined by the coordinates of the top left corner, width, and height, or by the coordinates of the four vertices. By cropping the pixels within the detection box, an initial region containing the main structure of the coil is obtained. Subsequently, to avoid affecting subsequent state determination due to detection box positioning errors or truncation of the coil edges, the detection box boundary is expanded outwards around the candidate region image according to a preset expansion ratio. That is, the horizontal and vertical expansion distances are calculated based on the width and height of the detection box, and the upper, lower, left, and right boundaries of the detection box are expanded proportionally without exceeding the boundaries of the fused coil storage area image. This results in a coil region image containing the complete outline of the coil and its neighborhood information, providing a more complete and stable image input for subsequent pose normalization, template alignment, and state anomaly determination.
[0068] S602: Extract feature points from the image of the coil region to be judged, perform feature matching with the pre-constructed template image of the coil region to obtain matching feature point pairs, and calculate the rotation angle and scale change coefficient of the image of the coil region to be judged relative to the template image of the coil region based on the matching feature point pairs.
[0069] Specifically, feature point extraction is performed on both the image of the coil region to be judged and the pre-constructed template image of the coil region. Scale-invariant feature transform (SIFT), KAZE, or other feature extraction algorithms with scale and rotation invariance can be used to extract the set of feature points to be matched and their corresponding feature descriptors from the image of the coil region to be judged, and to extract the set of template feature points and their feature descriptors from the template image of the coil region. Subsequently, the feature descriptors of the two images are matched using nearest neighbor search or distance-based matching methods, and unreliable matching points are filtered out using distance ratio filtering or mismatch elimination strategies, thereby obtaining a set of matched feature point pairs. Based on this, the rotation angle and scale change coefficient between the two images are estimated according to the geometric relationship between the matched feature point pairs. The rotation angle can be calculated based on the direction difference between the corresponding feature point pairs, and the scale change coefficient can be estimated based on the distance ratio between the matched feature point pairs. This determines the rotation and scale changes of the image of the coil region to be judged relative to the template image of the coil region, providing a basis for subsequent image pose correction and scale normalization processing.
[0070] S603: Based on the rotation angle and scale change coefficient, perform rotation correction and scale normalization processing on the image of the coil region to be judged to obtain a normalized coil region image.
[0071] Specifically, based on the rotation angle and scale variation coefficient calculated from the matching feature points, a corresponding geometric transformation model is constructed for the image of the coil region to be judged. The center point of the image of the coil region to be judged is used as the reference center for rotation and scaling transformations. The image is inversely rotated according to the rotation angle to eliminate directional deviations caused by the shooting angle or the coil's placement. Simultaneously, the image is scaled proportionally according to the scale variation coefficient to ensure that the size of the image of the coil region to be judged is consistent with the template image of the coil region. After completing the rotation and scale adjustment, the transformed image undergoes interpolation and resampling to obtain a normalized coil region image with unified geometric structure and scale. This ensures that coil images obtained under different shooting conditions maintain consistency in spatial pose and size, providing a unified image reference basis for subsequent template alignment, similarity calculation, and anomaly detection.
[0072] S604: Calculate the homography matrix based on the matching feature point pairs, and map the template image of the coil region to the normalized coil region image based on the homography matrix to obtain the template-aligned region image.
[0073] Specifically, based on the matching feature point pairs between the image of the coil region to be judged and the template image of the coil region, a corresponding set of feature point coordinates is constructed. A homography matrix between the two images is then calculated using a least-squares estimation or Random Sample Consensus (RANSAC) algorithm to describe the perspective transformation relationship between the template image plane and the normalized coil region image plane. The homography matrix is used to establish the mapping relationship between the pixel coordinates of the template image and the pixel coordinates of the normalized coil region image. After obtaining the homography matrix, each pixel in the template image of the coil region is transformed using the homography matrix, and the transformed template image is projected onto the corresponding position region of the normalized coil region image. This results in a template-aligned region image that maintains spatial structural consistency with the normalized coil region image, ensuring precise geometric alignment between the template image and the coil image to be detected. This provides a unified reference benchmark for subsequent similarity calculations and difference analysis.
[0074] S605: Based on the image information between the normalized line disk region image and the template aligned region image, calculate the structural similarity index, peak signal-to-noise ratio index, and mean square error index, and calculate the comprehensive similarity score based on the structural similarity index, peak signal-to-noise ratio index, and mean square error index.
[0075] Specifically, after obtaining the normalized image of the line disk region and the template-aligned region image, pixel-level correspondence analysis is first performed on the two images. The structural similarity index (SSIM) is calculated based on the distribution relationship of brightness, contrast, and structural information between the two images to reflect the degree of consistency in the overall structure. Subsequently, the peak signal-to-noise ratio (PSNR) is calculated based on the signal intensity and noise differences between the two images to measure the image reconstruction quality. Simultaneously, the mean squared error (MSE) is calculated by statistically analyzing the squared differences between corresponding pixels in the two images to characterize the degree of pixel difference between the images. After obtaining the structural similarity index, peak signal-to-noise ratio, and mean squared error index, the three indices are normalized and weighted according to preset weights to calculate a comprehensive similarity score. The comprehensive similarity score is as follows: ; in, This represents the overall similarity score. The weighting coefficients representing the structural similarity index This represents the structural similarity index after normalization. The weighting coefficients for the peak signal-to-noise ratio (PSNR) metric are represented by... This represents the peak signal-to-noise ratio after normalization. The weighting coefficients represent the mean square error index. This represents the mean square error index after normalization, thereby providing a reliable basis for subsequent judgment of abnormal coil status by comprehensively evaluating the structural consistency and pixel difference between the normalized coil region image and the template aligned region image.
[0076] It should be noted that by simultaneously calculating the structural similarity index, peak signal-to-noise ratio (PSNR) index, and mean square error index (the calculation methods for these indices are mature existing technologies, and will not be elaborated upon here), and by normalizing and weighting these three indices, the similarity between the normalized coil region image and the template-aligned region image can be comprehensively evaluated from three different levels: structural feature consistency, image signal quality, and pixel difference. The structural similarity index primarily reflects the consistency of the two images in terms of overall structure, brightness, and contrast distribution, thereby determining whether the coil outline and texture structure remain stable. The PSNR index measures the ratio between image signal and noise, reflecting the overall image quality and clarity. The mean square error index characterizes the degree of detail deviation between the two images by statistically analyzing pixel-level differences. By integrating the above-mentioned evaluation indicators, the misjudgment problem that may occur in complex environments due to a single evaluation indicator can be avoided, making the image similarity evaluation more comprehensive and stable. This will more accurately reflect the true consistency between the current coil area and the standard template, providing a reliable basis for subsequent coil state anomaly judgment, and further improving the system's recognition robustness and detection accuracy under different lighting conditions, viewing angle changes, and partial occlusion conditions.
[0077] It should be noted that those skilled in the art can set it according to actual needs. , as well as The size is not limited in this invention.
[0078] S606: Calculate the difference image based on the pixel difference between the normalized line disk region image and the template aligned region image, and calculate the difference feature score based on the difference image.
[0079] Specifically, after the normalized line disk region image and the template alignment region image are spatially aligned, the pixel values at corresponding positions in the two images are calculated pixel-by-pixel to obtain a difference image. The difference value of each pixel in the difference image can be represented as: ; in, Indicates position Pixel difference value at that location, This indicates the location of the normalized line disk region image. Pixel value at that location, Indicates the position of the template alignment region image. The pixel values at each point are then analyzed. Subsequently, statistical analysis or thresholding is performed on the difference image to extract the difference response regions. A difference feature score is then calculated based on the overall distribution of the difference values; for example, it can be calculated based on the average intensity of the difference values. ; in, Indicates the score of the difference feature. This represents the total number of pixels involved in the calculation. This represents the maximum pixel difference value, used for normalization. The smaller the difference between the normalized coil region image and the template alignment region image, i.e., the lower the overall difference value, the higher the difference feature score. This characterizes the degree of difference between the current coil region and the standard coil structure, providing a basis for subsequent coil state anomaly determination.
[0080] It should be noted that by performing pixel-by-pixel difference calculations on the normalized coil region image and the template aligned region image, the local difference distribution of the two images after spatial structural alignment can be intuitively reflected. By constructing a difference image and performing statistical analysis on the difference values, the difference regions caused by factors such as missing coils, occlusion, overlap, or abnormal shapes can be effectively extracted from the images, thus forming a difference feature score that reflects the degree of structural change. This scoring method is based on the overall distribution of pixel differences. By normalizing the difference values, the smaller the difference between images, the higher the score, thus more accurately reflecting the consistency between the current coil region and the standard coil structure. In this way, local detail changes can be captured on the basis of structural similarity evaluation, enabling the system not only to identify overall structural consistency but also to respond sensitively to subtle structural differences. This improves the accuracy and reliability of coil state anomaly detection and provides a more intuitive and stable basis for subsequent coil anomaly state judgment.
[0081] S607: Calculate the coil status normality score based on the similarity comprehensive score and the difference feature score, and determine whether the coil status normality score is less than the preset coil status normality score. If so, determine that there is an abnormal coil status, correct the number of coils, and output the corrected detection result. Otherwise, determine that there is no abnormal coil status and output the detection result.
[0082] It should be noted that those skilled in the art can set the preset coil status normality score according to actual needs, and this invention does not limit this.
[0083] Specifically, after obtaining the similarity score and the difference feature score, the two scores are weighted and fused to calculate the coil state normality score, which comprehensively represents the overall consistency and difference between the coil region and the standard template. Then, the coil state normality score is compared with a preset coil state anomaly threshold. When the coil state normality score is less than the preset threshold, it is determined that the current detection result may have coil adhesion, occlusion, overlap, or detection error, and the detection result is corrected. The correction process first parses the target detection tensor output by the detection model to obtain an initial set of detection boxes, and extracts the center coordinates and width and height parameters of each detection box. Then, the corresponding corner coordinates are calculated based on the center coordinates and width and height parameters to determine the spatial position of each detection box in the image. After obtaining the initial set of detection boxes, the detection boxes are first filtered based on the detection confidence, filtering out detection boxes with confidence scores below a preset threshold to obtain a candidate set of detection boxes. Then, a non-maximum suppression algorithm is performed on the candidate set of detection boxes to merge detection boxes with high spatial overlap and remove redundant detection boxes, thus obtaining a deduplicated set of detection boxes. Based on this, the deduplication detection box set is further filtered according to the detection box area, spatial position and image boundary constraints. Detection boxes with abnormal area or close to the image boundary are removed, and the coordinates of the remaining detection boxes are mapped back to the original image coordinate system, thereby obtaining the corrected coil detection results and the corresponding number of coils.
[0084] In this embodiment of the invention, by further performing steps such as candidate region cropping, pose normalization, template alignment, similarity evaluation, difference analysis, and result correction on the coil detection results output by the detection model, more refined state verification and anomaly identification can be achieved. Specifically, by cropping and expanding the candidate region of the coil, neighborhood information can be introduced while preserving the main structure of the coil, thereby reducing the impact of detection box positioning errors on subsequent judgments. By estimating rotation angles and scale changes through feature matching, and performing pose correction and scale normalization, geometric differences caused by different shooting angles or placement orientations can be eliminated, ensuring that coil images acquired under different conditions maintain spatial structural consistency. Accurate alignment between the template image and the image to be detected is achieved through a homography matrix, providing a unified reference benchmark for subsequent image similarity calculation and difference analysis. Based on this, by combining structural consistency evaluation and pixel difference analysis, the coil state can be comprehensively evaluated from both the overall structure and local details levels, thereby more accurately identifying anomalies such as coil adhesion, occlusion, overlap, or detection errors. When anomalies are detected, the original detection results can be corrected by performing confidence filtering, overlap removal, and spatial constraint filtering on the detection box set, resulting in more accurate detection boxes and the number of reels. This process effectively improves the reliability and stability of reel detection results, reducing false positives and false negatives caused by obstruction, dense stacking, or detection errors in complex warehousing environments, thereby enhancing the accuracy of reel quantity statistics and inventory status assessment.
[0085] In one possible implementation, after S6, step S7 is further included: S7: Based on the number of reels in the image of the reel storage area, determine any anomalies in the reel inventory. When an inventory anomaly is detected, issue a warning signal.
[0086] In one possible implementation, S7 specifically includes sub-steps S701 and S702: S701: Based on the number of reels in the image of the fused reel storage area, a normal range for reel inventory is constructed by introducing a dynamic reel inventory error tolerance.
[0087] In one possible implementation, the method for determining the dynamic coil inventory error tolerance specifically includes: Obtain historical test results and corresponding historical actual coil inventory quantities.
[0088] Based on the actual historical inventory of coils and the historical coil quantity in the historical inspection results, an inventory estimation error probability matrix is constructed.
[0089] Specifically, based on the historical actual coil inventory quantity and the historical coil inventory quantity in historical inspection results, a correspondence between the actual coil inventory quantity and the inspected inventory quantity is established, and statistical analysis is performed on each correspondence. The historical actual coil inventory quantity is used as the row index, and the coil inventory quantity in historical inspection results is used as the column index. Statistics are then compiled based on the historical actual coil inventory quantity... Historical detection results j Number of times This refers to the total number of historical inventory misjudgments, and also includes statistics on the actual historical inventory quantity of coils. Total number of samples Then through calculation The historical actual inventory quantity of coils is as follows When detected as j The probability values are calculated, and all probability values are arranged according to the combination relationship between the actual historical coil inventory quantity and the coil inventory quantity in the historical test results, thereby constructing an inventory estimation error probability matrix. ,in n The maximum capacity of the coil inventory is represented by the inventory estimation error probability matrix, which is used to characterize the distribution of the identification error of the inventory detection model under different inventory quantity conditions.
[0090] It should be noted that by constructing an inventory estimation error probability matrix based on historical detection results and historical actual inventory quantities, a structured statistical analysis of the identification error distribution of the detection system under different inventory scale conditions can be performed, thereby establishing a probabilistic mapping relationship between actual inventory quantities and detection results. This method transforms previously fragmented detection error data into a statistically meaningful error distribution model, enabling the system to intuitively reflect potential over- or under-counting situations at different inventory levels. By constructing this error probability matrix, the error patterns of the detection system in complex warehousing environments can be comprehensively characterized, providing a data foundation for subsequent calculations of false alarm and false negative probabilities. This avoids judgment biases caused by relying solely on a single average error, improving the adaptability and reliability of the inventory anomaly detection model to real-world business scenarios.
[0091] Based on the inventory estimation error probability matrix, calculate the first type of error probability function: ; in, This represents the first type of error probability function. Indicates the reorder point for coil inventory. This represents a candidate value for inventory error tolerance.
[0092] It should be noted that by constructing a first-type error probability function, the probability of the system failing to trigger an alarm due to detection errors when the actual inventory is already in an alarm-prone state can be quantified. This function calculates the probability of the system missing an alarm by statistically analyzing the error probabilities within a specific region of the error probability matrix. In this way, detection errors can be directly mapped to stockout risk indicators in actual inventory management. This allows the inventory early warning system to fully consider the potential production stoppage risks caused by identification errors during parameter optimization, thus providing a quantitative basis for subsequent optimization of inventory tolerance parameters and improving the inventory management system's ability to prevent stockout risks.
[0093] Based on the inventory estimation error probability matrix, calculate the second type of error probability function: ; in, This represents the probability function of the second type of error.
[0094] It should be noted that by constructing a second type of error probability function, the probability of an alarm being falsely triggered due to misjudgment by the detection system when the actual inventory is in a normal state can be quantified. This function is also based on statistical calculations using the error probability matrix to reflect the magnitude of the system's false alarm risk. By introducing this function, the cost of false alarms can be considered simultaneously during the inventory anomaly determination process, enabling the system to minimize unnecessary alarm events while ensuring that the risk of stockouts is controllable. This avoids the management costs associated with frequent manual checks and improves the stability and practical application efficiency of the inventory monitoring system.
[0095] Based on historical testing results and actual historical inventory of coils, calculate the error correction factor: ; in, This represents the error correction factor. This represents the root mean square error of historical test results relative to the historical actual inventory quantity of coils. This represents the total number of historical samples. Indicates the first The number of detection cable reels in stock corresponding to each historical sample. This indicates the corresponding historical actual inventory quantity of coils.
[0096] It should be noted that by introducing an error correction coefficient, the inventory tolerance optimization model can adaptively adjust based on the actual recognition accuracy of the detection system. This coefficient is calculated by statistically analyzing the overall error level between historical detection results and actual inventory, thus reflecting the overall performance status of the current detection system. When the detection system has high accuracy, the error correction coefficient amplifies the impact of tolerance parameter changes on the cost function, enabling the system to more precisely find the optimal tolerance value. Conversely, when the detection error is large, this coefficient reduces the model's sensitivity to changes in the tolerance parameter, thereby avoiding overly aggressive or unreliable tolerance parameters when the detection system's performance is unstable. By introducing this error correction mechanism, the robustness and stability of the entire inventory tolerance optimization model can be enhanced.
[0097] Based on the first type of error probability function, the second type of error probability function, and the error correction coefficient, construct the comprehensive cost function for inventory management: ; in, This represents the comprehensive cost function for inventory management. Indicates the unit inventory holding cost. This represents the stockout cost sensitivity coefficient. This represents the unit cost of production stoppage due to stock shortages. This represents the weighting coefficient for human efficiency. This indicates the cost of a single manual confirmation. This indicates the total number of historical inventory misjudgments.
[0098] It should be noted that those skilled in the art can set it according to actual needs. and The size is not limited in this invention.
[0099] It's important to note that by constructing a comprehensive cost function for inventory management, the problem of determining inventory error tolerance parameters can be transformed into an optimization problem aimed at minimizing the overall operating costs of the enterprise. This cost function comprehensively considers multiple factors, including inventory holding costs, stockout downtime risk costs, and manual verification costs, thus balancing inventory safety and operational efficiency during system parameter optimization. Specifically, introducing inventory holding costs can constrain the capital tied up due to excessively increasing inventory tolerance. Introducing stockout risk costs can reduce the risk of downtime caused by underreporting. Introducing manual verification costs can reduce unnecessary manual intervention caused by false alarms. By unifying these multiple cost factors into a single optimization model, the parameters for inventory anomaly detection can be systematically optimized, thereby reducing overall operating costs while ensuring inventory safety and improving the intelligent decision-making capabilities of the inventory management system.
[0100] Based on the comprehensive cost function of inventory management, determine the error tolerance of dynamic reel inventory.
[0101] Specifically, according to the comprehensive cost function of inventory management The range of values for each parameter is defined, and a candidate value range for the error tolerance m is set. Each error tolerance value within the candidate range is then substituted into the inventory management comprehensive cost function for calculation, yielding the comprehensive cost value corresponding to different error tolerances. Subsequently, the comprehensive cost values are compared and analyzed to determine the optimal comprehensive cost function for inventory management. The error tolerance that yields the minimum value is taken as the optimal error tolerance. And the optimal error tolerance The dynamic inventory error tolerance is determined, thereby achieving adaptive optimization of the inventory anomaly judgment threshold while taking into account inventory holding costs, stockout downtime costs, and manual confirmation costs.
[0102] It should be noted that by calculating and comparing the corresponding comprehensive cost values for different inventory error tolerances within a preset candidate range, the optimal error tolerance value that minimizes the comprehensive cost of inventory management can be determined and used as the dynamic inventory error tolerance. In this way, the inventory anomaly detection threshold can be adaptively adjusted based on the error characteristics of the detection system and the inventory management cost structure, enabling the system to automatically select the optimal tolerance range under different operating environments and inventory sizes. Compared to traditional fixed-threshold inventory warning methods, this method significantly improves the rationality and stability of inventory anomaly detection, thereby reducing the probability of false alarms and missed alarms and enhancing the overall intelligence level of the inventory monitoring system.
[0103] In this embodiment of the invention, an inventory estimation error probability matrix is constructed using historical detection results and historical actual inventory quantities. Based on this matrix, false alarm and false negative probabilities are further calculated. Simultaneously, a comprehensive inventory management cost model is constructed by combining the overall error level of the detection system. This transforms the determination of the inventory anomaly judgment threshold from an experience-based setting to an adaptive decision-making process based on data statistics and cost optimization. Specifically, by constructing the inventory estimation error probability matrix, the error distribution pattern of the detection model under different inventory scale conditions can be systematically characterized, thus providing a reliable data foundation for quantifying false alarm and false negative risks. By calculating the two types of error probabilities, the risk levels of undetected inventory anomalies and false alarms triggered despite normal inventory levels can be reflected, enabling the inventory early warning strategy to simultaneously consider both stockout risk and false alarm costs. By introducing an error correction coefficient, the parameter optimization process can be adaptively adjusted according to the actual recognition accuracy of the detection system, thereby enhancing the stability and robustness of the model at different operating stages. Furthermore, by constructing an inventory management comprehensive cost function and searching for the optimal tolerance value within the candidate range, a balance can be achieved between inventory holding costs, stockout downtime risk costs, and manual verification costs, realizing the optimal configuration of the inventory anomaly judgment threshold. By employing the above processing methods, the accuracy and rationality of inventory anomaly identification can be significantly improved, and the occurrence of false alarms and missed alarms can be reduced, thereby enhancing the intelligence level and practical reliability of the reel inventory monitoring system.
[0104] S702: When the number of reels in the image of the fused reel storage area exceeds the normal range of reel inventory, an inventory anomaly is determined and a warning signal is issued.
[0105] Specifically, when the number of reels in the fused reel storage area image is lower than the lower limit threshold of the normal reel inventory range, insufficient inventory is determined. When the number of reels in the fused reel storage area image is higher than the upper limit threshold of the normal reel inventory range, abnormally high inventory is determined. In either case, an inventory anomaly is determined and a warning signal is issued.
[0106] In this embodiment of the invention, by further determining anomalies in the coil inventory after completing coil detection and status anomaly determination, the image recognition results can be directly applied to inventory management and production monitoring, thereby achieving closed-loop management from target detection to inventory monitoring. Specifically, by introducing a dynamic coil inventory error tolerance to construct a normal inventory range, potential recognition errors or environmental interference factors during image detection can be fully considered, giving the inventory determination process a certain degree of fault tolerance and avoiding false alarms caused by occasional detection errors. Simultaneously, by comparing the detected coil quantity with the constructed normal inventory range, situations such as insufficient inventory or abnormally high inventory can be quickly identified, and timely warning signals can be issued when anomalies occur, enabling managers to take timely measures such as replenishment, scheduling, or verification. Through the above methods, the real-time performance and stability of inventory monitoring can be improved while ensuring the accuracy of inventory determination, thereby enhancing warehouse management efficiency and reducing the impact of inventory anomalies on production or logistics operations.
[0107] The present invention also provides a real-time coil detection system 20 based on edge computing, applied to the above-mentioned real-time coil detection method based on edge computing, comprising: Processor 201.
[0108] The memory 202 stores computer-readable instructions, which, when executed by the processor 201, implement the real-time coil detection method based on edge computing as described in the method embodiment.
[0109] The edge computing-based real-time coil detection system 20 provided by the present invention can execute the above-mentioned edge computing-based real-time coil detection method and achieve the same or similar technical effects. To avoid repetition, the present invention will not elaborate further.
[0110] The above are merely specific embodiments of the present invention, but the scope of protection of the present invention is not limited thereto. The scope of protection of the present invention should be determined by the scope of the claims.
Claims
1. A real-time coil detection method based on edge computing, characterized in that, include: S1: Real-time acquisition of multiple images of the reel storage area from different perspectives; S2: Verify the validity of each image of the storage area of the coil; S3: Perform image fusion processing on the images of the storage areas of each verified reel to obtain a fused image of the reel storage area; S4: Transmit the image of the fusion line disk storage area to the edge computing device; S5: The image of the fused coil storage area is detected by the coil detection model pre-deployed on the edge computing device, and the detection result including the coil detection box, coil position coordinates and the number of coils is output. S6: Based on the detection results, determine the abnormal state of the coil region in the image of the fused coil storage area; If an abnormality is detected in the coil condition, the number of coils is corrected, and the corrected detection result is output; otherwise, the detection result is output.
2. The real-time coil detection method based on edge computing according to claim 1, characterized in that: After S1 and before S2, it also includes: S1A: Perform image preprocessing on each of the images of the storage area of the coil. The image preprocessing includes image size normalization, image brightness equalization, and image noise suppression.
3. The real-time coil detection method based on edge computing according to claim 1, characterized in that: S2 specifically includes: S201: Using the image of the coil storage area as the image to be verified, perform feature extraction on the image to be verified and the pre-constructed template image of the coil area to obtain a set of feature points of the image to be verified, a set of descriptors of the image to be verified, a set of feature points of the template image, and a set of descriptors of the template image. S202: Cluster the set of template feature points to obtain multiple template feature clusters, and extract the template image descriptor subset corresponding to each template feature cluster as the template feature descriptor subset; S203: Perform nearest neighbor matching on the image descriptor subset to be verified and the template feature descriptor subset to obtain a matching descriptor subset, and extract the image feature point set corresponding to the matching descriptor subset as the matching feature point set; S204: Cluster the set of matching feature points to obtain multiple matching feature clusters, and construct a set of feature point pairs based on the correspondence between feature points in the template feature clusters and feature points in the matching feature clusters; S205: Calculate the homography matrix based on the set of feature point pairs, and project the corner points of the template image of the coil region onto the image to be verified based on the homography matrix to generate a projection box of the coil region. S206: Based on feature matching quality, feature cluster correspondence integrity, reprojection error, and projection box geometric rationality, calculate the image validity score and determine whether the image validity score is greater than or equal to the preset image validity score; if so, determine that the verification is successful and identify the image to be verified as a valid image; otherwise, determine that the verification fails and identify the image to be verified as an invalid image.
4. The real-time coil detection method based on edge computing according to claim 1, characterized in that: Specifically, S3 is: The image of the storage area of each verified reel is fused using a wavelet transform fusion algorithm to obtain the fused image of the storage area of the reel.
5. The real-time coil detection method based on edge computing according to claim 1, characterized in that: The specific coil detection model is: the improved YOLOv8 model; The construction method of the improved YOLOv8 model specifically includes: The fast spatial pyramid pooling module of the backbone network in the original YOLOv8 model is replaced with an enhanced lightweight spatial pyramid pooling module to construct an improved backbone network. Multiple convolutional modules are added between the neck network and the backbone network of the original YOLOv8 model. An upsampling layer, multiple feature concatenation layers, multiple C2f modules, and a convolutional module are added to the neck network. All C2f modules in the neck network are replaced with lightweight multi-scale feature fusion modules to construct an improved neck network. Add a detector head to the detector head network of the original YOLOv8 model, and replace all detector heads in the detector head network with reparameterized detector heads to construct an improved detector head network; The improved YOLOv8 model is constructed based on the improved backbone network, the improved neck network, and the improved detection head network.
6. The real-time coil detection method based on edge computing according to claim 1, characterized in that: S6 specifically includes: S601: Based on the coil detection frame and the coil position coordinates, a candidate coil region image is cropped from the fused coil storage area image, and the candidate coil region image is expanded at the boundary according to a preset expansion ratio to obtain the coil region image to be determined. S602: Extract feature points from the image of the coil region to be determined, perform feature matching with the pre-constructed template image of the coil region to obtain matching feature point pairs, and calculate the rotation angle and scale change coefficient of the image of the coil region to be determined relative to the template image of the coil region based on the matching feature point pairs. S603: Based on the rotation angle and the scale change coefficient, perform rotation correction and scale normalization processing on the image of the coil region to be determined to obtain a normalized coil region image. S604: Calculate the homography matrix based on the matching feature point pairs, and map the template image of the coil region to the normalized coil region image based on the homography matrix to obtain the template aligned region image; S605: Based on the image information between the normalized line disk region image and the template aligned region image, calculate the structural similarity index, peak signal-to-noise ratio index, and mean square error index, and calculate the comprehensive similarity score based on the structural similarity index, the peak signal-to-noise ratio index, and the mean square error index. S606: Calculate a difference image based on the pixel difference between the normalized line disk region image and the template alignment region image, and calculate a difference feature score based on the difference image; S607: Calculate the coil status normality score based on the similarity comprehensive score and the difference feature score, and determine whether the coil status normality score is less than the preset coil status normality score; if so, determine that there is an abnormal coil status, correct the number of coils, and output the corrected detection result; otherwise, determine that there is no abnormal coil status, and output the detection result.
7. The real-time coil detection method based on edge computing according to claim 1, characterized in that: Following S6, it also includes: S7: Based on the number of reels in the image of the fused reel storage area, determine the reel inventory anomaly; when an inventory anomaly is determined, issue a warning signal.
8. The real-time coil detection method based on edge computing according to claim 7, characterized in that: Specifically, S7 includes: S701: Based on the number of reels in the fused reel storage area image, a normal reel inventory range is constructed by introducing a dynamic reel inventory error tolerance. S702: When the number of reels in the image of the fused reel storage area exceeds the normal inventory range of the reel, it is determined that there is an inventory abnormality and a warning signal is issued.
9. The real-time coil detection method based on edge computing according to claim 8, characterized in that: The method for determining the dynamic reel inventory error tolerance specifically includes: Obtain historical test results and corresponding historical actual coil inventory quantities; Based on the historical actual inventory quantity of coils and the historical coil quantity in the historical detection results, an inventory estimation error probability matrix is constructed. Calculate the first type of error probability function based on the inventory estimation error probability matrix; Calculate the second type of error probability function based on the inventory estimation error probability matrix; Calculate the error correction coefficient based on the historical test results and the historical actual inventory quantity of coils; Based on the first type of error probability function, the second type of error probability function, and the error correction coefficient, construct the comprehensive cost function for inventory management; The error tolerance of the dynamic reel inventory is determined based on the comprehensive cost function of inventory management.
10. A real-time coil detection system based on edge computing, characterized in that, include: processor; A memory storing computer-readable instructions, which, when executed by the processor, implement the real-time coil detection method based on edge computing as described in any one of claims 1 to 9.