Real-time collision detection method based on adaptive bounding box and machine learning
By combining adaptive selection of the optimal bounding box with a lightweight machine learning model, the problems of rigid bounding box selection and coarse boundary judgment in existing 3D collision detection technologies are solved, achieving efficient and intelligent collision detection that is suitable for complex dynamic scenes.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- JIANGSU YAWEI MACHINE TOOL
- Filing Date
- 2026-01-23
- Publication Date
- 2026-05-08
AI Technical Summary
Existing 3D collision detection technologies suffer from problems such as rigid bounding box selection, low space utilization, coarse boundary condition judgment, and high computational cost for accurate detection when dealing with complex and dynamically changing scenes, making it difficult to achieve efficient and intelligent collision detection.
An adaptive bounding box selection process is adopted, which selects the optimal type of bounding box based on the geometric features of the 3D model, and combines a lightweight machine learning model to predict collision probability. The detection process is optimized by generating 24-dimensional feature vectors and a multilayer perceptron model for hierarchical judgment.
It improves the efficiency and accuracy of collision detection in complex dynamic scenarios, reduces invalid calculations, provides intelligent handling capabilities for boundary conditions, and achieves efficient and intelligent collision detection.
Smart Images

Figure CN121997739A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of sheet metal bending technology, and in particular to a real-time collision detection method based on adaptive bounding box and machine learning. Background Technology
[0002] Collision detection is a core foundational technology in fields such as computer graphics, virtual simulation, and robot motion planning. With the increasing complexity of application scenarios (such as large-scale industrial digital twins and high-fidelity virtual reality), traditional collision detection algorithms face severe challenges in terms of accuracy and efficiency.
[0003] Methods based on hierarchical bounding boxes (BVH), such as AABB (Axial Bounding Box), OBB (Oriented Bounding Box), and Sphere, accelerate detection by constructing a tree-like hierarchical structure. However, their performance is highly dependent on the type of bounding box chosen. A single type of bounding box cannot adapt to all geometries. For example, AABB performs well for axis-aligned objects but accuracy decreases after rotation, while OBB is versatile but expensive to construct. Existing methods lack a mechanism for dynamically selecting the optimal bounding box based on the model's geometric features.
[0004] Spatial segmentation-based methods include octrees, BSP trees, and uniform meshes. While these methods are easy to use for dynamic objects, they suffer from challenges in granularity selection and the problem of repeated detection of boundary objects.
[0005] Existing 3D collision detection technologies, especially when dealing with complex and dynamically changing scenarios (such as virtual reality, physics simulation, and robot motion planning), mainly suffer from the following three core problems: Rigid bounding box selection leads to low space utilization: Existing methods typically assign a uniform bounding box (such as AABB or OBB) for the entire scene or all models, lacking specificity. For models with different geometric features (such as elongated, flat, and spherical), a single type of bounding box cannot achieve optimal spatial containment, resulting in a large amount of invalid space within the bounding box. This increases the false alarm rate in the subsequent coarse detection stage, thereby increasing the computational burden of accurate detection.
[0006] Boundary condition judgment is coarse, making it difficult to balance performance and accuracy: Traditional bounding box coarse detection (overlap testing) is a black-and-white Boolean judgment. It cannot provide a quantitative assessment of "collision risk" for boundary conditions of "imminent collision" or "minor contact." This leads to the system either prematurely engaging in precise geometric intersection detection, consuming significant computational resources, or missing minor contacts due to overly conservative judgments. There is a lack of a smooth, intelligent predictive mechanism to optimize the detection process.
[0007] Existing algorithms consistently incur significant computational overhead during the precise detection phase. While coarse detection can eliminate a large number of disjoint object pairs, precise detection of the remaining candidate pairs (typically through OBB tree traversal or triangular face intersection testing) remains a performance bottleneck. There is a lack of an effective means to perform intelligent prediction at this stage, thus skipping unnecessary precise calculations.
[0008] Therefore, there is an urgent need for a comprehensive solution that can adapt to model features, intelligently predict collision probability, and fully utilize the parallel capabilities of modern hardware to achieve high-precision real-time collision detection in complex dynamic scenarios. Summary of the Invention
[0009] The purpose of this invention is to provide an adaptive, efficient, and intelligent collision detection scheme. Its core objective is to significantly improve the overall efficiency of collision detection in complex dynamic scenarios while ensuring detection accuracy.
[0010] To achieve the above objectives, the present invention adopts the following technical solution: a real-time collision detection method based on adaptive bounding boxes and machine learning, comprising the following steps: S1: For each 3D model participating in collision detection, based on its geometric features, an adaptive bounding box selection process is executed to calculate its volume fit with multiple preset types of bounding boxes, and the optimal type of bounding box is selected and constructed for each model according to the volume fit. S2: In each detection cycle, for each pair of objects whose collision relationship needs to be detected, extract their geometric relationship features based on the bounding box constructed in step S1, and generate a feature vector. S3: Input the feature vector generated in step S2 into a pre-trained lightweight machine learning model, which outputs a continuous collision probability value. S4: Based on the probability values output in step S3, perform a graded judgment to guide the scheduling and decision-making of subsequent accurate collision detection.
[0011] Preferably, the adaptive bounding box selection process in step S1 is as follows: For a 3D model's vertex set V and face set F, calculate its model volume V_M; construct the model's spherical bounding box, axial bounding box AABB, and oriented bounding box OBB respectively, and calculate their respective volumes V_sphere, V_aabb, and V_obb; calculate the volume fit between each bounding box and the model, i.e., fitting=V_M / V_box; select the bounding box type with the highest volume fit as the optimal bounding box type for the model.
[0012] Preferably, the geometric relationship features extracted in step S2 are 24-dimensional feature vectors, including the following information: The Euclidean distance between the center points of the two bounding boxes; Normalized relative displacements of the two bounding boxes along the three coordinate axes; The logarithm of the proportional relationship between the dimensions of the two bounding boxes; The overall dimensions of the two enclosures combined; The exact axial bounding box (AABB) overlap volume and its percentage between the two bounding boxes; When the bounding box is an oriented bounding box (OBB), it measures the directional consistency between the corresponding coordinate axes. The included angle between the principal directions of the two bounding boxes and the difference norm of the rotation matrix; The angular difference between the two bounding boxes along each coordinate axis; The encoding that represents the specific sphere, AABB, and OBB of each bounding box; A marker indicating whether two bounding box types are consistent.
[0013] Preferably, the lightweight machine learning model in step S3 is a multilayer perceptron, and its training process includes: S3.1 Data Generation: The algorithm randomly generates bounding box pairs with different spatial relationships, including overlapping, far apart, and critical. The 24-dimensional feature vector is extracted for each pair of bounding boxes. At the same time, based on the accurate AABB intersection test, the bounding box pairs are labeled with binary collision labels and the boundary samples are identified. S3.2 Model Training: Using the generated labeled dataset, an adaptive Focal Loss is used as the loss function, which imposes higher weights on boundary samples; the parameters of the multilayer perceptron are optimized using the backpropagation algorithm until the model converges.
[0014] Preferably, the classification determination in step S4 specifically involves setting a first probability threshold and a second probability threshold, wherein the first threshold is greater than the second threshold; If the collision probability value is greater than the first threshold, it is determined to be a high-probability collision, and the object pair is added to the emergency precision detection queue. If the collision probability value is between the second threshold and the first threshold, it is determined to be a critical state, and the object pair is marked with a risk warning. If the collision probability value is less than the second threshold, it is determined to be safe, and the object pair is filtered out without further precise detection.
[0015] Preferably, the method is specifically applied in digital twin or motion control simulation of sheet metal bending process to detect potential interference between the upper and lower bending dies, sheet metal parts and machine tool moving parts in real time; If a high-probability collision is determined, a high-precision triangular facet intersection detection is triggered for the object pair. When a critical state is determined, the system highlights the corresponding area in the simulation interface and generates a risk log for engineers to review.
[0016] Compared with the prior art, the advantages and positive effects of the present invention are as follows: This invention innovatively incorporates "adaptive bounding box selection" as the primary step in the pipeline. Unlike static, uniform bounding box schemes, this invention performs personalized selection based on the model's geometric characteristics, improving the quality of the bounding box from the outset and laying a high-efficiency foundation for all subsequent stages. This embodies a "site-specific" design philosophy.
[0017] This innovative approach introduces lightweight machine learning models into bounding box-level collision detection. By transforming Boolean judgments into probabilistic predictions, it provides richer decision-making information and enables intelligent handling of boundary conditions. This represents a data-driven paradigm shift, giving the system fuzzy recognition and predictive capabilities not found in traditional algorithms.
[0018] The core components form a closely collaborative organic whole. Adaptive selection provides high-quality input for machine learning prediction; machine learning prediction, in turn, maximizes the use of information generated in the preceding stages. Each link is interconnected, collectively constituting a more efficient collision detection system solution than the simple sum of its parts. In summary, this invention provides a comprehensive, efficient, and intelligent collision detection solution, particularly suitable for complex, dynamic 3D scenes with high real-time requirements. Attached Figure Description
[0019] Figure 1 This is a schematic diagram of the overall process of the real-time collision detection method based on adaptive bounding boxes and machine learning proposed in this invention.
[0020] Figure 2 This is a detailed flowchart of the adaptive bounding box selection strategy in this invention.
[0021] Figure 3 This is a flowchart illustrating the structure and training application of the collision prediction module based on machine learning in this invention. Detailed Implementation
[0022] To address the problems mentioned in the background art, this invention proposes a high-precision, real-time collision detection algorithm for complex bending processes, comprising the following steps executed sequentially: S1: For each 3D model participating in collision detection, based on its geometric features, an adaptive bounding box selection process is executed to calculate its volume fit with multiple preset types of bounding boxes, and the optimal type of bounding box is selected and constructed for each model according to the volume fit. The adaptive bounding box selection process in step S1 is as follows: For a 3D model's vertex set V and face set F, calculate its model volume V_M; construct the model's spherical bounding box, axial bounding box AABB, and oriented bounding box OBB respectively, and calculate their respective volumes V_sphere, V_aabb, and V_obb; calculate the volume fit between each bounding box and the model, i.e., fitting=V_M / V_box; select the bounding box type with the highest volume fit as the optimal bounding box type for the model.
[0023] S2: In each detection cycle, for each pair of objects whose collision relationship needs to be detected, extract their geometric relationship features based on the bounding box constructed in step S1, and generate a feature vector. The geometric relationship features extracted in step S2 are 24-dimensional feature vectors, including the following information: The Euclidean distance between the center points of the two bounding boxes; Normalized relative displacements of the two bounding boxes along the three coordinate axes; The logarithm of the proportional relationship between the dimensions of the two bounding boxes; The overall dimensions of the two enclosures combined; The exact axial bounding box (AABB) overlap volume and its percentage between the two bounding boxes; When the bounding box is an oriented bounding box (OBB), it measures the directional consistency between the corresponding coordinate axes. The included angle between the principal directions of the two bounding boxes and the difference norm of the rotation matrix; The angular difference between the two bounding boxes along each coordinate axis; The encoding that represents the specific sphere, AABB, and OBB of each bounding box; A marker indicating whether two bounding box types are consistent.
[0024] S3: Input the feature vector generated in step S2 into a pre-trained lightweight machine learning model, which outputs a continuous collision probability value. The lightweight machine learning model in step S3 is a multilayer perceptron, and its training process includes: S3.1 Data Generation: The algorithm randomly generates bounding box pairs with different spatial relationships, including overlapping, far apart, and critical. The 24-dimensional feature vector is extracted for each pair of bounding boxes. At the same time, based on the accurate AABB intersection test, the bounding box pairs are labeled with binary collision labels and the boundary samples are identified. S3.2 Model Training: Using the generated labeled dataset, an adaptive Focal Loss is used as the loss function, which imposes higher weights on boundary samples; the parameters of the multilayer perceptron are optimized using the backpropagation algorithm until the model converges.
[0025] S4: Based on the probability values output in step S3, perform a graded judgment to guide the scheduling and decision-making of subsequent accurate collision detection.
[0026] The classification determination in step S4 specifically involves setting a first probability threshold and a second probability threshold, wherein the first threshold is greater than the second threshold. If the collision probability value is greater than the first threshold, it is determined to be a high-probability collision, and the object pair is added to the emergency precision detection queue. If the collision probability value is between the second threshold and the first threshold, it is determined to be a critical state, and the object pair is marked with a risk warning. If the collision probability value is less than the second threshold, it is determined to be safe, and the object pair is filtered out without further precise detection.
[0027] The method of this invention is specifically applied to digital twin or motion control simulation of sheet metal bending process, and is used to detect potential interference between the upper and lower bending dies, sheet metal parts and machine tool moving parts in real time. If a high-probability collision is determined, a high-precision triangular facet intersection detection is triggered for the object pair. When a critical state is determined, the system highlights the corresponding area in the simulation interface and generates a risk log for engineers to review.
[0028] The core of this invention lies in a two-stage processing pipeline: 1. Geometric Feature Analysis and Adaptive Bounding Box Selection The adaptive bounding box selection algorithm is an intelligent decision-making method based on multi-objective optimization, aiming to automatically select the most suitable bounding box type for a given 3D model. This algorithm achieves scientific and automated bounding box selection by quantitatively evaluating the volume fit between different bounding box types and the target model. Based on the principle of volume fit, the algorithm implements adaptive bounding box selection through three core steps: first, accurately calculating the volume of the 3D model as a baseline value; second, constructing spherical, AABB, and OBB bounding boxes respectively and calculating their respective volumes; finally, comparing the ratio of each bounding box volume to the model volume, and selecting the bounding box type with the largest ratio (i.e., the highest space utilization) as the optimal solution. This algorithm is purely based on geometric optimality, ensuring that the selected bounding box can most tightly wrap the target model, providing a theoretical guarantee for high-precision collision detection.
[0029] like Figure 1 As shown, the execution of the method of the present invention follows a clear pipeline, mainly including the following core steps: 3D Model Input: The system loads all 3D models involved in collision detection, such as the upper and lower dies, sheet metal parts, and machine tool moving parts models in a sheet metal bending scenario. Geometric Feature Analysis and Adaptive Bounding Box Selection: For each input 3D model, the model volume is calculated, and an adaptive bounding box selection algorithm is executed to construct the optimal type of bounding box (such as sphere, AABB, or OBB) that best fits its geometry. This step lays the foundation for subsequent efficient detection; see [link to detailed process] for more information. Figure 2 .
[0030] Bounding box geometric relationship feature extraction: In each collision detection cycle, for each pair of objects to be detected, extract the spatial geometric relationship between the bounding boxes constructed in step 2 to generate a multi-dimensional feature vector (preferably 24-dimensional).
[0031] Collision prediction based on machine learning: The feature vector generated in step 2 is input into a pre-trained lightweight machine learning model (such as a multilayer perceptron MLP). The model outputs a continuous value between 0 and 1, representing the probability of the two objects colliding.
[0032] Collision Probability Classification: Based on the collision probability values output in step 3, a three-level classification is performed using preset thresholds. For example, a probability greater than 0.7 is classified as "high-probability collision," between 0.3 and 0.7 as "critical state," and less than 0.3 as "safe." Differential processing is applied based on the classification results: "High-probability collisions" are added to the precise collision detection queue, immediately triggering fine-grained collision detection based on patches to ultimately confirm the collision. "Critical state" pairs are flagged with a risk warning and highlighted on the simulation interface, but precise detection is usually not performed temporarily to maintain efficiency, allowing engineers to review the data. "Safe" pairs mean no collision occurred and are directly filtered out without any subsequent calculations, greatly improving overall efficiency.
[0033] I. Core Idea of the Algorithm
[0034] The algorithm employs supervised learning, generating bounding box pairs containing different spatial relationships as training data to train a multilayer perceptron (MLP) model, enabling it to quickly determine whether two bounding boxes collide.
[0035] II. Detailed Algorithm Flow
[0036] Phase 1: Training Data Generation
[0037] Initialize the dataset; data such as center position and dimensions can be adjusted as needed.
[0038] Create an empty dataset D to store training samples.
[0039] Generate bounding box pairs
[0040] Generate N samples in a loop
[0041] Randomly generate the first bounding box: Center position c1: Uniformly distributed within the three-dimensional space [-4, 4]. Size s1: Uniformly distributed within the range of [0.5, 3.0]. Generate a second bounding box (three cases) Overlapping case (when i mod 3 = 0): The center c2 is slightly offset from c1 (in the range of -0.5 to 0.5). Randomly generate size s2 Far from the case (when i mod 3 = 1): Center c2 is located far from c1 (distance 4.0 to 8.0). Randomly generate smaller size s2 Critical case (when i mod 3 = 2): Randomly generate unit direction vector Calculate the critical distance = Sum of half-sizes of the two bounding boxes ± small perturbation Place the second bounding box in a random direction Randomly select bounding box type Randomly select two types from {Sphere (SPHERE), Axial Bounding Box (AABB), Oriented Bounding Box (OBB)}. Create two bounding box objects, b1 and b2. Feature extraction and annotation Extract 24-dimensional feature vectors (which may include information such as position, size, and orientation). The true label is calculated using a precise AABB collision detection method. Collision → Tag 1.0 No collision → Tag 0.0 Mark whether it is a boundary sample (a critically difficult-to-determine sample). Add samples to the dataset Phase Two: Model Training Model initialization Initialize a three-layer MLP neural network Using the Adam optimizer with a learning rate of 0.001 Use the improved Focal BCE loss function (specifically designed to handle class imbalance and boundary samples). Training cycles (maximum 100 rounds) Each round of training: a. Set to training mode b. Process data in batches: Clear gradient Forward propagation to obtain predicted values Calculate the loss (giving higher weights to boundary samples). Backpropagation to update parameters c. Verification phase: Set to evaluation mode Evaluate model performance on the validation set If the current model is optimal, save the checkpoint. If the loss does not improve after 8 consecutive rounds of validation, training should be stopped early. Phase 3: Model Deployment Loading model parameters for the optimal checkpoint Return the trained model M
[0042] Algorithm characteristics description:
[0043] Feature engineering: Extract 24-dimensional multi-level geometric features, covering key information such as distance, orientation, size, and overlap; Adaptive Loss: Focal Loss is used to handle class imbalance, and boundary sample weighting is used to enhance the identification of critical cases; Intelligent training: Combining early stopping mechanisms, learning rate scheduling, and model checkpoints to ensure training stability; Probability output: Outputs the probability of consecutive collisions (0-1), supporting three-level classification (collision / critical / safe).
[0044] like Figure 2 The specific algorithm flow for selecting the optimal bounding box type (step 2) for a single 3D model is shown below: I. Algorithm Objective For a given 3D model, select the optimal bounding box type by comparing the fit of different bounding boxes to the original volume of the model, and select the bounding box form that can most tightly enclose the model.
[0045] II. Input and Output Input: Vertex set V (coordinates of all vertices of the model), face set F (triangles of the model) Output: Optimal bounding box type B (Choose from sphere, AABB, OBB) III. Detailed Algorithm Flow Step 1: Calculate the actual volume of the model 1. Calculate the actual volume V_M of the 3D model using the input vertices V and faces F. This is the actual space volume occupied by the model. Calculations are typically performed using the surface information of the model. Step 2: Calculate the volume of the three bounding boxes 1. Calculate the volume V_sphere of the spherical bounding box. Find the smallest sphere that contains all vertices. Calculate the volume of the sphere: V = (4 / 3)πr³ Where r is the radius of the sphere 2. Calculate the volume V_aabb of the AABB (axial bounding box). Calculate the minimum and maximum coordinates of the model along the coordinate axes (X, Y, Z). Construct a bounding box aligned with the coordinate axes. Volume = (X_max - X_min) × (Y_max - Y_min) × (Z_max - Z_min) 3. Calculate the volume V_obb of the OBB (Oriented Bounding Box). principal axis direction of the computational model Construct a tight bounding box aligned with the spindle Calculate the volume of the oriented bounding box. Step 3: Calculate volume fit 1. Calculate the fit index of each enclosure. Spherical bounding box fit: fitting_sphere = model volume / sphere volume AABB fit: fitting_aabb = model volume / AABB volume OBB fit: fitting_obb = model volume / OBB volume 2. Explanation of the meaning of fit Fit is the ratio of the actual volume of the model to the volume of the bounding box. The closer the ratio is to 1, the more tightly the bounding box fits the model. The smaller the ratio, the more free space inside the bounding box. Step 4: Select the optimal bounding box type 1. Comparison of fit If the spherical bezel fits the best (and is equal to or better than the other two), choose the spherical bezel. Otherwise, if the fit of AABB is greater than or equal to the fit of OBB, choose AABB. Otherwise, choose OBB. 2. Return to selection results Output the optimal bounding box type B
[0046] IV. Algorithm Characteristics
[0047] 1. Intuitive and simple: Based on volume comparison, it is easy to understand and implement.
[0048] 2. Consider compactness: Choose the most compact enclosure to reduce empty space.
[0049] 3. Automated selection: No manual intervention required.
[0050] like Figure 3 As shown, the construction and application of the machine learning-based collision prediction module (corresponding to step 4) includes the following layers: training data generation, 24-dimensional feature engineering, input: 24-dimensional geometric feature vector, input layer 24 neurons, fully connected layer 64 neurons, BatchNormall normalization, ReLU activation function, Dropout p=0.3, fully connected layer 32 neurons, BatchNormall normalization, ReLU activation function, Dropout p=0.2, output layer 1 neuron, sigmoid activation function, output: collision probability 0-1.
[0051] First, a systematic training data generation process is performed. A large number of bounding box pairs with different spatial relationships are randomly generated through a programmed algorithm to ensure coverage of various spatial relationship types that may be encountered in collision detection, mainly including four typical states: complete overlap, partial overlap (critical contact), close but not in contact (critical non-contact), and significantly far apart. For each generated bounding box pair, a finely designed 24-dimensional geometric relationship feature vector is extracted. This vector comprehensively encodes the spatial interaction information between the two bounding boxes, specifically including: 1) basic distance features, such as the Euclidean distance between the center points; 2) relative position features, such as normalized displacement in the three coordinate axes; 3) size ratio features, such as the logarithm of the size ratio of the two bounding boxes in each axis; 4) overlap metric features, such as the precisely calculated overlap volume of the axial bounding boxes (AABB) and its proportion relative to the total volume; 5) directional relationship features, such as the angle between the principal directions of the bounding boxes, the difference norm of the rotation matrix, and the angular difference between each coordinate axis; 6) type information features, such as the one-hot encoding of the type (spherical, AABB, OBB) of each bounding box, and a marker indicating whether the two bounding boxes are of the same type. Meanwhile, based on the rigorous and accurate AABB intersection test algorithm, each sample pair is labeled with a binary collision ground truth label (1 indicates collision, 0 indicates no collision). In this process, "critical" samples that are at the fuzzy boundary are specifically identified and marked. These samples are crucial for the discriminative ability of the training model.
[0052] In terms of feature engineering and model architecture, the system uses the aforementioned 24-dimensional geometric feature vectors as the model input. The lightweight multilayer perceptron model structure is designed as follows: the input layer precisely corresponds to the 24 feature dimensions and contains 24 neurons. This is followed by the first fully connected layer, which expands to 64 neurons to learn higher-order interactions between features. A batch normalization layer is then sequentially connected to stabilize training and accelerate convergence. A ReLU activation function is used to introduce non-linearity, and Dropout is performed with a probability of 0.3 to prevent overfitting during training. Next is the second fully connected layer, which compresses the dimension to 32 neurons. This is also followed by a batch normalization layer, a ReLU activation function, and Dropout with a probability of 0.2 to further refine the feature representation. Finally, the output layer consists of one neuron, using a Sigmoid activation function to map the previous layer's output to a continuous scalar value between 0 and 1, representing the predicted probability of a collision for the current bounding box.
[0053] 2. Collision prediction based on lightweight machine learning
[0054] This algorithm implements a machine learning-based intelligent collision detection system. The core process comprises four main stages. First, data preparation is performed: by randomly generating bounding box pairs with different spatial relationships, a 24-dimensional geometric feature vector is extracted, including key geometric relationships such as center distance, relative position, size ratio, and precise overlap volume. Specifically, dim 0: Euclidean distance between center points; dim 1-3: normalized relative displacement; dim 4-6: logarithm of size comparison; dim 7-9: merged size; dim 10: precise AABB overlap volume; dim 11: overlap volume percentage; dim 12-14: axis alignment (absolute value of the dot product between the corresponding axes (x, y, z) of the two OBBs, reflecting rotational consistency); dim 15: principal direction angle (radian difference between the principal axes of the two objects); dim 16: direction difference norm (Frobenius norm of the difference between the two rotation matrices); dim 17-19: angular differences between each axis. The radian values of the angles between the three coordinate axes. dim 20: Whether object 1 is SPHERE (1.0 or 0.0). dim 21: Whether object 1 is AABB (1.0 or 0.0). dim 22: Whether object 1 is OBB (1.0 or 0.0). dim 23: Type consistency flag. 1.0 if object 1 and object 2 have the same type, otherwise 0.0. The second stage constructs the neural network model: a three-layer MLP structure is adopted, including BatchNorm and Dropout layers, using adaptive Focal Loss as the loss function, with weight augmentation specifically applied to boundary samples to improve the ability to identify critical situations.
[0055] The training process employs a standard supervised learning framework: data is divided into training and validation sets, the Adam optimizer is used for parameter updates, and learning rate scheduling and early stopping mechanisms are combined to prevent overfitting. The model is evaluated at each epoch using multiple metrics, including accuracy, precision, recall, and F1 score. The final stage involves predictive applications: the trained model outputs collision probabilities for any bounding box pair, achieving three-level classification by setting threshold ranges (collision > 0.7, critical 0.3-0.7, safe < 0.3). In test cases, it demonstrates accurate differentiation between strong collisions, weak collisions, critical situations, and safe distances.
[0056] The innovation of this algorithm lies in transforming traditional geometric collision detection into a machine learning problem. It learns complex spatial relationships through a data-driven approach, avoiding the difficulty of manually designing complex judgment rules. It exhibits better robustness and accuracy than traditional methods, especially in cases with ambiguous boundaries. The entire system achieves a complete closed loop from feature engineering and model training to practical application, providing an efficient solution for real-time collision detection. 1. Geometric Feature Analysis and Adaptive Bounding Box Selection
[0057] Solution Description (Enhancing Application Background): In sheet metal bending scenarios, this algorithm can intelligently assign appropriate bounding boxes to different components. For example, for long, strip-shaped sheet metal parts, the optimal choice is usually OBB, which closely conforms to its stretching direction; for the compact upper die of a bending machine, AABB or OBB may be the optimal solution; for some near-spherical connecting parts, a spherical bounding box may be selected. This adaptive strategy reduces the looseness of the entire bounding box hierarchy from the source.
[0058] 2. Collision prediction based on lightweight machine learning
[0059] Solution Description (Enhanced Application Background): This algorithm offers a revolutionary solution to the challenge of detecting minute gaps between the die and sheet metal in bending simulations. The machine learning model learns the subtle geometric differences between "very close but not in contact" and "just in contact," outputting a continuous collision probability. This enables the simulation system to: High probability collision (P > 0.7): Immediately alarm and stop simulation, indicating a serious interference has occurred.
[0060] Critical state (0.3 ≤ P ≤ 0.7): Issue a warning, indicating to the programmer that the gap here is too small, posing a risk, and requiring close review. The simulation can slow down or highlight this area.
[0061] Safety (P < 0.3): High efficiency, ensuring simulation speed.
[0062] The following section will describe in detail the specific implementation of the present invention using the typical industrial scenario of sheet metal bending.
[0063] Initialization phase (before simulation begins): Model loading: The system loads the upper and lower dies of the bending machine, the sheet metal parts to be bent (neutral layer or surface model), and the models of the machine tool's moving parts.
[0064] Adaptive bounding box selection: Execute Algorithm 1 for each model.
[0065] Sheet metal parts: These are usually long, thin plates. The algorithm will calculate that the OBB is the optimal bounding box that can fit closely to its main direction.
[0066] Upper / lower mold: Depending on its specific geometry, complex multi-angle molds may be better suited to OBB, while simple die-cutting molds may be better suited to AABB.
[0067] Machine tool mechanisms (such as pressure plates and stops): adaptively selected based on shape.
[0068] Broad Phase Collision Detection and Intelligent Prediction. The object pairs to be detected include: upper mold vs. sheet metal part, lower mold vs. sheet metal part, upper mold vs. lower mold, mold vs. machine tool moving parts, etc. For each pair, perform the following operations: Extract the 24-dimensional feature vectors of the top bounding boxes of both.
[0069] Input the feature vector into the pre-trained lightweight ML model (the output M of Algorithm 3). ), and thus the collision probability P is obtained.
[0070] Make three-level decisions: P > 0.7 (High Probability Collision): For example, the upper die is about to collide with the unbent part of the sheet metal during the pressing process. The system immediately adds the object pair (such as the upper die and the sheet metal) to the emergency precision detection list.
[0071] 0.3 ≤ P ≤ 0.7 (critical state): For example, the gap between the sheet metal part and the lower die sidewall after bending is very small (e.g., 0.1mm). The system marks this object pair as a "risk point", highlights it in the simulation interface, and records it in the log, prompting engineers to check it carefully, but the simulation can continue to run.
[0072] P < 0.3 (safe): The vast majority of clearly separated object pairs are quickly filtered out at this stage, without the need for further calculations.
[0073] Narrow Phase Collision Detection: Performs precise triangular facet-level intersection detection only on object pairs in the "Emergency Precise Detection List". If a real collision is detected, the simulation is immediately paused, an alarm is triggered, and the collision location is visualized.
[0074] This invention provides a real-time collision detection method based on adaptive bounding boxes and machine learning, addressing the problems of rigid bounding box selection, coarse boundary condition handling, and high computational overhead for accurate detection in existing technologies. By introducing an adaptive bounding box selection mechanism based on volume fit at the front end of the collision detection process, the geometric relationships of the input bounding boxes for subsequent machine learning models become more stable and consistent, thereby significantly reducing the false positive rate of machine learning models under critical spatial relationships and improving the reliability of collision probability prediction. This invention constructs an efficient and collaborative detection pipeline through two core stages: The first stage involves geometrically feature-driven adaptive bounding box selection. By calculating the volume fit between each 3D model and the volumes of spheres, axial bounding boxes (AABB), and oriented bounding boxes (OBB), the system automatically selects and constructs the optimal type of bounding box with the highest space utilization. This source optimization strategy fundamentally reduces invalid space, laying an efficient foundation for subsequent detection.
[0075] The second stage involves intelligent prediction and hierarchical decision-making based on machine learning. First, a 24-dimensional comprehensive geometric relationship feature vector is extracted between any two bounding boxes. This vector fully encodes information such as distance, direction, size, overlap, and type. Second, this feature vector is input into a pre-trained lightweight multilayer perceptron model. This model, trained using adaptive Focal Loss (weighting boundary samples), outputs a continuous and reliable collision probability value. Finally, by setting thresholds (e.g., 0.7 and 0.3), this probability value is classified in three levels: a "high probability collision" triggers precise detection and an alarm; a "critical state" triggers risk labeling and a warning; and a "safe" state triggers efficient filtering. These two stages are tightly coupled; adaptive selection provides high-quality input features for machine learning, while the probabilistic output of machine learning achieves intelligent superiority over traditional binary judgment.
Claims
1. A real-time collision detection method based on adaptive bounding boxes and machine learning, characterized in that: Includes the following steps: S1: For each 3D model participating in collision detection, based on its geometric features, an adaptive bounding box selection process is executed to calculate its volume fit with multiple preset types of bounding boxes, and the optimal type of bounding box is selected and constructed for each model according to the volume fit. S2: In each detection cycle, for each pair of objects whose collision relationship needs to be detected, extract their geometric relationship features based on the bounding box constructed in step S1, and generate a feature vector. S3: Input the feature vector generated in step S2 into a pre-trained lightweight machine learning model, which outputs a continuous collision probability value. S4: Based on the probability values output in step S3, perform a graded judgment to guide the scheduling and decision-making of subsequent accurate collision detection.
2. The real-time collision detection method based on adaptive bounding box and machine learning according to claim 1, characterized in that: The adaptive bounding box selection process in step S1 is as follows: For a 3D model's vertex set V and face set F, calculate its model volume V_M; construct the model's spherical bounding box, axial bounding box AABB, and oriented bounding box OBB respectively, and calculate their respective volumes V_sphere, V_aabb, and V_obb; calculate the volume fit between each bounding box and the model, i.e., fitting=V_M / V_box; select the bounding box type with the highest volume fit as the optimal bounding box type for the model.
3. The real-time collision detection method based on adaptive bounding boxes and machine learning according to claim 1, characterized in that: The geometric relationship features extracted in step S2 are 24-dimensional feature vectors. Includes the following information: The Euclidean distance between the center points of the two bounding boxes; Normalized relative displacements of the two bounding boxes along the three coordinate axes; The logarithm of the proportional relationship between the dimensions of the two bounding boxes; The overall dimensions of the two enclosures combined; The exact axial bounding box (AABB) overlap volume and its percentage between the two bounding boxes; When the bounding box is an oriented bounding box (OBB), it measures the directional consistency between the corresponding coordinate axes. The included angle between the principal directions of the two bounding boxes and the difference norm of the rotation matrix; The angular difference between the two bounding boxes along each coordinate axis; The encoding that represents the specific sphere, AABB, and OBB of each bounding box; A marker indicating whether two bounding box types are consistent.
4. The real-time collision detection method based on adaptive bounding box and machine learning according to claim 1, characterized in that: The lightweight machine learning model in step S3 is a multilayer perceptron, and its training process includes: S3.1 Data Generation: The algorithm randomly generates bounding box pairs with different spatial relationships, including overlapping, far apart, and critical. The 24-dimensional feature vector is extracted for each pair of bounding boxes. At the same time, based on the accurate AABB intersection test, the bounding box pairs are labeled with binary collision labels and the boundary samples are identified. S3.2 Model Training: Using the generated labeled dataset, an adaptive Focal Loss is used as the loss function, which imposes higher weights on boundary samples; the parameters of the multilayer perceptron are optimized using the backpropagation algorithm until the model converges.
5. The real-time collision detection method based on adaptive bounding box and machine learning according to claim 1, characterized in that: The classification determination in step S4 specifically involves setting a first probability threshold and a second probability threshold, wherein the first threshold is greater than the second threshold. If the collision probability value is greater than the first threshold, it is determined to be a high-probability collision, and the object pair is added to the emergency precision detection queue. If the collision probability value is between the second threshold and the first threshold, it is determined to be a critical state, and the object pair is marked with a risk warning. If the collision probability value is less than the second threshold, it is determined to be safe, and the object pair is filtered out without further precise detection.
6. The real-time collision detection method based on adaptive bounding box and machine learning according to any one of claims 1-5, characterized in that: The method is specifically applied to digital twin or motion control simulation of sheet metal bending process, and is used to detect potential interference between the upper and lower bending dies, sheet metal parts and machine tool moving parts in real time. If a high-probability collision is determined, a high-precision triangular facet intersection detection is triggered for the object pair. When a critical state is determined, the system highlights the corresponding area in the simulation interface and generates a risk log for engineers to review.