A dynamic analysis method for real-time data in IoT warehousing
By mapping the inventory data into images and analyzing the degree of abnormality, combining the LOF value and related situations between products, the uncertainty of parameter settings in the abnormality detection of inventory data is solved, and the accuracy of abnormal identification and inventory prediction are improved. sex.
Patent Information
- Application Number
- CN202410415683.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-08
- Publication Date
- 2024-11-05
- Estimated Expiration
- 2044-04-08
AI Technical Summary
The prior art has uncertain parameter setting in the abnormal detection of inventory data, resulting in low accuracy of abnormal identification and affecting the accuracy of the prediction results of the disk storage.
By mapping the inventory data into images, analyzing the characteristic differences between pixel points and surrounding points, determining the degree of the first, second and third abnormality, and combining the LOF value and the relevant situation between products, the threshold value of abnormal inventory is judged and smoothed. To improve the accuracy of abnormal identification.
It effectively improves the accuracy of inventory abnormality identification, improves the accuracy of inventory data prediction, reduces the impact of human parameter settings, and enhances the robustness of abnormality detection.
Smart Images

Figure CN118313759B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data anomaly identification, and in particular to a method for dynamic analysis of real-time data in an Internet of Things (IoT) warehouse. Background Art
[0002] When performing inventory forecasting, the real-time inventory data for different products within the warehouse, collected by the IoT system's RFID (Radio Frequency Identification) sensors, may contain abnormal data due to the collection method, storage method, or special circumstances. These abnormal data include true anomalies and false anomalies. True anomalies refer to abnormal inventory levels caused by popular or unsold products, or other special reasons. False anomalies refer to abnormal inventory levels caused by abnormal data collection equipment or other reasons. Both true and false anomalies can affect the accuracy of inventory forecasts. Therefore, it is necessary to identify the abnormal data corresponding to true and false anomalies to facilitate subsequent smoothing of the abnormal data and overcome the low accuracy of inventory forecasts.
[0003] Currently, the LOF (Local Outlier Factor) anomaly detection algorithm is commonly used for anomaly detection in real-time inventory data. However, the implementation of the LOF anomaly detection algorithm involves manually set parameters, which are uncertain and may not be suitable for anomaly detection in real-time inventory data, resulting in low accuracy in anomaly identification of inventory data. Summary of the Invention
[0004] In order to solve the technical problem that the existing anomaly detection algorithm has low accuracy in identifying anomalies in inventory data, the present invention aims to provide a method for dynamic analysis of real-time IoT warehouse data. The technical solution adopted is as follows:
[0005] An embodiment of the present invention provides a method for dynamic analysis of real-time data in an Internet of Things warehouse, the method comprising the following steps:
[0006] Obtain the inventory quantity set to be analyzed corresponding to each product in the IoT warehouse, and map the inventory quantity set to be analyzed into an inventory quantity image;
[0007] Analyze the feature difference between each pixel and its surrounding pixels based on the pixel value and LBP value of each pixel in the inventory image, determine the first abnormality degree of each pixel, and select the undetermined abnormal pixels in the inventory image based on the first abnormality degree;
[0008] Determine each comparison area and each contrasting pixel corresponding to each pending abnormal pixel; determine a similarity index of the distribution of surrounding pending abnormal pixels for each pair of pixels based on the number of pending abnormal pixels within each comparison area corresponding to each pending abnormal pixel and each contrasting pixel; a pair of pixels consists of a pending abnormal pixel and a contrasting pixel for the pending abnormal pixel;
[0009] Determine the second abnormality degree of each undetermined abnormal pixel point based on the pixel value of each undetermined abnormal pixel point and the similarity index of the distribution of the surrounding undetermined abnormal pixel points of each pair of pixels;
[0010] Determine a third abnormality level for each undetermined abnormal pixel point based on the LOF value, the first abnormality level, the second abnormality level, and a correlation between the inventory images of the two products.
[0011] A threshold is applied to the third abnormality degree of each pending abnormal pixel to obtain all abnormal inventory quantities; all abnormal inventory quantities are smoothed to obtain the final inventory quantity set corresponding to each product.
[0012] Furthermore, analyzing the characteristic difference between each pixel and its surrounding pixels based on the pixel value and LBP value of each pixel in the inventory image to determine the first abnormality degree of each pixel includes:
[0013] For any pixel point, the pixel points within the eight-neighborhood of the pixel point are determined to be neighboring pixel points; the pixel value difference between the pixel point and each neighboring pixel point is calculated as the first difference value; the LBP value difference between the pixel point and each neighboring pixel point is calculated as the second difference value; the first abnormality degree of the pixel point is determined by multiplying the accumulated value of all the first difference values by the accumulated value of all the second difference values.
[0014] Furthermore, selecting the undetermined abnormal pixel points in the inventory image according to the first abnormality degree includes:
[0015] A first abnormality threshold is set, and pixels in the inventory image whose first abnormality degree is greater than the first abnormality threshold are regarded as pending abnormal pixels.
[0016] Furthermore, the determining of each comparison area corresponding to each undetermined abnormal pixel point includes:
[0017] Taking any undetermined abnormal pixel point as the target point, determining the length of the line between the target point and a preset number of undetermined abnormal pixels closest to the target point;
[0018] The average length of all connected lines is used as the radius of the circular area, and the target point is used as the center of the circular area to construct the circular area of the target point;
[0019] The circular area of the target point is divided into various sub-areas, so as to obtain various comparison areas corresponding to the target point.
[0020] Furthermore, each comparison pixel point corresponding to each undetermined abnormal pixel point is determined, including:
[0021] The comparison pixel points include a first comparison pixel point and a second comparison pixel point. The pending abnormal pixel point in the comparison area where the target point is located is used as the first comparison pixel point of the target point; the pending abnormal pixel point in the inventory image that is located in the same column as the target point is used as the second comparison pixel point of the target point.
[0022] Furthermore, the method of determining the similarity index of the distribution of the surrounding abnormal pixels of each pair of pixels based on the number of abnormal pixels in each comparison area corresponding to each abnormal pixel and each comparison pixel includes:
[0023] Where Uc (e,g) is the similarity index of the distribution of the surrounding abnormal pixels of the pair of pixels consisting of the e-th abnormal pixel and the g-th comparison pixel of the e-th abnormal pixel, norm is the linear normalization function, S is the number of comparison areas, s is the sequence number of the comparison area, || is the absolute value function, Rpc (e,s) Rpc is the number of undetermined abnormal pixels in the sth comparison area corresponding to the eth undetermined abnormal pixel, (e,g,s) is the number of undetermined abnormal pixels in the sth comparison area corresponding to the gth comparison pixel of the eth undetermined abnormal pixel.
[0024] Furthermore, determining the second abnormality degree of each undetermined abnormal pixel point based on the pixel value of each undetermined abnormal pixel point and the similarity index of the distribution of surrounding undetermined abnormal pixels of each pair of pixels includes:
[0025] For the target point, determine the similarity index of the distribution of the undetermined abnormal pixel points around each pair of pixel points consisting of the target point and each first comparison pixel point of the target point as the first target similarity index, calculate the average value of all the first target similarity indexes, and perform negative correlation processing on the average values of all the first target similarity indexes to obtain the degree of abnormal distribution disorder in the comparison area where the target point is located;
[0026] Calculate the pixel value difference between the target point and each second comparison pixel point of the target point, and use the accumulated value of all pixel value differences as the numerator of the ratio; determine the similarity index of the distribution of the unknown abnormal pixel points around each pair of pixel points consisting of the target point and each second comparison pixel point of the target point as the second target similarity index, and use the accumulated value of all second target similarity indexes as the denominator of the ratio; use the ratio as the periodic abnormality degree of the target point;
[0027] The second abnormality degree of the target point is determined by combining the abnormal distribution disorder degree of the comparison area where the target point is located and the period abnormality degree of the target point.
[0028] Furthermore, determining a third abnormality degree of each undetermined abnormal pixel point in the inventory image of each product based on the LOF value, the first abnormality degree, the second abnormality degree, and a correlation between the inventory images of the two products includes:
[0029] Take any product as the target product, perform LOF anomaly detection on the pixel value of each undetermined abnormal pixel in the inventory image of the target product, and obtain the LOF value of each undetermined abnormal pixel;
[0030] determining, based on a similarity between the inventory quantity image of the target product and the inventory quantity images of each product other than the target product and a pixel value of each pixel, a correlation value between the target product and each product other than the target product;
[0031] Determine the third abnormality degree of each pending abnormal pixel point in the inventory image of the target product based on the LOF value, the first abnormality degree, the second abnormality degree, and the correlation value between the target product and other products except the target product.
[0032] Furthermore, determining the correlation value between the target product and each product other than the target product based on the similarity between the inventory quantity image of the target product and the inventory quantity images of each product other than the target product and the pixel value of each pixel point includes:
[0033] Where, QoB (a,b) is the correlation value between the a-th product and the b-th product, a≠b, exp is an exponential function with a natural constant as the base, SSIM (a,b) is the similarity between the inventory image of the a-th product and the inventory image of the b-th product, i is the serial number of each pixel in the inventory image, n is the number of all pixels in the inventory image, Ls (a,i) is the pixel value of the i-th pixel in the inventory image of the a-th product, Ls (b,i)is the pixel value of the i-th pixel in the inventory image of the b-th product, is the average value of all pixel values in the inventory image of product a, is the average pixel value of all pixels in the inventory image of the b-th product, and || is the absolute value function.
[0034] Furthermore, determining a third abnormality degree of each undetermined abnormal pixel point in the inventory quantity image of the target product based on the LOF value, the first abnormality degree, the second abnormality degree, and the correlation value between the target product and each product other than the target product includes:
[0035] In the formula, Tsd3 a,e is the third abnormality degree of the e-th abnormal pixel in the inventory image of the a-th product, norm is the linear normalization function, LOF a,e Yv1 is the LOF value of the e-th abnormal pixel in the inventory image of the a-th product. (a,e) Yv2 is the first abnormality degree of the e-th abnormal pixel in the inventory image of the a-th product. (a,e) is the second abnormality degree of the e-th abnormal pixel in the inventory image of the a-th product, H is the number of all products in the warehouse, QoB (a,b) is the correlation value between the a-th product and the b-th product, Yv1 (b,e) is the first abnormality degree of the eth abnormal pixel in the inventory image of the bth product, Yv2 (b,e) is the second abnormality degree of the e-th undetermined abnormal pixel in the inventory image of the b-th product.
[0036] The present invention has the following beneficial effects:
[0037] The present invention provides a method for dynamic analysis of real-time data in Internet of Things warehouses. The method improves the existing LOF anomaly detection applicable to inventory data by performing pixel anomaly analysis on the inventory image obtained by mapping, effectively improving the accuracy of inventory anomaly identification and further improving the accuracy of subsequent inventory data prediction. The method relates to the field of data anomaly identification technology and is applicable to the field of anomaly detection of inventory data. Mapping the set of inventory quantities to be analyzed into inventory images helps to more intuitively understand the distribution and structure of inventory data and discover potential patterns; selecting undetermined abnormal pixels based on the first degree of abnormality, which is quantified by the characteristic differences between a pixel and its surrounding pixels, can preliminarily screen out pixels that may have abnormalities, reducing the objects for subsequent abnormality degree analysis and helping to improve the efficiency of dynamic analysis of real-time inventory data; compared with only analyzing the abnormalities of the inventory itself, quantifying the second degree of abnormality from the perspective of similar indicators of the distribution of surrounding undetermined abnormal pixels can enhance the diversity of the quantitative analysis of the degree of abnormality; when determining the third degree of abnormality, the correlation between the inventory images of the two products is also combined, which helps to improve the numerical accuracy of the third degree of abnormality; determining the third degree of abnormality can, to a certain extent, avoid the low accuracy of outliers caused by manually set parameters in the existing anomaly detection process, that is, improve the effect of using the third degree of abnormality for inventory anomaly detection. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] In order to more clearly illustrate the technical solutions and advantages of the embodiments of the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the prior art descriptions. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0039] Figure 1 This is a flow chart of a method for dynamic analysis of real-time data in IoT warehousing according to an embodiment of the present invention;
[0040] Figure 2 Schematic diagram of various comparison areas corresponding to target points in an embodiment of the present invention. DETAILED DESCRIPTION
[0041] To further illustrate the technical means and effects employed by the present invention to achieve its intended objectives, the following, in conjunction with the accompanying drawings and preferred embodiments, describes in detail the specific implementations, structures, features, and effects of the technical solutions proposed by the present invention. In the following description, references to "one embodiment" or "another embodiment" do not necessarily refer to the same embodiment. Furthermore, specific features, structures, or characteristics of one or more embodiments may be combined in any suitable manner.
[0042] Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs.
[0043] Application scenarios targeted by this invention:
[0044] When performing inventory statistics on each product within an IoT warehouse, anomaly detection is required to ensure the reliability of predicted inventory changes. Existing LOF anomaly detection methods suffer from poor robustness and inaccurate parameter settings, resulting in poor accuracy in the dynamic analysis of real-time inventory data in IoT warehouses and, further, low accuracy in identifying anomalies in inventory data. Therefore, the present invention requires correcting anomaly detection results based on analysis of real-time collected inventory data.
[0045] Specifically, the embodiment of the present invention provides a method for dynamic analysis of real-time data in IoT warehouses, such as Figure 1 As shown, the following steps are included:
[0046] S1, obtain the inventory quantity set to be analyzed corresponding to each product in the IoT warehouse, and map the inventory quantity set to be analyzed into an inventory quantity image.
[0047] The first step is to obtain the inventory set to be analyzed corresponding to each product in the IoT warehouse.
[0048] In this embodiment, RFID sensors are used to collect inventory data for each product in an IoT warehouse, resulting in a corresponding inventory set to be analyzed for each product. The inventory set to be analyzed consists of hourly inventory data for each day over a preset number of years, which can be set to seven years. Each product represents a different type of product, such as a table tennis racket, table tennis ball, basketball, or soccer ball.
[0049] The process of collecting product inventory by RFID sensors can be as follows: RFID tags are attached to products. When products enter or leave the warehouse, RFID readers can automatically sense and read the tag information to update the product inventory.
[0050] The second step is to map the inventory quantity set to be analyzed into an inventory quantity image.
[0051] To more intuitively understand the distribution and structure of inventory data and uncover underlying patterns, we need to map the inventory set to be analyzed into inventory images, with each product having its own corresponding inventory image. Mapping a dataset into images is a common data visualization method, but the specific implementation is prior art and falls outside the scope of this invention, so we will not elaborate on it here.
[0052] Among them, each row in the inventory image can represent the inventory situation for each hour of each day in each year. The pixel value of each pixel is obtained by normalizing the original inventory data to [0, 255]. If there is a null value in the image, 0 is used to represent the pixel value.
[0053] So far, this embodiment has obtained the inventory quantity image of each product.
[0054] S2: Analyze the characteristic differences between each pixel and its surrounding pixels based on the pixel value and LBP value of each pixel in the inventory image, determine the first abnormality degree of each pixel, and select the undetermined abnormal pixels in the inventory image based on the first abnormality degree.
[0055] In the first step, the feature difference between each pixel and its surrounding pixels is analyzed based on the pixel value and LBP value of each pixel in the inventory image to determine the first abnormality degree of each pixel.
[0056] In an inventory image, the greater the difference in features between a pixel and its surrounding pixels, the more likely it is an anomaly. Feature differences can be analyzed from two perspectives: pixel value differences and LBP (Local Binary Pattern) value differences. A greater pixel value difference indicates a greater inventory difference; a greater LBP value difference indicates a greater difference in texture features between the regions where the two pixels reside. The first degree of anomaly can represent the degree of feature difference between a pixel and its surrounding pixels; a greater degree of feature difference indicates a greater first degree of anomaly.
[0057] In this embodiment, the calculation process of the first abnormality level of each pixel is the same. To reduce unnecessary description, the first abnormality level of any pixel in the inventory image of any product is used as an example to determine the first abnormality level of the pixel. The specific implementation process may include:
[0058] Determine the pixel points within the eight neighborhoods of the pixel point as neighboring pixel points; calculate the pixel value difference between the pixel point and each neighboring pixel point as the first difference value; calculate the LBP value difference between the pixel point and each neighboring pixel point as the second difference value; and determine the first abnormality degree of the pixel point by multiplying the accumulated value of all the first difference values by the accumulated value of all the second difference values.
[0059] As an example, the calculation formula for the first abnormality degree of the k-th pixel point can be:
[0060] Where, Yv1 k is the first abnormality degree of the k-th pixel, L is the number of neighboring pixels of the k-th pixel, h is the sequence number of the neighboring pixels of the k-th pixel, ΔEc (k,h)is the pixel value difference between the k-th pixel and the h-th neighboring pixel of the k-th pixel, ΔEc (k,h) Also the first difference value, is the cumulative value of all first difference values; Δlbp (k,h) is the LBP value difference between the k-th pixel and the h-th neighboring pixel of the k-th pixel, Δlbp (k,h) Also for the second difference, is the cumulative value of all second difference values.
[0061] In the calculation formula of the first abnormality degree, the pixel value difference can be obtained by calculating the absolute value of the difference between the pixel values, and the LBP value difference can also be obtained by calculating the absolute value of the difference between the LBP values; ΔEc (k,h) and Δlbp (k,h) The larger it is, the greater the first abnormality degree of the k-th pixel will be.
[0062] In the second step, based on the first abnormality degree of each pixel, undetermined abnormal pixels in the inventory image are selected.
[0063] In this embodiment, the first abnormality degree can be used for the initial screening of pixels that may be abnormal. In order to reduce the subsequent analysis of pixels with a lower possibility of abnormality and provide basic data support for subsequent data processing, after obtaining the first abnormality degree of each pixel, a first abnormality threshold is set, and the pixels in the inventory image with a first abnormality degree greater than the first abnormality threshold are taken as pending abnormal pixel points, thereby obtaining all pending abnormal pixel points in the inventory image. The pending abnormal pixel points are the analysis objects for subsequent abnormality degree analysis.
[0064] The first abnormality threshold can be obtained by analyzing the first abnormality degree of the pixel point using the Otsu threshold algorithm, and is not specifically limited thereto. The implementation process of the Otsu threshold algorithm is prior art and will not be elaborated on in detail here.
[0065] So far, this embodiment has obtained each undetermined abnormal pixel in the inventory image of each product.
[0066] S3, determining each comparison area and each comparison pixel point corresponding to each pending abnormal pixel point; and determining a similarity index of the distribution of the pending abnormal pixel points around each pair of pixels based on the number of pending abnormal pixels in each comparison area corresponding to each pending abnormal pixel point and each comparison pixel point.
[0067] After obtaining the pending abnormal pixel points screened out by the feature differences, the abnormality of the pending abnormal pixel points is analyzed through the distribution of other pending abnormal pixel points around the pending abnormal pixel points. The higher the similarity between the distribution of the pending abnormal pixel points around the pending abnormal pixel points and the distribution of the pending abnormal pixel points around other pending abnormal pixel points, the lower the possibility that the pending abnormal pixel point is an abnormal or messy pixel point, and the smaller the subsequent determination of the second abnormality degree will be.
[0068] The first step is to determine the comparison areas and comparison pixels corresponding to each undetermined abnormal pixel.
[0069] In order to analyze the distribution of other pending abnormal pixel points around the pending abnormal pixel point, it is necessary to set a comparison area for each pending abnormal pixel point; in order to quantify the similarity of the distribution of other pending abnormal pixel points around different pending abnormal pixel points, it is necessary to select the comparison pixels corresponding to each pending abnormal pixel point in the inventory image according to the actual situation.
[0070] In this embodiment, the process of determining each comparison area and each comparison pixel corresponding to each pending abnormal pixel is the same. For ease of understanding, any pending abnormal pixel in the inventory image of any product is taken as a target point. The target point is used as an example to determine each comparison area and each comparison pixel corresponding to the target point. The specific implementation process may include:
[0071] The first sub-step is to determine the comparison areas corresponding to the target point.
[0072] First, the length of the line between the target point and a preset number of abnormal pixel points to be determined that are closest to the target point is determined.
[0073] In this embodiment, the preset number can be set to 20, and the implementer can set the number of undetermined abnormal pixel points closest to the target point according to the specific actual situation; the calculation process of the length of the line between two points in the image is an existing technology and will not be elaborated here.
[0074] Secondly, the average value of the lengths of all connected lines is used as the radius of the circular area, and the target point is used as the center of the circular area to construct the circular area of the target point.
[0075] The process of constructing a circular area using a known radius and center position is prior art and will not be elaborated here.
[0076] Then, the circular area of the target point is divided into various sub-areas, thereby obtaining various comparison areas corresponding to the target point.
[0077] In this embodiment, when dividing each sub-area, the radius of the initial circular area is first evenly divided into 3 parts, and two new radii can be obtained. Based on the two new radii and with the target point as the center, the circular area is reconstructed to achieve the preliminary division of the initial circular area; then, the angle of the circular area is evenly divided into 8 parts, and the dividing lines are constructed according to the angle values after the division, which can achieve the further division of the initial circular area, thereby obtaining 24 comparison areas corresponding to the target point. Among them, the schematic diagram of each comparison area corresponding to the target point is shown as follows Figure 2 shown.
[0078] It should be noted that dividing the regions according to relative positions and determining the number of pending abnormal pixels in the same divided region can greatly reflect the similarity of the spatial positions of the pending abnormal pixels, so as to better analyze the degree of spatial chaos between the pending abnormal pixels.
[0079] Of course, the implementer may also divide the circular area of the target point according to other division methods, without specific limitation. It is worth noting that the division method of the circular area of each pending abnormal pixel is the same, that is, there is a one-to-one comparison relationship between the respective comparison areas corresponding to the two pending abnormal pixels.
[0080] The second sub-step is to determine the comparison pixel points corresponding to the target point.
[0081] In this embodiment, the comparison pixels corresponding to the target point include some first comparison pixels and some second comparison pixels. The first comparison pixels refer to the undetermined abnormal pixels within the comparison region where the target point is located, while the second comparison pixels refer to the undetermined abnormal pixels in the inventory image that are located in the same column as the target point. It is worth noting that the comparison pixels do not include the target point itself.
[0082] In the second step, based on the number of pending abnormal pixels in each comparison area corresponding to the target point and its corresponding comparison pixels, the similarity index of the distribution of pending abnormal pixels around each pair of pixels consisting of the target point and its corresponding comparison pixels is determined.
[0083] After obtaining the comparison areas and comparison pixels corresponding to the target point, the similarity of the distribution of the pending abnormal pixels around each pair of pixels is quantified by analyzing the difference in the number of pending abnormal pixels in the comparison areas corresponding to the target point and its comparison pixels, where a pair of pixels consists of a target point and its comparison pixels.
[0084] As an example, the calculation formula for the similarity index of the distribution of surrounding undetermined abnormal pixels of a pair of pixels consisting of the e-th undetermined abnormal pixel and the g-th comparison pixel of the e-th undetermined abnormal pixel can be:
[0085] Where Uc (e,g) is the similarity index of the distribution of the surrounding abnormal pixels of the pair of pixels consisting of the e-th abnormal pixel and the g-th comparison pixel of the e-th abnormal pixel, norm is the linear normalization function, S is the number of comparison areas, s is the sequence number of the comparison area, || is the absolute value function, Rpc (e,s) Rpc is the number of undetermined abnormal pixels in the sth comparison area corresponding to the eth undetermined abnormal pixel, (e,g,s) is the number of undetermined abnormal pixels in the sth comparison area corresponding to the gth comparison pixel of the eth undetermined abnormal pixel.
[0086] In the calculation formula of the similarity index, there is a one-to-one correspondence between each comparison area corresponding to the e-th pending abnormal pixel and each comparison area corresponding to the g-th comparison pixel. Compared with analyzing the difference in the number of pending abnormal pixels in the initial circular area, calculating the difference in the number of pending abnormal pixels between the corresponding comparison areas can obtain a more accurate similarity index. The serial numbers of the comparison areas corresponding to different pending abnormal pixels can be marked from 0 degrees in a clockwise direction from the center of the circle to the edge. Implementers can mark the serial numbers of each comparison area according to specific actual conditions. The larger the value is, the worse the similarity of the distribution of the surrounding abnormal pixels of the pair of pixels consisting of the e-th abnormal pixel and the g-th comparison pixel is, and the smaller the similarity index is, so it is necessary to Perform negative correlation processing, that is, The comparison pixel points include the first comparison pixel points and the second comparison pixel points, so when analyzing the target point and its corresponding comparison pixel points, the first comparison pixel points and the second comparison pixel points are also quantitatively analyzed for similarity indicators; the similarity indicator refers to the degree of similarity between the distribution of the undetermined abnormal pixel points in each comparison area corresponding to a undetermined abnormal pixel point and the distribution of the undetermined abnormal pixel points in each comparison area corresponding to its comparison pixel point.
[0087] So far, this embodiment has obtained the similarity index of the distribution of the surrounding undetermined abnormal pixels of each pair of pixels.
[0088] S4, determining a second abnormality degree of each to-be-determined abnormal pixel point according to the pixel value of each to-be-determined abnormal pixel point and a similarity index of the distribution of surrounding to-be-determined abnormal pixel points of each pair of pixels.
[0089] After obtaining similarity indices for the distribution of surrounding abnormal pixels for each pair of pixels consisting of a potential abnormal pixel and its corresponding comparison pixels, the abnormality of the potential abnormal pixel can be further quantified based on the similarity indices, i.e., a second abnormality degree for each potential abnormal pixel can be determined. This second abnormality degree can be distinguished from the first abnormality degree. When analyzing the second abnormality degree, it is necessary not only to consider the chaotic distribution of abnormalities in the comparison area where the potential abnormal pixel is located, but also to consider periodic data mutations. This helps to improve the numerical accuracy and reference value of the subsequently determined second abnormality degree.
[0090] In this embodiment, the process of determining the second abnormality degree of each to-be-determined abnormal pixel remains consistent. To reduce unnecessary description, the second abnormality degree is determined by taking the target point as an example. The specific implementation process may include:
[0091] The first step is to determine the degree of abnormal distribution disorder in the comparison area where the target point is located.
[0092] Specifically, the similarity index of the distribution of the unknown abnormal pixel points around each pair of pixel points composed of the target point and each first comparison pixel point of the target point is determined as the first target similarity index, the average value of all the first target similarity indexes is calculated, and the average value of all the first target similarity indexes is negatively correlated to obtain the degree of abnormal distribution chaos in the comparison area where the target point is located.
[0093] As an example, the calculation formula for the abnormal distribution disorder degree of the comparison area where the e-th undetermined abnormal pixel point is located can be:
[0094] HL e is the degree of abnormal distribution disorder in the comparison area where the e-th abnormal pixel point is located, R is the number of the first comparison pixel points corresponding to the e-th abnormal pixel point, r is the sequence number of the first comparison pixel point corresponding to the e-th abnormal pixel point, Uc (e,r) Uc is the similarity index of the distribution of the surrounding abnormal pixels of the pair of pixels consisting of the e-th abnormal pixel and the r-th first comparison pixel of the e-th abnormal pixel, (e,r) It is also the first target similarity index, is the average value of all first-target similarity indices.
[0095] In the calculation formula of abnormal distribution disorder degree, Uc (e,r) The value range of is between 0 and 1, so The value range is also between 0 and 1, which can be used Realize the negative correlation processing of the average value of all the first target similarity indicators; when the similarity indicator Uc (e,r)The smaller the value is, the more chaotic the distribution of the undetermined abnormal pixels around the e-th undetermined abnormal pixel and each first comparison pixel in the comparison area where it is located is, and the worse the regularity is, that is, the higher the degree of abnormal distribution chaos. The degree of abnormal distribution chaos can characterize the degree of chaos of the suspected abnormal distribution in the comparison area where the undetermined abnormal pixel is located. The degree of abnormal distribution chaos of the undetermined abnormal pixels in the same comparison area is the same.
[0096] The second step is to determine the degree of periodic anomaly of the target point.
[0097] When analyzing inventory anomalies, inventory over a larger time span may change to a certain extent. Sudden changes in inventory may be periodic data mutations, that is, they are caused by significant events occurring in the same period. Therefore, it is necessary to analyze the inventory in the same period. The inventory in the same period refers to the pixels in the same column of the inventory image, and the periodic anomaly of each undetermined abnormal pixel is quantified.
[0098] Specifically, the pixel value difference between the target point and each second comparison pixel point of the target point is calculated, and the accumulated value of all pixel value differences is used as the numerator of the ratio; the similarity index of the distribution of the unknown abnormal pixel points around each pair of pixel points composed of the target point and each second comparison pixel point of the target point is determined as the second target similarity index, and the accumulated value of all second target similarity indexes is used as the denominator of the ratio; the ratio is used as the periodic abnormality degree of the target point.
[0099] As an example, the calculation formula for the periodic anomaly degree of the e-th undetermined abnormal pixel point can be:
[0100] Ws e is the periodic abnormality degree of the e-th abnormal pixel to be determined, T is the number of the second comparison pixel points corresponding to the e-th abnormal pixel to be determined, t is the sequence number of the second comparison pixel points corresponding to the e-th abnormal pixel to be determined, ΔF (e,t) is the pixel value difference between the e-th abnormal pixel to be determined and the t-th second comparison pixel of the e-th abnormal pixel to be determined, Uc (e,t) Uc is the similarity index of the distribution of the surrounding abnormal pixels of the pair of pixels consisting of the e-th abnormal pixel and the t-th second comparison pixel of the e-th abnormal pixel, (e,t) It is also a similarity indicator for the second goal.
[0101] In the calculation formula for the degree of periodic anomaly, the greater the difference in pixel value between the e-th undetermined abnormal pixel point and each second comparison pixel point in the same period, and the smaller the similarity index of the distribution of the surrounding undetermined abnormal pixel points in the same column, the greater the degree of periodic anomaly of the e-th undetermined abnormal pixel point. Analyzing the periodic anomaly of the undetermined abnormal pixel point from two aspects can effectively improve the numerical accuracy of the periodic anomaly degree.
[0102] The third step is to determine the second abnormality degree of the target point by combining the abnormal distribution disorder degree of the comparison area where the target point is located and the period abnormality degree of the target point.
[0103] The degree of abnormal distribution disorder, the degree of periodic abnormality, and the second degree of abnormality are positively correlated. A positive correlation indicates that the dependent variable increases as the independent variable increases, and the dependent variable decreases as the independent variable decreases. The specific relationship can be a multiplication relationship, an addition relationship, or the power of an exponential function, and is determined by actual application. In this embodiment, the product of the degree of abnormal distribution disorder and the degree of periodic abnormality is used as the second degree of abnormality of the target point.
[0104] At this point, this embodiment obtains the second abnormality degree of each to-be-determined abnormal pixel point.
[0105] S5, determining a third abnormality degree of each pending abnormal pixel point in the inventory image of each product based on the LOF value, the first abnormality degree, the second abnormality degree, and the correlation between the inventory images of the two products.
[0106] After obtaining the first and second abnormality levels for each pending abnormal pixel, the final abnormality of each pending abnormal pixel, i.e., the third abnormality level, can be quantified by combining the LOF value of each pending abnormal pixel obtained during the existing LOF abnormality detection process and the correlation between products. The third abnormality level can be used to assess the likelihood that each pending abnormal pixel represents the final abnormal inventory data. The third abnormality level for each pending abnormal pixel can be obtained by weighting the original LOF value.
[0107] In this embodiment, the process for determining the third abnormality level of each pending abnormal pixel in the inventory image of each product is consistent. For ease of understanding, any product is taken as a target product. Taking the target product as an example, the third abnormality level of each pending abnormal pixel in the inventory image of the target product is determined. The specific implementation process may include:
[0108] In the first step, LOF anomaly detection is performed on the pixel value of each pending abnormal pixel in the inventory image of the target product to obtain the LOF value of each pending abnormal pixel.
[0109] In this embodiment, each undetermined abnormal pixel has a corresponding LOF value. The LOF value can represent the original abnormal value of the inventory data corresponding to the undetermined abnormal pixel. Due to special circumstances, the accuracy of the original abnormal value is low, and it is necessary to correct and adjust the original abnormal value to obtain the third abnormality level. The LOF anomaly detection process is prior art and is beyond the scope of protection of this invention. It will not be elaborated here.
[0110] In the second step, based on the similarity between the inventory quantity image of the target product and the inventory quantity images of each product except the target product and the pixel value of each pixel, the correlation value between the target product and each product except the target product is determined.
[0111] It should be noted that there is a correlation between certain products in the warehouse, such as ping-pong balls and ping-pong rackets. The correlation between the products is used as the coefficient of the abnormality degree of the abnormal pixel point to be determined, so as to use the inventory of the corresponding related products to evaluate whether the inventory of the current product is abnormal, and further enhance the accuracy of the third abnormality degree determined subsequently.
[0112] As an example, the calculation formula for the correlation value between product a and product b can be:
[0113] Where, QoB (a,b) is the correlation value between the a-th product and the b-th product, a≠b, exp is an exponential function with a natural constant as the base, SSIM (a,b) is the similarity between the inventory image of the a-th product and the inventory image of the b-th product, i is the serial number of each pixel in the inventory image, n is the number of all pixels in the inventory image, Ls (a,i) is the pixel value of the i-th pixel in the inventory image of the a-th product, Ls (b,i) is the pixel value of the i-th pixel in the inventory image of the b-th product, is the average value of all pixel values in the inventory image of product a, is the average pixel value of all pixels in the inventory image of the b-th product, and || is the absolute value function.
[0114] In the calculation formula of the correlation value, SSIM (a,b) Indicates the similarity between the inventory images of two products, that is, the similarity of the inventory data changes of the two products. SSIM (a,b) The closer it is to 1, the greater the correlation between product a and product b. (a,b) The closer it is to 0, the smaller the correlation value between product a and product b is. Under normal circumstances, SSIM(a,b) There is no negative number, so it is not considered here; It can represent the inventory statistics of two products. For example, if the inventory of two products is close to It is equivalent to one racket with three balls. The closer it is to 0, the stronger the correlation between the storage quantities of the two products is, that is, the greater the correlation value between the two products, the more Perform negative correlation processing and normalization processing, such as exp(-). Implementers can implement negative correlation processing and normalization processing according to specific actual conditions.
[0115] In the third step, the third abnormality degree of each undetermined abnormal pixel point in the inventory image of the target product is determined based on the LOF value, the first abnormality degree, the second abnormality degree, and the correlation value between the target product and other products except the target product.
[0116] In this embodiment, after obtaining various abnormality degree related indicators, the third abnormality degree of each undetermined abnormal pixel point in the inventory image of the target product is determined by appropriate calculation logic, and the ath product may be the target product.
[0117] As an example, the calculation formula for the third abnormality degree of the e-th undetermined abnormal pixel in the inventory image of the a-th product can be:
[0118] In the formula, Tsd3 a,e is the third abnormality degree of the e-th abnormal pixel in the inventory image of the a-th product, norm is the linear normalization function, LOF a,e Yv1 is the LOF value of the e-th abnormal pixel in the inventory image of the a-th product. (a,e) Yv2 is the first abnormality degree of the e-th abnormal pixel in the inventory image of the a-th product. (a,e) is the second abnormality degree of the e-th abnormal pixel in the inventory image of the a-th product, H is the number of all products in the warehouse, QoB (a,b) is the correlation value between the a-th product and the b-th product, Yv1 (b,e) is the first abnormality degree of the eth abnormal pixel in the inventory image of the bth product, Yv2 (b,e) is the second abnormality degree of the e-th undetermined abnormal pixel in the inventory image of the b-th product.
[0119] In the calculation formula of the third abnormality degree, is the adjustment parameter of the LOF value of the e-th abnormal pixel to be determined. Normalization is performed to unify the dimensions. (a,b) The smaller the value, the smaller the impact of the abnormality of the e-th undetermined abnormal pixel in the inventory image of the b-th product on the e-th undetermined abnormal pixel in the inventory image of the a-th product. (a,b) *Yv1 (b,e) *Yv2 (b,e) The smaller the QoB (a,b) The larger the value, the greater the impact of the abnormal situation of the e-th undetermined abnormal pixel in the inventory image of the b-th product on the e-th undetermined abnormal pixel in the inventory image of the a-th product. (a,b) *Yv1 (b,e) *Yv2 (b,e) The bigger it is.
[0120] So far, this embodiment has obtained the third abnormality degree of each to-be-determined abnormal pixel in the inventory image of each product.
[0121] S6, performing a threshold judgment on the third abnormality degree of each pending abnormal pixel to obtain all abnormal inventory quantities; performing a smoothing process on all abnormal inventory quantities to obtain a final inventory quantity set corresponding to each product.
[0122] In this embodiment, a third anomaly threshold is first set, which can be set to 0.8. The third anomaly degree of each undetermined abnormal pixel in the inventory image for each product is compared with the third anomaly threshold. Pixels with a third anomaly degree greater than the third anomaly threshold are selected as abnormal pixels. Each abnormal pixel is mapped to the corresponding inventory set to be analyzed, thereby obtaining all abnormal inventory levels and identifying anomalies in the inventory data. The third anomaly threshold can be set by the implementer based on specific circumstances and is not specifically limited.
[0123] It should be noted that for the other pixel points in the inventory image except the pending abnormal pixel points, there is no possibility that they are abnormal pixels. That is, the other pixel points except the pending abnormal pixel points can be directly determined as normal pixels without performing threshold judgment on them.
[0124] Secondly, to improve the accuracy of subsequent inventory forecasts, we used Gaussian smoothing to smooth all abnormal inventory levels. This, to a certain extent, eliminated abnormal inventory data from the inventory set to be analyzed, which was caused by accidental events or the influence of data acquisition equipment. Finally, the inventory set to be analyzed after the abnormal data smoothing was used as the final inventory set, resulting in the final inventory set for each product.
[0125] This concludes the present embodiment.
[0126] In summary, the present invention quantifies the abnormality of each pixel by constructing an image, and at the same time combines the correlation between different products, effectively improving the accuracy of anomaly identification of inventory data, greatly enhancing the robustness of anomaly detection, and further improving the accuracy of subsequent inventory forecasting.
[0127] The embodiments described above are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the scope of the technical solutions of the embodiments of the present invention, and should all be included in the protection scope of the present invention.
Claims
1. A method for dynamic analysis of real-time data in Internet of Things warehousing, characterized in that: The following steps are involved: Obtain a set of inventory quantities to be analyzed corresponding to each product in the IoT warehouse, and map the set of inventory quantities to be analyzed into an inventory quantity image; Analyze the feature difference between each pixel and its surrounding pixels according to the pixel value and LBP value of each pixel in the inventory image, determine the first abnormality degree of each pixel, and select the undetermined abnormal pixel in the inventory image according to the first abnormality degree; Determine each comparison area and each comparison pixel corresponding to each pending abnormal pixel; determine a similarity index of the distribution of the surrounding pending abnormal pixels of each pair of pixels according to the number of pending abnormal pixels in each comparison area corresponding to each pending abnormal pixel and each comparison pixel; A pair of pixels is composed of a pending abnormal pixel and a comparison pixel of the pending abnormal pixel; Determine the second abnormality degree of each undetermined abnormal pixel point according to the pixel value of each undetermined abnormal pixel point and the similarity index of the distribution of the surrounding undetermined abnormal pixel points of each pair of pixels; Determine the third abnormality degree of each undetermined abnormal pixel point according to the LOF value, the first abnormality degree, the second abnormality degree, and the correlation between the inventory images of the two products of each undetermined abnormal pixel point in the inventory image of each product; Perform threshold judgment on the third abnormality degree of each abnormal pixel to be determined to obtain all abnormal inventory quantities; Smooth all abnormal inventory quantities to obtain the final inventory quantity set corresponding to each product; The method of determining the similarity index of the distribution of the surrounding abnormal pixels of each pair of pixels according to the number of the abnormal pixels of interest in each comparison area corresponding to each abnormal pixel of interest and each comparison pixel thereof includes: In the formula, Uc (e,g) is the similarity index of the distribution of the surrounding abnormal pixels of a pair of pixels consisting of the e-th abnormal pixel and the g-th comparison pixel of the e-th abnormal pixel, norm is the linear normalization function, S is the number of comparison areas, s is the sequence number of the comparison area, || is the absolute value function, Rpc (e,s) Rpc is the number of undetermined abnormal pixels in the sth comparison area corresponding to the eth undetermined abnormal pixel, (e,g,s) is the number of undetermined abnormal pixels in the sth comparison area corresponding to the gth comparison pixel of the eth undetermined abnormal pixel; The step of determining the second abnormality degree of each undetermined abnormal pixel point according to the pixel value of each undetermined abnormal pixel point and the similarity index of the distribution of the surrounding undetermined abnormal pixel points of each pair of pixels includes: For the target point, determine the similarity index of the distribution of the surrounding abnormal pixel points to be determined of each pair of pixel points consisting of the target point and each first comparison pixel point of the target point as the first target similarity index, calculate the average value of all the first target similarity indexes, and perform negative correlation processing on the average values of all the first target similarity indexes to obtain the degree of abnormal distribution disorder of the comparison area where the target point is located; Calculate the pixel value difference between the target point and each second comparison pixel point of the target point, and use the accumulated value of all pixel value differences as the numerator of the ratio; determine the similarity index of the distribution of the surrounding abnormal pixel points to be determined of each pair of pixel points composed of the target point and each second comparison pixel point of the target point as the second target similarity index, and use the accumulated value of all the second target similarity indexes as the denominator of the ratio; use the ratio as the periodic abnormality degree of the target point; Determine the second abnormality degree of the target point by combining the abnormal distribution disorder degree of the comparison area where the target point is located and the period abnormality degree of the target point; The step of determining the third abnormality degree of each abnormal pixel to be determined according to the LOF value, the first abnormality degree, the second abnormality degree, and the correlation between the inventory images of the two products of each abnormal pixel to be determined in the inventory image of each product includes: Take any product as the target product, perform LOF anomaly detection on the pixel value of each undetermined abnormal pixel in the inventory image of the target product, and obtain the LOF value of each undetermined abnormal pixel; Determine the correlation value between the target product and each product other than the target product according to the similarity between the inventory quantity image of the target product and the inventory quantity images of each product other than the target product and the pixel value of each pixel point; Determine a third abnormality degree for each undetermined abnormal pixel point in the inventory quantity image of the target product according to the LOF value, the first abnormality degree, the second abnormality degree, and the correlation value between the target product and each product other than the target product; The determining, based on the similarity between the inventory quantity image of the target product and the inventory quantity images of each product other than the target product and the pixel value of each pixel, the correlation value between the target product and each product other than the target product comprises: Where, QoB (a,b) is the correlation value between the a-th product and the b-th product, a≠b, exp is an exponential function with a natural constant as the base, SSIM (a,b) is the similarity value between the inventory image of the a-th product and the inventory image of the b-th product, i is the serial number of each pixel in the inventory image, n is the number of all pixels in the inventory image, Ls (a,i) is the pixel value of the i-th pixel in the inventory image of the a-th product, Ls (b,i) is the pixel value of the i-th pixel in the inventory image of the b-th product, is the average value of all pixel values in the inventory image of the ath product, is the average value of all pixel values in the inventory image of the bth product, || is the absolute value function; The step of determining the third abnormality degree of each to-be-determined abnormal pixel point in the inventory quantity image of the target product according to the LOF value of each to-be-determined abnormal pixel point in the inventory quantity image of the target product, the first abnormality degree, the second abnormality degree, and the correlation value between the target product and each product other than the target product, comprises: In the formula, Tsd3 a,e is the third abnormality degree of the e-th abnormal pixel in the inventory image of the a-th product, norm is the linear normalization function, LOF a,e is the LOF value of the e-th undetermined abnormal pixel in the inventory image of the a-th product, Yv1 (a,e) is the first abnormality degree of the e-th abnormal pixel in the inventory image of the a-th product, Yv2 (a,e) is the second abnormality degree of the e-th abnormal pixel in the inventory image of the a-th product, H is the number of all products in the warehouse, QoB (a,b) is the correlation value between the a-th product and the b-th product, Yv1 (b,e) is the first abnormality degree of the e-th abnormal pixel in the inventory image of the b-th product, Yv2 (b,e) is the second abnormality degree of the e-th undetermined abnormal pixel in the inventory image of the b-th product.
2. According to claim 1, a method for dynamic analysis of real-time data in Internet of Things warehousing is characterized in that: The step of analyzing the feature difference between the pixel and surrounding pixels according to the pixel value and the LBP value of each pixel in the inventory image to determine the first abnormality degree of each pixel includes: For any pixel point, determine the pixel points within the eight-neighborhood of the pixel point as neighboring pixel points; calculate the pixel value difference between the pixel point and each neighboring pixel point as the first difference value; calculate the LBP value difference between the pixel point and each neighboring pixel point as the second difference value; and determine the first abnormality degree of the pixel point by multiplying the accumulated value of all the first difference values by the accumulated value of all the second difference values.
3. According to claim 2, a method for dynamic analysis of real-time data in Internet of Things warehousing is characterized in that: The step of selecting the undetermined abnormal pixel points in the inventory image according to the first abnormality degree includes: A first abnormality threshold is set, and pixels in the inventory image whose first abnormality degree is greater than the first abnormality threshold are taken as abnormal pixels to be determined.
4. According to claim 1, a method for dynamic analysis of real-time data in Internet of Things warehousing is characterized in that: The step of determining each comparison area corresponding to each undetermined abnormal pixel point includes: Taking any undetermined abnormal pixel point as a target point, determining the length of the line between the target point and a preset number of undetermined abnormal pixel points closest to the target point; The average value of the lengths of all the connecting lines is taken as the radius of the circular area, and the target point is taken as the center of the circular area to construct the circular area of the target point; The circular area of the target point is divided into various sub-areas, so as to obtain various comparison areas corresponding to the target point.
5. The method for dynamic analysis of real-time data in Internet of Things warehousing according to claim 4 is characterized in that: Determine the various comparison pixels corresponding to each pending abnormal pixel, including: The comparison pixel points include a first comparison pixel point and a second comparison pixel point. The pending abnormal pixel point in the comparison area where the target point is located is used as the first comparison pixel point of the target point; the pending abnormal pixel point in the inventory image that is located in the same column as the target point is used as the second comparison pixel point of the target point.
Citation Information
Patent Citations
Charging shed photovoltaic power generation reserve prediction method based on multi-data fusion
CN116011686A
Irregular hardware surface defect detection method based on computer vision
CN116912248A
Position difference graph generation method and apparatus, electronic device, chip, and medium
WO2023225825A1
