A method for detecting abnormal areas in cartridge case primer measurement based on adaptive DBSCAN clustering
Through the adaptive DBSCAN clustering method, the Eps and MinPts parameters are automatically determined using the k-dist function, which solves the measurement abnormality caused by high reflectivity in three-dimensional laser scanning technology, and realizes automatic detection and accurate identification of abnormal reflective areas of the shell bottom fire.
Patent Information
- Application Number
- CN202510103921.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-23
- Publication Date
- 2025-05-16
- Estimated Expiration
- 2045-01-23
AI Technical Summary
Three-dimensional laser scanning technology causes specular reflection or multiple reflections due to high reflectivity when measuring shells, which affects image clarity and measurement accuracy. In addition, traditional DBSCAN algorithms require manual adjustment of parameters, resulting in instability.
Using the method based on adaptive DBSCAN clustering, the distance between the preprocessed shell sample and its K-th nearest neighbor is calculated through the k-dist function, and the Eps and MinPts parameters are determined to realize automatic detection of the abnormal reflection area of the shell fire bottom fire.
It effectively avoids the instability caused by manual adjustment of parameters, improves the accuracy and stability of clustering, and can automatically identify and detect abnormal reflective areas of the shell bottom fire.
Smart Images

Figure CN119537983B_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the field of data recognition, and in particular to a method for detecting abnormal areas in cartridge case primer measurements based on adaptive DBSCAN clustering. Background Art
[0002] With the continuous development of information technology, automated detection technology has gradually occupied an important position in the field of criminal investigation and forensics. In particular, the introduction of three-dimensional laser scanning technology, due to its non-contact characteristics, can perform non-destructive measurement of traces on the surface of shells, thereby significantly improving the efficiency and accuracy of inspection. This technology can not only improve the efficiency of trace analysis, but also avoid the destruction of evidence caused by contact damage, ensuring the integrity of trace data. However, three-dimensional laser scanning technology also faces some challenges in practical applications, especially due to the high reflectivity of the shell material, when the laser beam is irradiated on its surface, mirror reflection or multiple reflection phenomena often occur. These abnormal reflection phenomena may cause image distortion, affect the clarity of the trace, and then affect the subsequent measurement results and data accuracy.
[0003] Measuring abnormal areas may not only obscure important details such as firing pin marks, but also affect the identification and analysis of cartridge case marks, reducing the accuracy and reliability of trace analysis. Summary of the invention
[0004] The purpose of the present invention is to overcome the shortcomings of the prior art and provide a method for detecting abnormal areas in cartridge case primer measurement based on adaptive DBSCAN clustering, comprising the following steps:
[0005] Step 1: pre-process the shell samples, input a positive integer K value, calculate the distance between each pre-processed shell sample and its Kth nearest neighbor through the k-dist function, and draw a k-dist graph;
[0006] Step 2: Get the knee point through the k-dist graph. The distance value corresponding to the knee point in the K-dist graph is the value of Eps.
[0007] Step 3: According to the obtained Eps value, calculate the clustering results under different MinPts values to obtain the optimal MinPts value;
[0008] Step 4: Perform DBSCAN clustering based on the determined Eps and MinPts, take the cluster with the most data objects as the normal reflective area, and merge the other clusters and noise into the abnormal reflective area to detect the abnormal reflective area of the cartridge case primer.
[0009] Furthermore, the pre-processing of the cartridge case sample comprises:
[0010] S1, use KD-tree to find each point Nearest Neighbor Points, constitute The matrix ;in, is a data point in a shell sample, is the set value;
[0011] S2, calculate the covariance matrix , and solve for the eigenvalues of the covariance matrix ;
[0012] S3, take The smallest eigenvalue in , the calculated curvature ;
[0013] S4, set curvature threshold , extract the curvature to satisfy Three-dimensional data points , corresponding to the transformation into two-dimensional data points And store it in a two-dimensional point set , using a two-dimensional point set The fitting radius is R and the center is The circle is calculated for each point Distance to the center ;in, is the coordinate of the center of the fitted circle, is the curvature threshold set;
[0014] S5, find the The smallest A, B, and R are the parameters of the circle; A and B are the X-axis and Y-axis coordinates of the center of the fitted circle, and R is the radius of the fitted circle.
[0015] S6, for each point ,like and , then it is used as the shell Primer area; extract the size of The Primer region of the shell is extracted from the region; is the set value, The depth of the Primer area of the cartridge case.
[0016] Furthermore, the input of a positive integer K value, calculating the distance between each preprocessed cartridge case sample and its Kth nearest neighbor through the k-dist function, and drawing a k-dist graph includes:
[0017] Calculate the distance distribution matrix The value of
[0018]
[0019]
[0020] in, , represents a shell sample The number of data points, is a real symmetric matrix with n rows and n columns, each element of which represents Middle Point to The distance of the points, and It is Point and The three-dimensional coordinates of the data points;
[0021] Pair Matrix After sorting each row in ascending order, we get , the kth closest distance of each point is Values in column K+1:
[0022]
[0023]
[0024] in, Contains a sample of a cartridge case The kth closest distance among all points in Sort in ascending order and plot the k-dist graph.
[0025] Furthermore, the knee point is the point with the largest gradient change in the k-dist image.
[0026] Furthermore, the clustering results under different MinPts values are calculated according to the obtained Eps value to obtain the optimal MinPts value, including:
[0027] According to the obtained Eps value, the MinPts value is changed in the interval [Kd, K+d], and DBSCAN clustering is performed on different MinPts values in turn, where d represents the adjustment amplitude;
[0028] After DBSCAN clustering, record the number of clusters corresponding to each MinPts value, count the frequency of occurrence of each cluster, and take the cluster number CNmax with the highest frequency as the stable result of clustering. Select the minPts value under the cluster number CNmax, and take the median of these values as the optimal MinPts value.
[0029] The beneficial effect of the present invention is that the optimal Eps and MinPts parameters are automatically determined by analyzing the distribution characteristics of each shell sample, thereby avoiding the instability caused by manual adjustment of parameters in the traditional method. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] Figure 1 It is a flow chart of a method for detecting abnormal areas in cartridge case primer measurement based on adaptive DBSCAN clustering;
[0031] Figure 2 Schematic diagram of 3D reconstruction of abnormally reflective shells, where (a) is a top view; (b) is a front view; (c) is a perspective view;
[0032] Figure 3 Results of curvature calculations for different m values, where (a) m is 10; (b) m is 50; (c) m is 100; (d) m is 200;
[0033] Figure 4 This is a schematic diagram of the segmentation results of the Prime area of the shell;
[0034] Figure 5 Schematic diagram of the DBSCAN clustering results of cartridge case and primer, where (a) is a schematic diagram of the original three-dimensional data of cartridge case and primer; (b) is a perspective view of the DBSCAN clustering results, (c) is a top view of the DBSCAN clustering results, and (d) is a front view of the DBSCAN clustering results;
[0035] Figure 6 Schematic diagram of the cluster with the most DBSCAN clustering data, where (a) is a perspective view; (b) is a front view;
[0036] Figure 7 The k-dist diagrams of two cartridge case primers, where (a) is the k-dist diagram of the normal reflective cartridge case primer; (b) is the k-dist diagram of the abnormal reflective cartridge case primer;
[0037] Figure 8 The schematic diagram of clustering results of inputting the obtained Eps and MinPts_best into the DBSACN algorithm for clustering, wherein (a) is the clustering result of the 05 model 54-number cartridge case primer, and (b) is the clustering result of the 95 model 43-number cartridge case primer;
[0038] Fig. 9 Flow chart for detecting abnormal reflective areas of cartridge cases. DETAILED DESCRIPTION
[0039] The technical solution of the present invention is further described in detail below in conjunction with the accompanying drawings, but the protection scope of the present invention is not limited to the following.
[0040] The features and performance of the present invention are further described in detail below in conjunction with the embodiments.
[0041] like Figure 1 As shown, a method for detecting abnormal areas in cartridge case primer measurement based on adaptive DBSCAN clustering comprises the following steps:
[0042] Step 1: pre-process the shell samples, input a positive integer K value, calculate the distance between each pre-processed shell sample and its Kth nearest neighbor through the k-dist function, and draw a k-dist graph;
[0043] Step 2: Get the knee point through the k-dist graph. The distance value corresponding to the knee point in the K-dist graph is the value of Eps.
[0044] Step 3: According to the obtained Eps value, calculate the clustering results under different MinPts values to obtain the optimal MinPts value;
[0045] Step 4: Perform DBSCAN clustering based on the determined Eps and MinPts, take the cluster with the most data objects as the normal reflective area, and merge the other clusters and noise into the abnormal reflective area to detect the abnormal reflective area of the cartridge case primer.
[0046] The pre-processing of the cartridge case sample comprises:
[0047] S1, use KD-tree to find each point Nearest Neighbor Points, constitute The matrix ;in, is a data point in a shell sample, is the set value;
[0048] S2, calculate the covariance matrix , and solve for the eigenvalues of the covariance matrix ;
[0049] S3, take The smallest eigenvalue in , the calculated curvature ;
[0050] S4, set curvature threshold , extract the curvature to satisfy Three-dimensional data points , corresponding to the transformation into two-dimensional data points And store it in a two-dimensional point set , using a two-dimensional point set The fitting radius is R and the center is The circle is calculated for each point Distance to the center ;in, is the coordinate of the center of the fitted circle, is the curvature threshold set;
[0051] S5, find the The smallest A, B, and R are the parameters of the circle; A and B are the X-axis and Y-axis coordinates of the center of the fitted circle, and R is the radius of the fitted circle.
[0052] S6, for each point ,like and , then it is used as the shell Primer area; extract the size of The Primer region of the shell is extracted from the region; is the set value, The depth of the Primer area of the cartridge case.
[0053] The input of a positive integer K value, the k-dist function is used to calculate the distance between each preprocessed cartridge case sample and its Kth nearest neighbor, and the k-dist graph is drawn, including:
[0054] Calculate the distance distribution matrix The value of
[0055]
[0056]
[0057] in, , represents a shell sample The number of data points, is a real symmetric matrix with n rows and n columns, each element of which represents Middle Point to The distance of the points, and It is Point and The three-dimensional coordinates of the data points;
[0058] Pair Matrix After sorting each row in ascending order, we get , the kth closest distance of each point is Values in column K+1:
[0059]
[0060]
[0061] in, Contains a sample of a cartridge case The kth closest distance among all points in Sort in ascending order and plot the k-dist graph.
[0062] The knee point is the point with the largest gradient change in the k-dist image.
[0063] The clustering results under different MinPts values are calculated according to the obtained Eps value to obtain the optimal MinPts value, including:
[0064] According to the obtained Eps value, the MinPts value is changed in the interval [Kd, K+d], and DBSCAN clustering is performed on different MinPts values in turn, where d represents the adjustment amplitude;
[0065] After DBSCAN clustering, record the number of clusters corresponding to each MinPts value, count the frequency of occurrence of each cluster, and take the cluster number CNmax with the highest frequency as the stable result of clustering. Select the minPts value under the cluster number CNmax, and take the median of these values as the optimal MinPts value.
[0066] Specifically, the shell data set used in this paper is collected by a self-made three-dimensional trace acquisition device based on a line laser displacement sensor. The device uses a semiconductor laser source with a wavelength of 405nm, which can accurately scan the traces on the bottom of the shell. The relative position of the shell surface trace and the linear laser displacement sensor is controlled by stepper motor scanning. Each step value of the stepper motor is 4μm, which ensures a fine scanning process. Each linear laser scan can obtain 1024 data points, thereby accurately restoring the shape of the shell. In order to better visualize the shell traces, the stepper motor collects a scan line every 7 triggers, and the entire acquisition process includes 1024 scan lines. The data is connected to the computer through a Gigabit Ethernet interface for subsequent data analysis and processing. The data of each shell sample consists of 1024×1024 data points, with an X-axis resolution of 29.5μm, a Y-axis resolution of 28.0μm, and a Z-axis resolution of 0.9μm.
[0067] This dataset contains 2038 sets of 3D trace data from different firearms, including the ZLS-05police revolver, QBU-88 sniper rifle, QSZ-92 pistol, and QBZ-95 infantryrifle. Among these data, 1078 sets showed normal reflection, and another 960 sets showed abnormal reflection. In our previous work, based on the calculation and analysis of the three-dimensional grayscale co-occurrence matrix, we determined whether there was abnormal reflection in the collected samples. This method successfully classified the shell data with normal reflection and abnormal reflection into two categories. In this paper, we mainly process and analyze the 960 sets of shell data with abnormal reflection to further detect the area of measurement abnormality.
[0068] Usually, the measurement abnormal area of the cartridge case is located on its smooth arc surface. Figure 2 The 3D reconstruction of a cartridge case with measurement anomaly is shown, with a being a top view, b being a front view, and c being a perspective view. It can be clearly seen from these views that there are two measurement anomaly areas in the cartridge case. Specifically, the red box marks the measurement anomaly area at the outer ring boundary of the cartridge case Primer, and the orange box marks the measurement anomaly area at the edge of the cartridge case Firing pin impression.
[0069] In the inspection of cartridge case marks, marks located at the outer ring boundary of the cartridge case Primer are usually not used as the main basis for judgment. In comparison, the firing pin impression marks can more accurately reflect the surface morphology and structural characteristics of gun parts due to their higher stability and accuracy. Therefore, in the inspection of cartridge case marks, the firing pin impression marks have become an important judgment criterion. This article targets all cartridge cases with measurement anomalies. Figure 2 The abnormal area shown in the orange box is detected. In addition, in order to reduce the impact of measurement anomalies in the red box area on the detection results, this paper preprocesses the data. By adopting a three-dimensional segmentation method based on curvature threshold, the Primer part of the shell is effectively segmented from other areas, thereby narrowing the subsequent detection range.
[0070] There is a significant depth change at the Primer outer ring boundary of the shell, so the curvature of this area will also change significantly. Therefore, the area with a larger curvature can be regarded as the boundary of the Primer outer ring. In order to accurately segment the Primer area of the shell, the curvature change is first used to determine the position of the outer ring boundary. Then the least squares method is used to fit the boundary in a circle to obtain the center point of the Primer area, thereby separating the Primer area from other areas. The specific implementation process of data preprocessing is as follows:
[0071] (1) Use KD-tree to find each point Nearest Neighbor Points, constitute The matrix ;in, is a data point in a shell sample, The value of is determined by the user;
[0072] (2) Calculate the covariance matrix , and solve for the eigenvalues of the covariance matrix ;
[0073] (3) Take The smallest eigenvalue in , the calculated curvature , The smaller it is, the flatter the neighborhood is. The larger it is, the greater the fluctuation of the neighborhood;
[0074] (4) Setting the curvature threshold , extract the curvature to satisfy Three-dimensional data points , corresponding to the transformation into two-dimensional data points And store it in a two-dimensional point set , using a two-dimensional point set The fitting radius is R and the center is The circle is calculated for each point Distance to the center ;
[0075] in, is the coordinate of the center of the fitted circle, The value of is determined by the user.
[0076] (5) Find the value such that The smallest A, B, and R determine the parameters of the circle;
[0077] Among them, A and B are the X-axis and Y-axis coordinates of the center of the fitting circle, and R is the radius of the fitting circle.
[0078] (6) For each point ,like and , then it is used as the shell Primer area; extract the size of The area of the shell is effectively segmented into the Primer area;
[0079] in, The value of is determined by the user, and H is the depth range of the area.
[0080] In order to determine the The value of m is set to 10, 50, 100 and 200 respectively, and the curvature value of the corresponding shell is calculated. Different colors are used for rendering according to the size of the curvature. Figure 3 As shown in the figure, the curvature calculation results under different m values. It can be observed that the larger the m value, the easier it is to distinguish the Primer outer ring boundary. However, a larger m value will also increase the amount of calculation. After observing the results when m is 50, 100 and 200, it is found that all three can effectively distinguish the Primer outer ring boundary. Considering the efficiency of calculation, this paper finally sets the m value to 50.
[0081] exist Figure 3 In (b), the curvature value of the outer ring boundary of the Primer ranges from [0.048, 0.25], and the curvature values of other areas are generally lower than 0.048. Therefore, in order to effectively distinguish the boundary of the primer, in step (4), this paper sets the curvature threshold The value of L is set to 0.048 to extract the boundary of the outer ring of the Primer and perform a circular fit on it. In step (6), the value of L is set to 0.15 cm to extract a 3 cm × 3 cm area as the Primer area of the cartridge case. Figure 4 The segmentation results of the Primer region of the shell are shown. The following will detect measurement anomalies in the Primer region of the shell.
[0082] In this part, we first outline the traditional DBSCAN algorithm and perform DBSCAN clustering analysis on shell samples. Then, we propose an automated abnormal region detection method and describe in detail the process of adaptively determining the parameters of the DBSCAN algorithm in this method. Finally, we introduce the application method and specific process of the DBSCAN clustering algorithm based on adaptive parameters in the detection of abnormal regions in measurements.
[0083] The DBSCAN algorithm (Density-Based Spatial Clustering of Applications with Noise) is a widely used density-based clustering algorithm. Its main goal is to effectively identify clustering structures of arbitrary shapes when processing high-dimensional space or non-spatial data with noise. Specifically, the DBSCAN algorithm divides clusters by detecting high-density areas in the data space, and regards isolated points with lower density as noise, thereby achieving effective clustering of data.
[0084] Use in the text represents the set of all points in a shell sample, where point ,parameter and Determined by the user, it is used to describe the density of sample distribution in the neighborhood. The parameter EPS is the threshold used to define the neighborhood radius of a data point, which means the space within the EPS range with a certain data point as the center. Indicates a point centered The minimum number of points contained in the neighborhood. The detailed description and parameter definitions of DBSCAN are as follows:
[0085] Definition 1 (Eps neighborhood) For a data point ,point Neighborhood Defined as a point As the core, Any point in the area with radius of The neighborhood is defined as:
[0086]
[0087]
[0088] in, is a collection of shell samples; express Two data points and Point The distance between and They are points and Point The three-dimensional coordinates of the points; Include Center and Point Distance not greater than All points.
[0089] Definition 2 (core points and boundary points) Given a set of shell samples , for the data point , set the neighborhood density threshold If you click of The neighborhood contains at least , then the point is called the core point; non-core points but in a core point Points within the neighborhood are called boundary points. The definition of the core point is:
[0090]
[0091] in, Yes of The number of neighboring points.
[0092] Definition 3 (Density Directness) Given a shell sample set If you click Located at point of In the neighborhood, It must be established, I can't say anything It is by point Density is direct, unless point It is also the core point.
[0093] Definition 4 (Density-reachable) Given a shell sample set , when there is a data point set , , if point It is by point The density reaches directly, then it is called point It is by point Density reachable. Density reachable satisfies transitivity and is also asymmetric.
[0094] Definition 5 (Density Connected) Given a set of shell samples , for point and Point If there is a core point , Make the data points and Point It is by point The density can be reached, then the point and Point Density connected. Density connected is symmetric.
[0095] Definition 6 (Cluster) Given a shell sample set , starting from any core point, all points that are density-reachable from this point form a cluster.
[0096] Definition 7 (Noise Point) Given a shell sample set , if point does not belong to any cluster, then the point is a noise point, that is
[0097]
[0098] in, is a set of noise points, Represents a collection of shell samples The i-th cluster in .
[0099] DBSCAN checks each data point neighborhood to perform cluster search. of The neighborhood contains at least point, then take that point As the core point, a new cluster is created. Then, starting from these core points, iteratively expands and collects density-reachable points, which may involve the merging of a new cluster. Then, the clustering process continues until no new points can be added to the existing clusters. On the other hand, if a point QUOTE QUOTE The number of points in the neighborhood is less than , then the point is considered as a noise point. However, if the point is density-reachable from a core point, it may be included in other clusters.
[0100] In the DBSCAN algorithm, the parameters and Based on the empirical value, DBSCAN clustering is performed on the primer of a cartridge case (92 model 23 number). Take 0.1, Take 15. Figure 5 The results of DBSCAN clustering of cartridge case primers are shown. a is the original 3D data of cartridge case primers; b, c, and d are the perspective view, top view, and front view of the DBSCAN clustering results respectively;
[0101] from Figure 5It can be seen that the cartridge case primer is divided into three clusters by DBSCAN density clustering, namely C1, C2, and C3. Among them, cluster C1 is normal reflection data, cluster C2 is abnormal data reflecting upward, and cluster C3 is abnormal data reflecting downward. For the cartridge case data scanned by three-dimensional laser scanning, the density of the measured abnormal area may be similar to that of the normal reflection area, resulting in the possibility of two or three clusters. These clusters include both normal reflection areas and abnormal reflection areas. Since the number of data points in the cluster of the normal reflection area is much larger than that of the abnormal reflection area, and the normal reflection area is continuous, it can be considered that the cluster with the most data points represents the normal reflection area. Specifically, after using DBSCAN density clustering, by comparing the number of data points in each cluster, it is determined that the cluster with the most data points is the normal reflection area, and the remaining clusters are regarded as abnormal reflection areas. Figure 6 The result of retaining only the most clusters of data is shown, a and b are perspective and front views respectively. It further verifies that the DBSCAN density clustering method can effectively distinguish normal and abnormal data, successfully extract normal data without measurement anomalies, and thus realize the detection of measurement abnormality areas.
[0102] However, the two parameter settings of the DBSCAN algorithm usually need to be determined through repeated trials and adjustments. The whole process is not only cumbersome and time-consuming, but also requires users to have high professional knowledge and experience. In addition, when the data set is unevenly distributed, the performance of the DBSCAN algorithm is not ideal. When there are only a small number of density-reachable points between two clusters, the algorithm may mistakenly merge them into one cluster. In addition, when faced with high-dimensional and large-scale data sets, the DBSCAN algorithm needs to traverse the data set multiple times to identify density-reachable points, which significantly increases its computational complexity.
[0103] Specifically, when Eps is fixed, if MinPts is set too large, the number of core points will decrease, which may cause some smaller clusters to be misclassified as noise and discarded; if MinPts is set too small, it may cause too many non-core points to be misclassified as core points, thereby incorrectly classifying the noise into the cluster. Similarly, when MinPts is fixed, if Eps is set too small, a large number of data points may be misidentified as noise, or even points that should belong to the same cluster may be split into multiple clusters; if Eps is set too large, it may cause noise points to be incorrectly classified into clusters, or even merge multiple clusters that should be independent together. When dealing with high-dimensional or complex data sets, the traditional DBSCAN method may not be able to maintain a stable clustering effect. Therefore, how to automatically select the optimal solution for the Eps and MinPts parameters has become an important research direction for improving the clustering performance of the DBSCAN algorithm.
[0104] In order to solve the above problems, this paper proposes a new method for adaptively determining the parameters EPS and MinPts based on the DBSCAN algorithm. The core idea of this method is to dynamically adjust these two parameters according to the statistical characteristics of shell samples, thereby improving the accuracy and stability of clustering effects.
[0105] The common method of automatically calculating EPS parameters is through Function that calculates the distance between each data point in the sample and its kth nearest neighbor. The sharp change in distance in the graph usually corresponds to a suitable Eps value. Although this Eps value depends on K, it does not fluctuate significantly with the change of K. Therefore, this study uses the K-dist function to automatically calculate the Eps parameter, aiming to analyze the impact of different k values on the clustering results. The following are the specific steps to generate the KK-dist function:
[0106] First, calculate the distance distribution matrix The value of
[0107]
[0108]
[0109] in, , represents a shell sample The number of data points. is a real symmetric matrix with n rows and n columns, each element of which represents Middle Point to The distance of points. and are the three-dimensional coordinates of the two data points. A laser measurement anomaly recognition method based on DBSCAN and improved PointNet
[0110] Next, the matrix After sorting each row in ascending order, we get , the kth closest distance of each point is The value of the K+1th column.
[0111]
[0112]
[0113] in, Contains a sample of a cartridge case The kth closest distance to all points in .
[0114] Finally, Sort in ascending order and draw the k-dist image, represented by VK(x)
[0115] The sort value of the Kth parameter in the function. According to the above steps, if Figure 7 The following are the results of generating normal reflection (a) and abnormal reflection (b) of the cartridge case primer: Fig. This figure selects K = 4, K = 8, and K = 15 as the experimental parameter values for the Kth nearest neighbor distance.
[0116] pass Figure 7 It is observed that when the K value is small (such as k=4), the calculated distance is small; and when the k value is large (such as k=15), the calculated distance increases significantly. When K takes different values, the distance change pattern of the k-dist graph is similar, so the value of K will not seriously affect the clustering result. In particular, there is often a "knee point" in the k-dist graph, indicating an area where the distance changes dramatically. The knee point is usually located The end of the graph and is used to determine the DBSCAN algorithm The knee point represents the area where the density of data points changes dramatically, and its location and characteristics reflect the structure of the dataset. Generally speaking, the distance after the knee point increases sharply, which means that these data points may be regarded as noise. When dealing with datasets with clusters of similar density, The plot usually has only one knee point, and its location and size depend on the density of the data set. For discrete data, due to the limited interval, the difference approximation method is less accurate and may result in multiple inflection points in the k-dist plot. In this case, it can be observed that The position where the gradient changes most dramatically in the graph has the largest inflection point and can be used to determine Reference to the value.
[0117] However, the VDBSCAN algorithm sets MinPts to the K value on this basis, which may be affected by data fluctuations. In order to improve the reliability of parameter selection, this paper selects a range as the candidate interval of MinPts based on the preliminary setting of the K value. In this way, it can be adjusted according to the different structures and fluctuation characteristics of the data set, so as to better adapt to data changes and reduce the instability of the algorithm.
[0118] After determining the candidate interval of MinPts, analyze the clustering effect under different MinPts values. For the cluster with the largest number of occurrences, the clustering result is considered stable, and then the optimal solution of MinPts is determined in reverse. The steps to calculate the optimal solution of the parameter Minpts are as follows:
[0119] First, according to the value of parameter Eps obtained above, the value of MinPts is changed in the interval [Kd, K+d], and DBSCAN clustering is performed for different MinPts values in turn.
[0120] Wherein, d represents the adjustment range, and its value is determined by the user.
[0121] Then, after DBSCAN clustering, record the number of clusters corresponding to each MinPts value, further count the frequency of occurrence of each cluster, and select the cluster number CNmax with the highest frequency as the stable result of clustering.
[0122] Finally, choose the number of clusters Next, we will calculate the minPts value for , and take the median of these values as the final .
[0123] Select two cartridge cases as examples and perform the above steps to confirm the Eps and MinPts parameters. Among them, when calculating the parameter value of Eps using the k-dist function method, the value of K is 8; when calculating the parameter value of MinPts, the value of d is 3, and the value of MinPts varies in the interval [5,11]. The clustering results corresponding to different MinPts values are recorded respectively. Table 1 records the number of clusters corresponding to different MinPts values of the 05 model 54 serial number cartridge case primer; Table 2 records the number of clusters corresponding to different MinPts values of the 95 model 43 serial number cartridge case primer.
[0124] Table 1 The number of clusters corresponding to different MinPts values of 05 model 54 cartridge primer
[0125]
[0126] Table 2 The number of clusters corresponding to different MinPts values of 95 model 43 cartridge primer
[0127]
[0128] From Table 1, we can see that for the 05 model 54 cartridge case primer, the number of clusters is 5, and the number of occurrences is the largest. So the clustering result at this time is considered to be stable. We further calculate the corresponding MinPts with a cluster number of 5, and calculate the median as the optimal solution MinPts_best. Here, MinPts_best = 7. From Table 2, we can see that for the 95 model 43 cartridge case primer, the number of clusters is 2, and the number of occurrences is the largest. So the clustering result at this time is considered to be stable. We further calculate the median MinPts with a cluster number of 2, and use it as the optimal solution MinPts_best. Here, The calculated value is 7.5; MinPts in the DBSCAN algorithm should be a positive integer, so we Round down to 7.
[0129] The above obtained and Input DBSACN algorithm for clustering, the clustering results are as follows Figure 8 As shown in the figure. (a) is the clustering result of the 05 model 54 serial number cartridge case primer, and (b) is the clustering result of the 95 model 43 serial number cartridge case primer.
[0130] from Figure 8 It can be seen that the normal reflection area belongs to the same cluster, while the abnormal reflection area may be in the same cluster or scattered in multiple clusters. Therefore, in this paper, the cluster with the most data objects is taken as the normal reflection area, and the remaining clusters are combined with noise as the abnormal reflection area to realize the detection of the abnormal reflection area of the cartridge case primer.
[0131] The implementation steps of the method proposed in this paper are as follows: First, input a positive integer K value, calculate the distance between each shell sample and its Kth nearest neighbor through the k-dist function, and draw a k-dist graph; then, through the second-order difference analysis of the k-dist graph, identify the "knee point" with sharp changes, and the corresponding distance value of this point in the K-dist graph will be used as the value of Eps; then, conduct multiple experiments, calculate the clustering results under different MinPts values, and finally select the optimal MinPts value. Finally, use the adaptively determined Eps and MinPts to perform DBSCAN clustering, and take the cluster with the most data objects as the normal reflective area, and merge the other clusters with noise into abnormal reflective areas. The flowchart of abnormal area detection in shell measurement is shown in the figure. Fig. 9 shown.
[0132] The implementation steps of the method proposed in this paper are as follows: First, input a positive integer K, calculate the distance between each shell sample and its Kth nearest neighbor, obtain the K-dist function and draw the K-dist graph; then, by performing a second-order difference analysis on the K-dist graph, identify the "knee point" with a sharp change, and the distance value corresponding to this point is used as the selected value of Eps; then, conduct multiple experiments, record the clustering results under different MinPts values, and finally determine the final parameter MinPts. Finally, use the adaptively determined parameters Eps and MinPts to perform DBSCAN algorithm clustering, and take the cluster with the most data points as the normal reflective area, and merge the remaining clusters with noise into abnormal reflective areas. The flowchart of abnormal area detection of shell measurement is shown in Figure 9.
[0133] Fig. 9The process of adaptively determining EPS and Minpts of the DBSCAN algorithm is given in the following. The input parameters include the data set and the user settings. Through this adaptive method, Eps and MinPts can be automatically selected according to the different characteristics of the data, avoiding the trouble of manual parameter adjustment, thereby improving the clustering accuracy and robustness of the DBSCAN algorithm in practical applications.
Claims
1. A method for detecting abnormal areas in cartridge case primer measurement based on adaptive DBSCAN clustering, characterized in that: The steps include: Step 1: pre-process the shell samples, input a positive integer K value, calculate the distance between each pre-processed shell sample and its Kth nearest neighbor through the k-dist function, and draw a k-dist graph; Step 2: Get the knee point through the k-dist graph. The distance value corresponding to the knee point in the K-dist graph is the value of Eps. Step 3: According to the obtained Eps value, calculate the clustering results under different MinPts values to obtain the optimal MinPts value; Step 4: Perform DBSCAN clustering based on the determined Eps and MinPts, take the cluster with the most data objects as the normal reflection area, and merge the other clusters and noise into abnormal reflection areas, so as to detect the abnormal reflection area of the cartridge case primer; The pre-processing of the cartridge case sample comprises: S1, use KD-tree to find each point Nearest Neighbor Points, constitute The matrix ;in, is a data point in a shell sample, is the set value; S2, calculate the covariance matrix , and solve for the eigenvalues of the covariance matrix ; S3, take The smallest eigenvalue in , the calculated curvature ; S4, set curvature threshold , extract the curvature to satisfy Three-dimensional data points , corresponding to the transformation into two-dimensional data points And store it in a two-dimensional point set , using a two-dimensional point set The fitting radius is R and the center is The circle is calculated for each point Distance to the center ;in, is the coordinate of the center of the fitted circle, is the curvature threshold set; S5, find the The smallest A, B, and R are the parameters of the circle; A and B are the X-axis and Y-axis coordinates of the center of the fitted circle, and R is the radius of the fitted circle. S6, for each point ,like and , then it is used as the shell Primer area; extract the size of The Primer region of the shell is extracted from the region; is the set value, is the depth of the Primer area of the cartridge case; The input of a positive integer K value, the k-dist function is used to calculate the distance between each preprocessed cartridge case sample and its Kth nearest neighbor, and the k-dist graph is drawn, including: Calculate the distance distribution matrix The value of in, , represents a shell sample The number of data points, is a real symmetric matrix with n rows and n columns, each element of which represents Middle Point to The distance of the points, and It is Point and The three-dimensional coordinates of the data points; Pair Matrix After sorting each row in ascending order, we get , the kth closest distance of each point is Values in column K+1: in, Contains a sample of a cartridge case The kth closest distance among all points in Sort in ascending order and draw a k-dist image; the knee point is the point with the largest gradient change in the k-dist image; The clustering results under different MinPts values are calculated according to the obtained Eps value to obtain the optimal MinPts value, including: According to the obtained Eps value, the MinPts value is changed in the interval [Kd, K+d], and DBSCAN clustering is performed on different MinPts values in turn, where d represents the adjustment amplitude; After DBSCAN clustering, record the number of clusters corresponding to each MinPts value, count the frequency of occurrence of each cluster, and take the cluster number CNmax with the highest frequency as the stable result of clustering. Select the minPts value under the cluster number CNmax, and take the median of these values as the optimal MinPts value.
Citation Information
Patent Citations
Topographical ballistic identification with section profiles and comparison system
CA3158279A1
cCartridge case primer three-dimensional trace feature acquisition device and method
CN111442738A