A tool prediction method and tool prediction system based on adaptive sampling
By combining adaptive sampling of workpiece features with sampling of the furthest point with bi-branch feature enhancement and attention mechanism, the problem of accuracy and efficiency in CNC tool selection is solved, and efficient CNC tool prediction is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- DONGGUAN JIR FINE MACHINERY
- Filing Date
- 2026-03-24
- Publication Date
- 2026-06-23
Smart Images

Figure CN122263012A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of CNC technology, specifically a tool prediction method based on workpiece feature perception and adaptive sampling. Background Technology
[0002] As manufacturing shifts from mass production to mass customization, personalized products are being tailored to individual needs. Users upload computer-aided design (CAD) models to online platforms, where engineers select appropriate CNC cutting tools based on the CAD data, and then obtain cost and delivery time estimates. However, the ability to quickly and accurately select CNC cutting tools has become a limiting factor in this process. This is because correctly selecting CNC cutting tools requires engineers to have a thorough understanding of the workpiece, which typically requires extensive experience. Furthermore, different engineers may have different perspectives on different workpieces, making it difficult to select CNC cutting tools accurately and quickly.
[0003] In recent years, enterprises have accumulated a large amount of data, providing a foundation for computer-aided tool selection. Among them, point clouds, as an important three-dimensional data form for describing the geometry and surface features of workpieces, have received widespread attention in manufacturing and precision engineering. However, point clouds in industrial scenarios are often huge in scale (up to millions of points), resulting in high processing costs and energy consumption. At the same time, there is also a scale gap where "academic models are mostly based on small standard datasets and are difficult to directly transfer to dense industrial point clouds." Summary of the Invention
[0004] The purpose of this invention is to provide a CNC tool prediction method based on workpiece feature perception and adaptive sampling, so as to solve the problems mentioned in the background art.
[0005] To achieve the above objectives, the present invention provides the following technical solution:
[0006] An adaptive sampling tool prediction method, the method comprising:
[0007] Step S1: Obtain point cloud data of historical workpieces after processing, and then input additional workpiece quality information. In the preprocessing stage, use workpiece feature perception adaptive sampling to perform differentiated sampling on key processing areas to obtain representative point cloud data and its workpiece feature vector.
[0008] Step S2: Input the sampled workpiece point cloud data into the backbone network for layer-by-layer feature learning. In the feature learning process, a dual-branch feature enhancement module is introduced to divide the point cloud features into a global geometric branch and a local detail branch in the channel dimension. The global geometric branch maintains the overall geometric consistency, while the local detail branch classifies local features into levels and generates frequency domain attention weights to adaptively enhance fine-grained structural information such as texture and edges. The outputs of the two branches are then concatenated, and then a four-layer residual MLP block is used to extract deeper features layer by layer.
[0009] Step S3: The features extracted in step S2 and the workpiece feature vector in step S1 are used to generate spatial attention weights and channel attention weights respectively through the workpiece feature dual attention mechanism. The point cloud features are weighted and enhanced, and then concatenated with the quality information in step S1.
[0010] Step S4: Input the fused features obtained in step S3 into the classifier, output the recommended CNC tool category results, and re-input the results into the backbone network for iterative learning.
[0011] Further technical solutions involve training the backbone network, which is a WFASNet model. During training, the cross-entropy loss function and Adam optimizer are used to optimize the network, and a cosine annealing learning rate scheduling strategy is used to improve convergence speed and accuracy.
[0012] In a further technical solution, in step S2, the global geometry branch uses affine transformation to extract features to maintain overall geometric consistency, and the local detail branch performs Fourier transform on the local features to divide the spectrum into low-frequency, mid-frequency and high-frequency components and splices them together. Attention weights are generated through linear mapping and Sigmoid to modulate and enhance the local features.
[0013] In a further technical solution, in step S1, the quality information consists of descriptions of materials and quality properties, including elastic modulus [GPa], elongation at break [%], yield strength [MPa], Brinell hardness [HB], thermal diffusivity [m3 / s], dimensional tolerance [mm], and the arithmetic mean surface roughness of the part [Sa].
[0014] A further technical solution involves adaptive sampling of workpiece features, which includes three stages: workpiece geometric feature extraction, hierarchical weight allocation, and adaptive sampling. Among these, different processing feature regions are identified through connected component analysis. For each workpiece cutting region, geometric parameters such as cutting depth, feature scale, shape regularity, local and global surface roughness are calculated and encoded into a workpiece feature vector.
[0015] In a further technical solution, in step S3, the workpiece feature vector input from the dual attention mechanism and the features extracted by the dual-branch feature enhancement module are encoded by a multilayer perceptron and then concatenated to generate workpiece fusion features. Spatial attention weights and channel attention weights are then generated from these workpiece features, and the point cloud features are weighted both spatially and channel-wise, thereby achieving multimodal fusion guided by workpiece features.
[0016] In a further technical solution, in step S1, the sampling strategy adopts a hybrid approach of workpiece feature adaptive sampling and farthest point sampling. Workpiece feature adaptive sampling is used to focus on key processing areas, while farthest point sampling is used to further enhance the representativeness and generalization ability of sampling points and reduce information loss and category confusion caused by excessive sampling concentration.
[0017] A tool prediction system, comprising:
[0018] The data acquisition module is used to acquire workpiece point cloud data and quality information;
[0019] An adaptive sampling module performs the adaptive sampling operation as described in claim 1;
[0020] The feature processing module includes the dual-branch feature enhancement module and the workpiece feature dual attention mechanism as described in claim 1;
[0021] The classification decision module outputs the tool category prediction results.
[0022] The beneficial effects of this invention are:
[0023] This invention enables the rapid and accurate selection of CNC cutting tools based on workpiece data;
[0024] 1. By adopting a hybrid sampling strategy of Workpiece Feature Adaptive Sampling (WFAS) and Farthest Point Sampling (FPS), the problem of traditional sampling methods failing to retain key geometric details on industrial point cloud datasets is effectively alleviated, information loss caused by sampling is reduced and accuracy is improved, with an information loss rate reduced by 68.5% compared to traditional methods.
[0025] 2. Through the global affine transformation and local Fourier transform of the dual-branch feature enhancement module (DBFEM), the model can simultaneously enhance the overall shape representation and multi-scale detail representation, thereby improving its adaptability to complex topological structures.
[0026] 3. By using WFDAM's spatial and channel dual attention, we achieve deep fusion of point cloud geometric information and quality information, which significantly reduces misclassification and improves stability in engineering scenarios. Finally, we fuse the enhanced global point cloud features with the workpiece quality / material features and input them into the classifier to output the probability of each category, thereby enabling automatic selection of tool types such as milling cutters, roughing tools, drilling tools, boring tools, and grinding wheels.
[0027] Other features and advantages of the present invention will be described in detail in the following detailed description section. Attached Figure Description
[0028] Figure 1 The process diagram of this invention Figure 1 .
[0029] Figure 2 The process of this invention Figure 2 .
[0030] Figure 3 The confusion matrix diagram of this invention. Detailed Implementation
[0031] The technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention.
[0032] Please refer to Figures 1-3 ;
[0033] The selection of CNC cutting tools is a crucial aspect of CNC machining, affecting not only machine tool efficiency but also the quality of the workpiece. Currently, CNC machine tool control software largely relies on professionals to select tools based on workpiece geometry. This process is not only labor-intensive but also struggles to guarantee accuracy. Specifically, CNC cutting tools include at least turning tools, milling cutters, drilling tools, and grinding wheels.
[0034] To address the aforementioned shortcomings of existing technologies, this invention provides a workpiece feature adaptive sampling tool prediction method, which includes the following steps:
[0035] Step S1, Data Preprocessing: The point cloud of the processed workpiece surface is represented by voxels, and a 100×100×100 three-dimensional spatial representation of the workpiece geometry is constructed as the point cloud data of the historical workpiece after processing. Then, quality information describing material and quality properties is introduced, including elastic modulus [GPa], elongation at break [%], yield strength [MPa], Brinell hardness [HB], thermal diffusivity [m3 / s], dimensional tolerance [mm], and the arithmetic mean surface roughness of the part area [Sa].
[0036] The table below lists the categories of CNC cutting tools, the corresponding workpiece feature types, and their achievable surface roughness and dimensional tolerance ranges:
[0037] The quality information of the workpiece is made into a 1×7 array and used as the point cloud feature. In the preprocessing stage, adaptive sampling is performed using workpiece feature perception to perform differentiated sampling on key processing areas, so as to obtain representative point cloud features and workpiece feature vectors.
[0038] Furthermore, the sampling strategy adopts a hybrid approach of Workpiece Feature Adaptive Sampling (WFAS) and Farthest Point Sampling (FPS). Adaptive sampling is used to focus on key processing areas, while farthest point sampling is used to further enhance the representativeness and generalization ability of sampling points, and reduce information loss and category confusion caused by excessive sampling concentration. Preferably, the hybrid sampling is to first perform adaptive sampling, and then perform farthest point sampling on its sampling results. The WFPS algorithm divides the workpiece surface into four priority regions through a hierarchical weight allocation strategy: key feature end face (weight 40), workpiece edge contour (weight 30), workpiece internal structure (weight 10), and ordinary surface (weight 20), thereby adaptively enhancing the preservation of key geometric details during sampling.
[0039] Furthermore, adaptive sampling comprises three stages: workpiece geometric feature extraction, hierarchical weight allocation, and adaptive sampling. Specifically, it identifies different machining feature regions through connected component analysis, calculates geometric parameters such as feature depth, feature scale, shape regularity, and local and global surface roughness for each cutting region, and encodes them into a workpiece feature vector. More specifically, the Workpiece Feature Adaptive Sampling (WFPS) key region retention mechanism assigns different importance weights to different structural regions such as edges, interiors, bottoms, and surfaces through workpiece geometric feature extraction and hierarchical weight allocation, and normalizes these weights into a sampling probability distribution. This ensures that key machining regions obtain higher sampling density, thereby alleviating the loss of key geometric information caused by traditional sampling.
[0040] Step S2, Feature Extraction: The sampled workpiece point cloud features are input into the backbone network for layer-by-layer feature learning. A dual-branch feature enhancement module (DBFEM) is introduced during the feature learning process. The Fourier spectrum amplitude of the local point cloud features is divided into three frequency bands—low frequency (25%), mid frequency (25%), and high frequency (50%)—in a 1:1:2 ratio to capture geometric information at different scales. The core idea of the dual-branch feature enhancement module is to divide the input features into a global geometric branch and a local detail branch according to their semantic attributes, and design corresponding enhancement strategies for each branch: the global geometric branch maintains overall geometric consistency; the local detail branch performs hierarchical classification of local features, generating frequency domain attention weights to adaptively enhance fine-grained structural information such as texture and edges. The outputs of the two branches are then concatenated, and subsequently, a four-layer residual MLP block is used to extract deeper features layer by layer.
[0041] Furthermore, given the input point cloud features X ∈ R^(B×N×K×C), we first separate them along the channel dimension: X_global ∈ R^(B×N×K×C_global) represents global geometric features; X_local ∈ R^(B×N×K×C_local) represents local detail features.
[0042] The global geometric branch primarily describes the overall shape, spatial distribution, and geometric structure of the point cloud. These features exhibit strong spatial consistency and linear relationships. Therefore, we employ traditional affine transformations to process global features, preserving their geometric consistency.
[0043] The local detail branch performs a Fourier transform on the local features, divides the spectrum into low-frequency, mid-frequency, and high-frequency components, and splices them together. Then, it generates attention weights through linear mapping and Sigmoid, and modulates and enhances the local features.
[0044] Furthermore, the backbone network is trained before being input into the main network. The backbone network is a WFASNet model. During the training process, the cross-entropy loss function and Adam optimizer are used to optimize the network, and the learning rate scheduling strategy of cosine annealing is used to improve the convergence speed and accuracy.
[0045] Step S3, workpiece feature fusion and attention enhancement: Point cloud data contains rich three-dimensional spatial information, but the contribution of points at different spatial locations to the classification task varies greatly. Some key areas are more important for classification, while noise points or background points may interfere with the model's judgment. Different channels of point cloud features encode different types of information, and these channels have significantly different discriminative abilities for specific classification tasks. Therefore, spatial attention mechanism and channel attention mechanism are introduced.
[0046] More specifically, the features extracted in step S2 and the workpiece feature vector in step S1 are used to generate spatial attention weights and channel attention weights respectively through workpiece feature dual attention (WFDAM). This is then used to perform weighted enhancement of the point cloud features through broadcast multiplication, enabling the model to dynamically adjust its attention to point cloud information according to the importance of workpiece features. Finally, the quality information is concatenated to achieve deep fusion of geometric point cloud information and manufacturing-related meta-features. The formula is expressed as:
[0047]
[0048]
[0049]
[0050]
[0051] in, , and The three components representing workpiece feature information are geometric information, roughness, and tilt. Indicates feature fusion; and This represents the spatial attention and channel attention weight matrix. and This represents spatial attention weights and channel attention weights.
[0052] Furthermore, the workpiece feature vector input from the dual attention mechanism and the features extracted by the dual-branch feature enhancement module are encoded by a multilayer perceptron and then concatenated to generate workpiece fusion features. Spatial attention weights and channel attention weights are then generated from these workpiece features, and the point cloud features are weighted both spatially and channel-wise, thereby achieving multimodal fusion guided by workpiece features.
[0053] Step S4, Output Results: Input the fused data obtained in step S3 into the classifier and output the recommended tool category results;
[0054] In addition, the results output from step S4 are re-inputted into the backbone network for iterative learning.
[0055] This example further explains the model training:
[0056] During model training, the cross-entropy loss function is used to evaluate classification errors. Combined with the AdamW optimizer, the learning rate is dynamically adjusted to improve the convergence speed and accuracy of the model. Experimental results show that this method exhibits excellent performance in CNC tool selection tasks.
[0057] Once trained, the WFASNet model can accurately select appropriate CNC cutting tools, such as turning tools, milling cutters, drilling tools, boring tools, etc.
[0058] The affine transformation used in the neural network model is expressed by the following formula:
[0059] Y_global = α ⊙ X_global + β
[0060] Here, α and β are learnable affine parameters, and ⊙ represents element-wise multiplication.
[0061] The activation function used in the neural network model is the ReLU function, expressed as follows:
[0062]
[0063] The loss function used during the training of the WFASNet neural network model is the classification cross-entropy function, which is expressed as:
[0064]
[0065] Where D is the training dataset containing n K classes of training data. This is the l-th training data, 𝜎𝑖 It is the training data for model prediction. The probability of belonging to the i-th class. Training data The true probability of belonging to the i-th class; if the training data belongs to the i-th class, then = 1; if it does not belong to the i-th class, then =0.
[0066] The pre-selective annealing algorithm used in the neural network decays the learning rate, as expressed by the formula:
[0067]
[0068] in This represents the current learning rate. and These represent the preset upper and lower limits of the learning rate, respectively. It is the current iteration step. It is the total number of iterations for a complete cycle, where π is the mathematical constant pi.
[0069] Finally, a classifier is used to select from six types of tools: roughing cutters, turning tools, drilling tools, finishing cutters, turning tools and grinding wheels, as well as drilling and boring tools.
[0070] A dataset was constructed, generating 300 data points for each feature type in the tool category, for a total dataset size of 1800. The training dataset contained 240 data points for each feature type, totaling 1440. Similarly, a test dataset consisting of 360 unseen data points (60 for each process) was created to test the model. The synthesized data included 3D shape information files of the workpiece processed through voxelization, followed by the extraction of voxel data and conversion back into point cloud data; corresponding workpiece information included elastic modulus [GPa], elongation at break [%], yield strength [MPa], Brinell hardness [HB], thermal diffusivity [m³ / s], dimensional tolerances [mm], and the arithmetic mean surface roughness [Sa] of the part's area.
[0071] An 80:20 split of the dataset was chosen for both training and validation. During training, the AdamW optimizer was used to determine the optimal weights due to its fast convergence speed and suitability for training complex models on high-dimensional data. A custom warm-up and cosine decay scheduler was employed for the learning rate. The learning rate increased linearly from 0 to 5e-4 in the first 20 epochs, and then decayed cosinely from 5e-4 to 1e-6 from epoch 21 to the last 400 epochs to achieve optimal accuracy.
[0072] Finally, the trained model was tested on 360 previously unseen test data sets, and the test accuracy reached 98.89%.
[0073] In addition, the present invention also discloses a tool prediction system, including a data acquisition module for acquiring workpiece point cloud data and quality information; an adaptive sampling module for performing the adaptive sampling operation as described in claim 1; a feature processing module including the dual-branch feature enhancement module as described in claim 1 and a workpiece feature dual attention mechanism; and a classification decision module for outputting tool category prediction results. The specific analysis process can be referred to the above embodiments, and will not be repeated here.
[0074] It will be apparent to those skilled in the art that the present invention is not limited to the details of the exemplary embodiments described above, and that the invention can be implemented in other specific forms without departing from its spirit or essential characteristics. Therefore, the embodiments should be considered in all respects as exemplary and non-limiting, and the scope of the invention is defined by the appended claims rather than the foregoing description. Thus, all variations falling within the meaning and scope of equivalents of the claims are intended to be included within the present invention. No reference numerals in the claims should be construed as limiting the scope of the claims.
[0075] Furthermore, it should be understood that although this specification describes embodiments, not every embodiment contains only one independent technical solution. This narrative style of the specification is merely for clarity. Those skilled in the art should consider the specification as a whole, and the technical solutions in each embodiment can also be appropriately combined to form other embodiments that can be understood by those skilled in the art.
Claims
1. A method for predicting cutting tools based on adaptive sampling, characterized in that, The method includes: Step S1: Obtain point cloud data of historical workpieces after processing, and then input additional workpiece quality information. In the preprocessing stage, use the workpiece feature perception adaptive sampling strategy to perform differentiated sampling on key processing areas to obtain representative point cloud data and its workpiece feature vector. Step S2: Input the sampled workpiece point cloud features into the backbone network for layer-by-layer feature learning. During the feature learning process, a dual-branch feature enhancement module is introduced to divide the point cloud features into a global geometric branch and a local detail branch in the channel dimension. The global geometric branch maintains the overall geometric consistency, while the local detail branch classifies local features into levels and generates frequency domain attention weights to adaptively enhance fine-grained structural information such as texture and edges. The outputs of the two branches are then concatenated, and then a four-layer residual MLP block is used to extract deeper features layer by layer. Step S3: The features extracted in step S2 and the workpiece feature vector in step S1 are used to generate spatial attention weights and channel attention weights respectively through the workpiece feature dual attention mechanism. The point cloud features are weighted and enhanced, and then the quality information from step S1 is spliced together. Step S4: Input the fused data obtained in step S3 into the classifier and output the recommended tool category result.
2. The workpiece feature perception-based adaptive sampling tool prediction method according to claim 1, characterized in that: The backbone network, a WFAS-Net model, was trained. During training, the cross-entropy loss function and Adam optimizer were used to optimize the network, and a cosine annealing learning rate scheduling strategy was used to improve convergence speed and accuracy.
3. The adaptive sampling tool prediction method according to claim 1, characterized in that: In step S2, the global geometry branch uses affine transformation to extract features to maintain overall geometric consistency, while the local detail branch performs Fourier transform on local features to divide the spectrum into low-frequency, mid-frequency, and high-frequency components and splices them together. Attention weights are generated through linear mapping and Sigmoid to modulate and enhance local features.
4. The adaptive sampling tool prediction method according to claim 1, characterized in that: In step S1, the quality information consists of descriptions of materials and quality properties, including elastic modulus [GPa], elongation at break [%], yield strength [MPa], Brinell hardness [HB], thermal diffusivity [m3 / s], dimensional tolerances [mm], and the arithmetic mean surface roughness of the part [Sa].
5. The adaptive sampling tool prediction method according to claim 1, characterized in that: In step S1, the workpiece feature perception adaptive sampling includes three stages: workpiece geometric feature extraction, hierarchical weight allocation, and adaptive sampling. Among them, different processing feature regions are identified through connected component analysis, and geometric parameters such as feature depth, feature scale, shape regularity, local and global surface roughness are calculated for each cutting region and encoded into workpiece feature vectors.
6. The adaptive sampling tool prediction method according to claim 1, characterized in that: In step S3, the workpiece feature vector input from the dual attention mechanism and the features extracted by the dual-branch feature enhancement module are encoded by a multilayer perceptron and then concatenated to generate the workpiece fusion feature. Then, spatial attention weights and channel attention weights are generated from the workpiece features, and the point cloud features are weighted both spatially and channel-wise to achieve multimodal fusion guided by workpiece features.
7. The adaptive sampling tool prediction method according to claim 1, characterized in that: In step S1, the sampling strategy adopts a hybrid scheme of workpiece feature perception adaptive sampling and farthest point sampling. Adaptive sampling is used to focus on key processing areas, while farthest point sampling is used to further enhance the representativeness and generalization ability of sampling points and reduce information loss and category confusion caused by excessive sampling concentration.
8. A tool prediction system, characterized in that, include; The data acquisition module is used to acquire workpiece point cloud data and quality information; An adaptive sampling module performs the adaptive sampling operation as described in claim 1; The feature processing module includes the dual-branch feature enhancement module and the workpiece feature dual attention mechanism as described in claim 1; The classification decision module outputs the tool category prediction results.