An industrial point cloud registration service operation method and system
By implementing hierarchical memory management, scheduled restarts, and multi-dimensional quality assessments, the problems of memory leakage, stability, and format compatibility in industrial point cloud registration systems have been solved, achieving highly available, highly stable, and highly accurate point cloud registration services.
Patent Information
- Application Number
- CN202611040153.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-14
- Publication Date
- 2026-11-03
AI Technical Summary
Existing industrial point cloud registration systems suffer from problems such as memory leakage, poor service stability, poor compatibility with industrial file formats, and inconsistent registration quality assessment. These issues lead to problems such as OOM errors, resource accumulation, and unreliable registration quality during actual deployment and long-term operation.
By employing a hierarchical memory management strategy, a scheduled restart and health monitoring mechanism, a unified parsing interface for multiple file formats, and a multi-dimensional registration quality assessment system, the system achieves automatic format recognition and conversion of point cloud data, validity detection of inference sessions, lightweight and deep cleanup, multi-dimensional quality assessment, and periodic service restart, ensuring high availability, high stability, and high precision operation of the system.
It effectively solves the problems of video memory leakage and service instability, realizes automatic compatibility of multi-format files and reliable registration quality, and ensures the system's continuous multiple inferences without failure and high-precision registration results.
Smart Images

Figure CN123035209A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of industrial point cloud registration technology, and in particular to an industrial point cloud registration service operation method and an industrial point cloud registration service operation system. Background Technology
[0002] With the widespread application of deep learning technology in the industrial field, point cloud registration methods based on deep learning have gradually become an important technical means in industrial inspection, reverse engineering, and other scenarios. In practical industrial applications, point cloud registration systems need to accurately align the point cloud to be tested with a standard CAD model to achieve functions such as deviation analysis and quality inspection. However, existing industrial point cloud registration systems still face many problems in actual deployment and long-term operation, as follows: 1. Memory Leakage Issue: After multiple calls to the deep learning inference service, intermediate tensors and caches are not released in a timely manner, leading to continuous accumulation of GPU memory and eventually causing an OutOfMemoryError (OOM). The GPU memory pool mechanism of inference engines such as ONNXRuntime further exacerbates this problem.
[0003] 2. Poor long-term service stability: Long-running inference services suffer from resource accumulation issues and lack automated health assurance mechanisms, requiring manual periodic restarts.
[0004] 3. Poor compatibility with industrial file formats: CAD models in industrial scenarios may be stored in multiple formats such as STEP, PRT, and bin. Existing systems usually only support a single format, requiring users to manually convert them.
[0005] 4. Inconsistent registration quality assessment: The lack of a comprehensive quality assessment index system makes it difficult to automatically determine whether the registration results are usable, and it is also difficult to automatically select the optimal result in multiple attempts, which makes it difficult to guarantee the reliability of registration quality. Summary of the Invention
[0006] In view of the above problems, the present invention is proposed to provide an industrial point cloud registration service operation method and a corresponding industrial point cloud registration service operation system that overcomes or at least partially solves the above problems.
[0007] This invention discloses an industrial point cloud registration service operation method, the method comprising: Receive a point cloud registration request and a point cloud file to be registered, detect the file format of the point cloud file to be registered, and convert the point cloud file to be registered into point cloud data in a unified format according to the parsing method corresponding to the detected file format; A validity check is performed on the inference session. If the inference session is found to be valid, the inference model loaded in the inference session is used to perform point cloud registration inference on the point cloud data. After the inference is completed, a lightweight cleanup operation is performed on the GPU. The lightweight cleanup operation includes cleaning up the intermediate tensor cache generated during the inference process, while keeping the weights of the inference model resident in the GPU memory. Perform multi-dimensional quality assessment on the candidate point cloud registration results output by the point cloud registration inference, and select the best point cloud registration result from the candidate point cloud registration results based on the quality assessment results; During the registration service operation, the service restart process is automatically triggered according to the preset time cycle, and a deep cleanup operation is performed when the deep cleanup conditions are met.
[0008] Optionally, the file format of the point cloud file to be registered is detected, and the point cloud file to be registered is converted into point cloud data of a unified format according to the parsing method corresponding to the detected file format, including: The file format is determined based on the extension of the point cloud file to be registered; if the point cloud file to be registered has no extension, the file header is read and magic number detection is performed to determine the file format. When the file format is STEP, the CAD model in the STEP file is loaded and the surface geometric information is extracted. Poisson disk sampling is performed on the surface geometric information to extract point cloud data. The extracted point cloud data is deduplicated and output as a coordinate array of preset dimensions. When the file format is PRT, the PRT file is converted to a STEP file, and the coordinate array of the preset dimensions is extracted and output through the parsing method corresponding to the STEP file. When the file format is bin, the file header is parsed to obtain the number of points and coordinate format, the point coordinate data is read in batches, and the output is a coordinate array of preset dimensions.
[0009] Optionally, after performing validity checks on the inference session, the following steps are also included: If the inference session is detected to be invalid, the inference model is automatically reloaded to the GPU memory and a new inference session is rebuilt, and the health status of the inference session is recorded in the log. During the inference session and point cloud registration inference process, the actual GPU memory usage information is obtained and the memory occupancy rate is calculated. When the memory occupancy rate exceeds a preset threshold, a memory alarm is triggered.
[0010] Optionally, the service restart process can be automatically triggered according to a preset time period, including: Configure a scheduled task to trigger service restarts periodically according to a preset time. When a service restart is triggered, wait for the currently executing point cloud registration request to complete before executing the service restart process; After the service restart process is completed, the inference model and service configuration are automatically reloaded, and the restart process is recorded in the operation and maintenance log.
[0011] Optionally, a deep cleaning operation is performed when the deep cleaning conditions are met, including: Before the service restart process is executed or during service idle periods, the inference engine's memory pool, as well as all GPU caches and temporary buffers, are released, and the inference model is completely unloaded to release all GPU memory occupied by the inference model.
[0012] Optionally, during the registration service operation, the following may also be included: In response to a health check request, the system returns the registration service running status, system resource usage information, process resource usage information, and the loading status and version information of the inference model. In response to resource monitoring requests, it queries and returns structured monitoring data in real time, including CPU utilization, system memory usage, and GPU memory usage. In response to a manual restart request, after verifying permissions, a forced restart process is triggered, and the restart status and estimated recovery time are returned.
[0013] Optionally, a multi-dimensional quality assessment is performed on the candidate point cloud registration results output by the point cloud registration inference, and the best point cloud registration result is selected from the candidate point cloud registration results based on the quality assessment results, including: Calculate the root mean square error, chamfer distance, inlier ratio, and at least one statistical distance index for each candidate registration result; Compare the root mean square errors of each candidate point cloud registration result, and select the candidate point cloud registration result with the smallest root mean square error as the best point cloud registration result. If the root mean square error of all candidate point cloud registration results exceeds the preset registration quality threshold, a registration failure alarm will be generated, and a quality report containing all multi-dimensional quality evaluation indicators will be generated.
[0014] This invention also discloses an industrial point cloud registration service operation system, the system comprising: The multi-format registration information receiving and conversion module is used to receive point cloud registration requests and point cloud files to be registered, detect the file format of the point cloud files to be registered, and convert the point cloud files to be registered into point cloud data in a unified format according to the parsing method corresponding to the detected file format. The intelligent video memory management module is used to perform validity checks on the inference session. If the inference session is detected to be valid, the inference model already loaded in the inference session is used to perform point cloud registration inference on the point cloud data. After the inference is completed, a lightweight cleanup operation is performed on the GPU. The lightweight cleanup operation includes cleaning up the intermediate tensor cache generated during the inference process, while keeping the weights of the inference model resident in the GPU video memory. It is also used to perform a deep cleanup operation when the deep cleanup conditions are met. The registration quality assessment module is used to perform multi-dimensional quality assessment on the candidate point cloud registration results output by the point cloud registration inference, and select the best point cloud registration result from the candidate point cloud registration results based on the quality assessment results. The scheduled restart and health monitoring module is used to automatically trigger the service restart process according to a preset time cycle during the registration service operation.
[0015] This invention has the following advantages: This invention receives point cloud files to be registered and automatically detects their format. It then converts the files into standard point cloud coordinate arrays according to the parsing method corresponding to STEP, PRT, or bin formats. Before inference, it performs a validity check on the inference session; if it fails, the session is automatically rebuilt. After inference, it performs lightweight cleanup to release intermediate tensor caches and keep model weights resident in GPU memory. It calculates indicators such as root mean square error, chamfer distance, and inlier ratio for multiple candidate registration results, automatically selects the optimal result, and generates a quality report. During operation, it automatically restarts the service periodically and performs deep cleanup to completely release the GPU memory pool and all caches. This method effectively solves the problems of GPU memory leakage and service instability, enabling continuous, fault-free inference operation, and is compatible with multiple industrial formats, ensuring reliable registration quality. Attached Figure Description
[0016] Figure 1 This is a flowchart illustrating the steps of an industrial point cloud registration service operation method provided in an embodiment of the present invention. Figure 2 This is a structural block diagram of an industrial point cloud registration service operation system provided in an embodiment of the present invention. Detailed Implementation
[0017] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0018] This invention proposes an operational method for industrial point cloud registration services. This method achieves high availability, high stability, and high precision operation of the industrial point cloud registration service through the coordinated implementation of a hierarchical memory management strategy, a timed restart and health monitoring mechanism, a unified parsing interface for multiple file formats, and a multi-dimensional registration quality evaluation system. (Refer to...) Figure 1 The overall process is as follows: Step 101: Receive a point cloud registration request and a point cloud file to be registered, detect the file format of the point cloud file to be registered, and convert the point cloud file to be registered into point cloud data in a unified format according to the parsing method corresponding to the detected file format.
[0019] The core purpose of this step is to solve the compatibility problem of diverse CAD model formats in industrial scenarios, unify data from different sources and in different formats into a standardized point cloud coordinate array, so that the subsequent registration and inference process is decoupled from the original format of the input file.
[0020] Step 102: Perform validity check on the inference session. If the inference session is found to be valid, use the inference model loaded in the inference session to perform point cloud registration inference on the point cloud data. After the inference is completed, perform a lightweight cleanup operation on the GPU. The lightweight cleanup operation includes cleaning up the intermediate tensor cache generated during the inference process, while keeping the weights of the inference model resident in the GPU memory.
[0021] This step utilizes the lightweight cleanup mode in the hierarchical memory management strategy to promptly release unnecessary intermediate computing resources after each inference, preventing continuous accumulation of memory, while maintaining the hot-loading state of model weights to ensure a fast response for the next inference.
[0022] Step 103: Perform a multi-dimensional quality assessment on the candidate point cloud registration results output by the point cloud registration inference, and select the best point cloud registration result from the candidate point cloud registration results based on the quality assessment results.
[0023] This step establishes a comprehensive quality assessment index system that can automatically determine the usability and accuracy of the registration results and automatically select the best one through multiple attempts.
[0024] Step 104: During the registration service operation, the service restart process is automatically triggered according to the preset time cycle, and a deep cleanup operation is performed when the deep cleanup conditions are met.
[0025] This step ensures the long-term operational stability of the service at the system level by periodically releasing resources to eliminate various hidden resource accumulation problems that may occur during long-term operation.
[0026] The following provides a detailed explanation of the optional implementation methods for each step.
[0027] 1. Multi-format file parsing and unified conversion In industrial settings, CAD models may be stored in multiple formats such as STEP, PRT, and bin. Existing systems typically only support a single format, requiring users to manually convert the format, which is cumbersome and prone to errors. This invention designs a unified parsing process for multi-format files, which can automatically identify file formats and convert them into a unified data structure.
[0028] (1) Automatic file format detection In one specific embodiment of the present invention, the file format detection adopts a dual detection strategy of prioritizing file extensions and using magic number as a fallback: File extension detection: The system first obtains the filename of the point cloud file to be registered and extracts its extension. Supported extensions include, but are not limited to: .step, .stp (corresponding to STEP format), .prt (corresponding to PRT format), and .bin (corresponding to binary point cloud format). The file format type is determined by matching the case-insensitive extension.
[0029] Magic Number Detection: For files without an extension, or files whose extensions cannot be matched to a known format, the system reads a specific byte sequence from the file header (i.e., the magic number) to identify the format. Different file formats typically contain specific identifier byte sequences in their file headers; for example, STEP files usually use ISO-10303-21 as their file header identifier. Using a predefined magic number mapping table, the system can accurately identify the true format of a file, avoiding parsing failures caused by incorrectly modified or missing file extensions.
[0030] (2) STEP document processing flow STEP (Standard for the Exchange of Product Model Data, ISO 10303) is the most widely used CAD data exchange format in the industrial field. When the file format is detected as STEP, the following processing flow is executed: CAD Model Loading: The STEP file is loaded using the OpenCASCADE geometry kernel library. OpenCASCADE is an open-source CAD / CAE / CAM development platform. Its internal STEP file reader can parse the complete product data structure contained in the STEP file, including geometric entities (B-Rep boundary representation), topological relationships, and assembly information. The system loads the geometric data from the STEP file into memory through the OpenCASCADE reading interface, constructing a complete 3D geometric model object.
[0031] Surface geometry information extraction: Extract surface geometry information from the loaded 3D geometric model. Specifically, by traversing the model's topology, extract all topological surfaces, and obtain the underlying geometric surface description of each surface using the BRep_Tool::Surface() method, including parametric surface types such as NURBS surfaces, planes, cylindrical surfaces, and conical surfaces.
[0032] Poisson disk sampling: Poisson disk sampling is performed on the extracted surface geometry to extract uniformly distributed point cloud data. Poisson disk sampling is a blue noise sampling method. Its core principle is to ensure that the minimum distance between sampling points is not less than a preset threshold r, thereby ensuring that the sampling points uniformly cover the entire surface while avoiding excessive aggregation. In specific implementation: First, each geometric surface is parametrically mapped, mapping the three-dimensional surface to a two-dimensional parameter space (u,v); the Poisson disk sampling algorithm is executed in the parameter space to generate a set of sampling points that satisfy the minimum distance constraint; the sampling points in the parameter space are mapped back to the three-dimensional space through the parametric equation of the surface to obtain the coordinates of the three-dimensional sampling points on the surface; the sampling density is controlled by adjusting the minimum distance threshold r. In this embodiment, if the sampling target is set to approximately 5000 points, the total number of sampling points is adaptively adjusted to approach the target value.
[0033] Deduplication: Since adjacent faces in the CAD model may generate duplicate sampling points at common boundaries, the system performs deduplication on the sampled point cloud. Specifically, a nearest neighbor search algorithm based on spatial hashing is used: the 3D space is divided into grid cells of fixed size, each sampling point is assigned to the corresponding grid, and then point pairs with a distance less than a preset tolerance (such as 1e-6 meters) are searched within the same grid and adjacent grids, and duplicate points are marked and removed.
[0034] Unified output: The deduplicated point cloud data is organized into an N×3 floating-point coordinate array (where N is the number of points and 3 is the X, Y, and Z coordinate dimensions) and output in a unified format.
[0035] (3) PRT file processing flow PRT is the native part file format of Siemens NX (formerly UG) software. It is a proprietary binary format and cannot be directly parsed. When a PRT file format is detected, the following processing flow is executed: Format Conversion: The PRT file is converted to STEP format using the iDEE SDK (a commercial software development kit that supports conversion of multiple CAD formats). The iDEE SDK includes an NX format parsing engine, capable of reading the complete geometric and topological information from the PRT file and re-encoding it into a STEP file conforming to the ISO 10303 standard. During the conversion process, the system records detailed conversion logs, including conversion start time, end time, source file size, target file size, and conversion status. In this embodiment, the conversion success rate from PRT to STEP can exceed 99%.
[0036] Subsequent processing: After successful conversion, the system automatically passes the generated temporary STEP file to the aforementioned STEP file processing workflow, executing the complete process of CAD model loading, surface geometry extraction, Poisson disk sampling, deduplication, and unified output. The temporary STEP file generated during conversion is automatically deleted after point cloud data extraction is complete to save disk space.
[0037] (4) bin file processing flow A bin file is a custom binary point cloud data format, typically output directly from a 3D scanning device or generated after preprocessing. It is characterized by its small file size and fast reading speed. When a bin file format is detected, the following processing flow is executed: File header parsing: Read the first N bytes of the bin file as the file header, and parse the metadata information contained therein, including: number of points (32-bit or 64-bit integer), coordinate format (such as float32, float64), coordinate dimensions (usually 3, i.e., X, Y, Z), byte order (big endian or little endian) and possible custom marker bits.
[0038] Batch data reading: Based on the metadata information parsed from the file header, the offset position and total number of bytes of the point cloud data in the file are calculated. Using memory-mapped file technology or a batch read interface, all point coordinate data is read from disk into memory at once. Compared to point-by-point reading, batch reading significantly reduces the number of I / O system calls and significantly improves reading efficiency.
[0039] Unified Output: The read point coordinate data is directly converted into an N×3 floating-point coordinate array for output. Since the bin file itself is point cloud data, no geometric analysis or sampling is required, making it the fastest to process. In this embodiment, the processing speed of the three file formats is ranked as follows: bin > STEP > PRT.
[0040] (5) Unified output interface Regardless of the input file format, after the above parsing and conversion process, the final output is a unified data structure—an N×3 floating-point coordinate array. The subsequent point cloud registration and inference process only interacts with this unified data structure and is completely independent of the original format of the input file, thus achieving standardization and decoupling of the data processing flow.
[0041] 2. Intelligent memory management and inference execution After multiple calls to deep learning inference services, if intermediate tensors and caches are not released in a timely manner, GPU memory will continuously accumulate, eventually leading to OutOfMemoryError (OOM) errors. In particular, the MemoryArena mechanism used by inference engines such as ONNXRuntime, while reducing fragmentation caused by frequent allocation and release and improving inference performance through pre-allocation and reuse of GPU memory, also ensures that GPU memory only increases throughout the process's lifecycle, further exacerbating memory leaks. This invention designs a hierarchical memory management strategy to address this problem.
[0042] (1) Validity detection of reasoning conversation Before each point cloud registration inference execution, the system first performs a validity check on the currently held ONNXRuntime inference session. Specific checks include: State flag detection: Examine the internal state flags of the reasoning session object to confirm whether it is in an initialized and available state.
[0043] Probe inference detection: Submit a very small probe input (such as a 1×3 virtual point cloud) to the inference session, perform one forward propagation, and check whether it can return results normally without throwing any exceptions. The computational overhead of probe inference is minimal (usually less than 1 millisecond) and will not have a significant impact on system performance.
[0044] Memory status detection: Query the current GPU memory allocation status through the CUDA runtime API to confirm whether the memory area occupied by the inference model weights is still valid, and rule out session failure caused by memory being preempted by other processes or GPU hardware abnormalities.
[0045] (2) Automatic recovery when session fails If an inference session failure is detected (e.g., memory is preempted by other processes, GPU driver is abnormally reset, etc.), the system will automatically execute the following recovery process: ① Release the currently invalid inference session object and all resource references associated with it; ② Reload the ONNX model file from the disk or memory cache; ③ Create a new ONNXRuntime inference session instance, configure the CUDA execution provider, and set the memory pool parameters; ④ Perform a warm-up inference to enable the inference engine to complete internal memory pre-allocation and computation graph optimization; ⑤ Record the health status of the inference session (including detection time, failure cause, recovery result, etc.) in the system log to facilitate subsequent problem tracing and operation and maintenance analysis.
[0046] (3) Point cloud registration inference execution After confirming the validity of the inference session, the system takes point cloud data (N×3 coordinate array) in a uniform format as input and performs point cloud registration inference through the inference session. In this embodiment, the system can perform multiple registration inferences (such as using different random initializations or different hyperparameter configurations) to generate multiple candidate point cloud registration results for subsequent quality assessment steps to select the best one.
[0047] (4) Light cleaning operation After each inference iteration, the system performs a lightweight cleanup operation. The core objective of lightweight cleanup is to release unnecessary intermediate computing resources while maintaining the resident state of the inference model weights, enabling rapid switching between inference iterations. Specific operations include: Intermediate tensor cleanup: Explicitly delete references to all intermediate tensor variables generated during inference (such as temporary tensors generated during preprocessing, activation value tensors of intermediate layers of the model, temporary results generated during postprocessing, etc.), reducing their reference count to zero and triggering the Python garbage collection mechanism to release the GPU memory they occupy.
[0048] CUDA cache cleanup: The `torch.cuda.empty_cache()` function is called to release all unused cache blocks in PyTorch's CUDA cache allocator. The principle is that PyTorch's CUDA cache allocator uses a memory pool-like mechanism. When a tensor is released, the memory it occupies is not immediately returned to the operating system but is retained in the cache pool for subsequent allocation and reuse. The `empty_cache()` function releases all free memory blocks in the cache pool back to the CUDA driver, making them available for use by other processes or the ONNXRuntime memory pool.
[0049] Model weight retention: During lightweight cleanup, the weight parameters of the inference model (which typically occupy hundreds of MB to several GB of GPU memory) are not released and remain in GPU memory. This eliminates the need to reload the model weights from CPU memory or disk during the next inference iteration, avoiding the time overhead of model loading (which usually takes several seconds to tens of seconds) and ensuring low-latency response in high-frequency continuous inference scenarios.
[0050] Lightweight cleanup operations are suitable for high-frequency continuous inference scenarios, and can effectively prevent the accumulation of intermediate computing resources that lead to increased GPU memory without affecting the inference response speed.
[0051] (5) Real-time monitoring of GPU memory During the inference session and point cloud registration inference process, the system continuously acquires the actual GPU memory usage information and calculates the memory occupancy rate to achieve real-time monitoring of the memory status.
[0052] Real-world memory acquisition: The system obtains the actual memory usage of the GPU by calling the nvidia-smi command-line tool. Unlike the memory usage reported by the CUDA runtime API, nvidia-smi obtains memory allocation information from the GPU driver level, reflecting the total memory usage, including the ONNXRuntime memory pool, PyTorch cache allocator, CUDA context overhead, etc., providing a more accurate overall picture of memory usage. The system periodically calls the command `nvidia-smi --query-gpu=memory.used,memory.total --format=csv,noheader,nounits` via a subprocess to parse its standard output and obtain the used and total memory values.
[0053] Memory Utilization Calculation and Alarm: Based on the acquired used and total video memory values, the memory utilization rate is calculated as (used video memory / total video memory × 100%). When the memory utilization rate exceeds a preset threshold (e.g., 85%), the system triggers a memory alarm, notifying maintenance personnel through log recording, message push, or maintenance system notifications, so that timely intervention measures can be taken. In this embodiment, the error of memory monitoring can be controlled within 5%.
[0054] 3. Multi-dimensional evaluation and automatic optimization of registration quality This invention designs a multi-dimensional registration quality evaluation system, covering multiple dimensions such as overall accuracy, point cloud overlap, reliability, and statistical distribution.
[0055] (1) Calculation of Root Mean Square Error (RMSE) RMSE is the most basic indicator for measuring registration accuracy, reflecting the overall deviation between the registered point cloud and the reference point cloud. The calculation method is as follows: ① For each point in the reference point cloud, apply the estimated transformation matrix T (4×4 homogeneous transformation matrix) output by the registration inference to obtain the transformed point coordinates; ② For each transformed point, find its nearest neighbor in the source point cloud (accelerate the search using spatial index structures such as KD-tree or Ball tree), and calculate the Euclidean distance between them; ③ Calculate the root mean square error: RMSE = √(Σd² / N), where N is the total number of points in the reference point cloud.
[0056] The smaller the RMSE value, the higher the overall alignment of the two point clouds after registration.
[0057] (2) Calculation of Chamfer Distance Chamfer Distance is a bidirectional distance metric that provides a more comprehensive assessment of the overlap between two point clouds, avoiding local mismatches that may be overlooked by unidirectional nearest neighbor distance. The calculation method is as follows: ① Forward distance: For each point p in the reference point cloud, find its nearest neighbor q in the source point cloud, calculate the distance d(p,q), and average all the forward distances to obtain the forward distance; ② Reverse distance: For each point q in the source point cloud, find its nearest neighbor point p in the reference point cloud, calculate the distance d(q,p), and average all reverse distances to obtain the reverse distance; ③The average of the forward and reverse distances is used as the chamfer distance.
[0058] The chamfer distance takes into account the matching quality in both directions, and has better evaluation robustness for point cloud registration scenarios with local missing or occluded parts.
[0059] (3) Calculation of interior point proportions The in-point ratio reflects the proportion of precisely matched points to the total number of points in the registration result, and is an important indicator for measuring the reliability of registration. The calculation method is as follows: ① Set a distance threshold τ (e.g., 0.03 meters, which can be adjusted according to specific application scenarios and accuracy requirements); ② For each point in the reference point cloud, calculate the distance between its transformed value and its nearest neighbor in the source point cloud; ③Count the number of points whose distance is less than the threshold τ, and record them as the number of internal points; ④ Inner point ratio = Number of inner points / N, where N is the total number of points in the reference point cloud.
[0060] The closer the in-point ratio is to 1, the more points are precisely matched in the registration result, and the more reliable the registration quality.
[0061] (4) Calculation of statistical distance index To provide more complete distance distribution information, the system also calculates the following statistical indicators: Average distance: The arithmetic mean of all nearest neighbor distances, reflecting the average level of registration error.
[0062] Maximum distance: The maximum value among all nearest neighbor distances, reflecting the extreme case of registration error, and can be used to identify areas of severe local mismatch.
[0063] Standard deviation: The standard deviation of the nearest neighbor distance reflects the dispersion of the registration error. The smaller the standard deviation, the more uniform the registration error.
[0064] Median: The median value is taken after sorting all nearest neighbor distances from smallest to largest. It has good robustness to outliers and can more robustly reflect the central tendency of registration error.
[0065] Distance distribution histogram: The nearest neighbor distance is binned and statistically analyzed according to preset intervals (such as 0-0.01m, 0.01-0.02m, 0.02-0.03m, etc.) to generate distance distribution histogram data, which intuitively shows the distribution characteristics of registration error.
[0066] (5) Automatic selection mechanism When the system performs multiple registration inferences (e.g., using different random initializations, different hyperparameter configurations, or different combinations of registration algorithms) and generates multiple candidate point cloud registration results, the system automatically executes the optimization process: ① For each candidate registration result, calculate all the above quality assessment indicators (RMSE, ChamferDistance, in-point ratio, statistical indicators, etc.). ②Use RMSE as the main criterion for selection and compare the RMSE values of each candidate result; ③ Select the candidate registration result with the smallest RMSE as the output of the best point cloud registration result.
[0067] The reason for choosing RMSE as the main selection criterion is that RMSE has a quadratic penalty effect on large errors, which can effectively avoid selecting registration results with serious local mismatches. At the same time, it is simple to calculate and has a clear physical meaning, and is a registration accuracy index widely recognized in the industry.
[0068] (6) Quality threshold alarm and report generation After the selection process is completed, the system performs a threshold judgment on the RMSE value of the best registration result: If the RMSE of the best registration result exceeds the preset registration quality threshold, it means that all candidate results have not reached an acceptable level of accuracy. The system generates a registration failure alarm, prompting the user to check the quality of the input data or adjust the registration parameters.
[0069] Regardless of whether registration is successful or not, the system generates a JSON-formatted quality report containing all multi-dimensional quality assessment metrics. The report includes: Registration status (success / failure); RMSE, Chamfer Distance, and in-point ratio for optimal results; Statistical indicators (mean distance, maximum distance, standard deviation, median); Distance distribution histogram data; A comparison table of indicators for each candidate result; Transformation matrix parameters used for registration; Processing time and resource consumption information.
[0070] This quality report supports quality traceability and subsequent analysis, and can also serve as a basis for judgment in automated quality inspection lines.
[0071] 4. Scheduled restart and deep cleaning mechanism Long-running inference services suffer from various hidden resource accumulation issues, including but not limited to: file descriptor leaks at the operating system level, memory fragmentation, decreased Python runtime garbage collection efficiency, and context accumulation at the GPU driver level. These problems cannot be completely solved by simply cleaning up GPU memory; a thorough resource reset at the process level is required. This invention designs a service health assurance mechanism that combines scheduled restarts with deep cleanup.
[0072] (1) Scheduled restart mechanism The system is configured with scheduled tasks (such as those based on cron expressions or application-built-in timers) to automatically trigger the service restart process according to a preset time period (such as every 6 hours). The specific execution flow of the scheduled restart is as follows: Graceful Exit: When a service restart is triggered, the system does not immediately terminate the current process. Instead, it first marks the service status as restarting, stops accepting new registration requests (returning a 503 Service Unavailable status code), and then waits for all currently executing point cloud registration requests to complete. The system sets a maximum waiting timeout (e.g., 5 minutes). If any requests are still incomplete after the timeout, these requests are forcibly terminated. This graceful exit mechanism ensures that ongoing registration tasks are not interrupted or produce incomplete results due to a restart.
[0073] Process Restart: After all current requests have been processed (or forcibly terminated due to timeout), the system performs a process-level restart operation. In a containerized deployment environment, this is triggered by exiting the current container process, which is then used to trigger the container orchestration system's automatic restart policy. In a non-containerized environment, the process is restarted via the process manager.
[0074] Automatic recovery: After restarting, the new process automatically executes the initialization process, including: loading service configuration files, initializing the inference session and loading the inference model into GPU memory, performing warm-up inference, and starting health checks and resource monitoring services. The entire restart and recovery process is completed automatically without manual intervention.
[0075] Log recording: Every key node in the restart process (triggered restart, waiting for request completion, process exit, new process start, model loading completion, etc.) is recorded in the operation and maintenance log, including timestamp, restart reason (scheduled / manual / abnormal), time consumption, etc., which facilitates operation and maintenance auditing and problem investigation.
[0076] (2 Deep cleaning operation) Deep cleanup is a more thorough resource release strategy than lightweight cleanup, and it is performed before the service restart process or during service downtime (such as off-peak hours at night). Specific operations of deep cleanup include: ONNXRuntime Memory Pool Release: This function calls the release method of the ONNXRuntime inference session to release the memory pool it maintains internally. When the ONNXRuntime memory pool is created, it pre-allocates a large block of GPU memory for tensor allocation during inference. This memory is not released back to the CUDA driver during the session's lifetime. By destroying the inference session object and explicitly calling the release method, all memory in the memory pool is returned to the CUDA driver.
[0077] GPU cache and temporary buffer release: Releases all GPU caches and temporary buffers, including all cache blocks in PyTorch's CUDA cache allocator, pending operations in CUDA streams, and any custom GPU buffers.
[0078] Complete model unloading: This process completely unloads the weights of the inference model from GPU memory, releasing all GPU memory occupied by the model weights. It also releases the model file data and intermediate representations cached in CPU memory.
[0079] After deep cleaning, GPU memory usage should drop back to near the baseline level at process startup (typically containing only the basic overhead of the CUDA context, approximately several hundred MB). Deep cleaning is suitable for the following scenarios: Before the service restart process is executed, ensure that the old process completely releases all GPU resources before exiting; When a service is idle for an extended period (e.g., more than 30 minutes without inference requests), it will proactively release GPU memory for use by other services. When the video memory monitoring detects that the video memory usage rate is abnormally high for an extended period, this is used as an emergency cleanup measure.
[0080] 5. Health monitoring and operation and maintenance management The system of this invention provides a complete set of health check and resource monitoring API interfaces, supporting automated operation and maintenance and cloud-native architecture deployment.
[0081] (1) Health check interface ( / health) The system exposes an HTTP GET interface / health, which responds to health check requests and returns health status information in JSON format, including: Service running status: Returns the current running status of the service, with values of running (normal operation), restarting (restarting), stopped (stopped), or error (abnormal state). Container orchestration systems can use this interface to implement liveness probes and readiness probes, automatically detecting service health status and performing failover.
[0082] System resource usage information: Returns the current system's CPU usage (obtained by reading / proc / stat or calling the psutil library), system memory usage (total memory, used memory, available memory), and GPU memory usage (used video memory, total video memory, video memory utilization rate).
[0083] Process resource usage information: Returns details of the current service process's resource usage, including: number of process handles (number of file descriptors), number of threads, and process memory details (RSS resident memory, VMS virtual memory, shared memory, etc.). This information helps detect process-level resource leaks.
[0084] Model loading status and version information: Returns the loading status of the inference model (loaded / not loaded / loading), model version number, model file size, ONNX operator subset version, and other information.
[0085] (2) Resource monitoring interface ( / metrics) The system exposes an HTTP GET interface / metrics, which responds to resource monitoring requests, queries and returns structured monitoring data in real time. CPU monitoring: Real-time CPU utilization and system load (e.g., average load over 1 minute, 5 minutes, and 15 minutes).
[0086] Memory monitoring: Detailed information on system memory and process memory usage, including the size and trends of each memory region.
[0087] GPU monitoring: Details on GPU memory usage, GPU computing utilization, GPU temperature, GPU power consumption, etc.
[0088] The returned data format supports two modes: JSON format: Returns structured JSON data, which is convenient for front-end display and integration with custom monitoring systems; Prometheus format: Returns plain text metric data conforming to the Prometheus exposition format, which can be directly retrieved and stored by the Prometheus monitoring system, making it easy to build a unified monitoring dashboard and alarm rules.
[0089] (3) Manually restart the interface ( / restart) The system exposes an HTTP POST interface / restart, which responds to manual restart requests, allowing operations and maintenance personnel to trigger a forced restart process. Permission verification: Upon receiving a restart request, the system first verifies the identity and permissions of the requester (e.g., through API Key, JWTToken, or OAuth authentication) to ensure that only authorized personnel can trigger the restart operation, preventing service interruption due to malicious or accidental operations.
[0090] Forced restart execution: After successful permission verification, a forced restart process is triggered. Unlike the graceful exit of scheduled restart, manual restart can be configured to wait for the current request to complete (the default is to wait, but it can be terminated immediately by specifying a parameter).
[0091] Status Return: Returns the restart status (e.g., restart has been triggered) and the estimated recovery time (calculated based on historical restart time statistics, e.g., service is expected to be restored in 30 seconds), making it easier for operations and maintenance personnel to keep track of the service recovery progress.
[0092] The following are specific application examples of the method of the present invention: Taking industrial component registration services as an example, the specific operation process of this invention will be explained.
[0093] Scenario Description: Users need to perform registration and inspection on two mechanical parts, aligning the point cloud of the actual scanned parts with a standard CAD model to analyze processing deviations.
[0094] Input: STEP files for two mechanical parts, with the user submitting a registration request via a REST API.
[0095] Operation process: (1) Format parsing: The system receives two STEP files, automatically detects that the file extension is .step, and selects the STEP processing flow. The CAD model is loaded using the OpenCASCADE library, surface geometric information is extracted, and approximately 5000 points are uniformly extracted on each model surface using Poisson disk sampling. After deduplication, the output is a 5000×3 coordinate array.
[0096] (2) Inference session detection: The system detects that the current ONNXRuntime inference session is valid and there is no need to reload the model.
[0097] (3) Registration Inference: Input the two sets of point cloud data into the inference model and perform three registration inferences (using different initialization parameters) to generate three candidate registration results. After each inference, perform a lightweight cleanup by calling torch.cuda.empty_cache() to release the intermediate tensor cache, and the memory usage is stabilized at 6GB.
[0098] (4) Quality Assessment and Optimization: Calculate the quality indicators for the three candidate results. Result 1: RMSE = 0.025m; Result 2: RMSE = 0.015m; Result 3: RMSE = 0.032m. The system automatically selects Result 2, which has the lowest RMSE, as the best registration result. The complete indicators for the best result are: RMSE = 0.015m, Chamfer Distance = 0.012m, in-point ratio 85%, mean distance 0.013m, maximum distance 0.045m, standard deviation 0.008m, and median 0.011m. Since the RMSE does not exceed the quality threshold of 0.03m, the registration is successful.
[0099] (5) Service monitoring: The health check API returns the current status: CPU utilization 35%, system memory usage 12GB, GPU memory 6GB / 8GB, service status running, model version v2.1.
[0100] (6) Scheduled restart: The system has been running for 5 hours and 50 minutes. A scheduled restart will be triggered in 10 minutes. After the restart is triggered, the system will complete the processing of the current request, perform deep cleaning to release all GPU resources, restart the process and reload the model. The whole process takes about 30 seconds.
[0101] Execution result: More than 1000 inference runs were performed consecutively without any OutOfMemoryError (OOM) errors occurring; The service has been running continuously for more than 48 hours without failure. Successfully processed three mainstream industrial file formats with a conversion success rate of over 99%. The video memory monitoring error is less than 5%.
[0102] It should be noted that, for the sake of simplicity, the method embodiments are all described as a series of actions. However, those skilled in the art should understand that the embodiments of the present invention are not limited to the described order of actions, because according to the embodiments of the present invention, some steps can be performed in other orders or simultaneously. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions involved are not necessarily essential to the embodiments of the present invention.
[0103] Reference Figure 2 This diagram illustrates a structural block diagram of an industrial point cloud registration service operation system provided in an embodiment of the present invention, which may specifically include: The multi-format registration information receiving and conversion module is used to receive point cloud registration requests and point cloud files to be registered, detect the file format of the point cloud files to be registered, and convert the point cloud files to be registered into point cloud data in a unified format according to the parsing method corresponding to the detected file format. The intelligent video memory management module is used to perform validity checks on the inference session. If the inference session is detected to be valid, the inference model already loaded in the inference session is used to perform point cloud registration inference on the point cloud data. After the inference is completed, a lightweight cleanup operation is performed on the GPU. The lightweight cleanup operation includes cleaning up the intermediate tensor cache generated during the inference process, while keeping the weights of the inference model resident in the GPU video memory. It is also used to perform a deep cleanup operation when the deep cleanup conditions are met. The registration quality assessment module is used to perform multi-dimensional quality assessment on the candidate point cloud registration results output by the point cloud registration inference, and select the best point cloud registration result from the candidate point cloud registration results based on the quality assessment results. The scheduled restart and health monitoring module is used to automatically trigger the service restart process according to a preset time cycle during the registration service operation.
[0104] In an optional embodiment of the present invention, the multi-format registration information receiving and conversion module is further configured to: The file format is determined based on the extension of the point cloud file to be registered; if the point cloud file to be registered has no extension, the file header is read and magic number detection is performed to determine the file format. When the file format is STEP, the CAD model in the STEP file is loaded and the surface geometric information is extracted. Poisson disk sampling is performed on the surface geometric information to extract point cloud data. The extracted point cloud data is deduplicated and output as a coordinate array of preset dimensions. When the file format is PRT, the PRT file is converted to a STEP file, and the coordinate array of the preset dimensions is extracted and output through the parsing method corresponding to the STEP file. When the file format is bin, the file header is parsed to obtain the number of points and coordinate format, the point coordinate data is read in batches, and the output is a coordinate array of preset dimensions.
[0105] In an optional embodiment of the present invention, the intelligent video memory management module is further configured to: If the inference session is detected to be invalid, the inference model is automatically reloaded to the GPU memory and a new inference session is rebuilt, and the health status of the inference session is recorded in the log. During the inference session and point cloud registration inference process, the actual GPU memory usage information is obtained and the memory occupancy rate is calculated. When the memory occupancy rate exceeds a preset threshold, a memory alarm is triggered.
[0106] In an optional embodiment of the present invention, the timed restart and health monitoring module is further configured to: Configure a scheduled task to trigger service restarts periodically according to a preset time. When a service restart is triggered, wait for the currently executing point cloud registration request to complete before executing the service restart process; After the service restart process is completed, the inference model and service configuration are automatically reloaded, and the restart process is recorded in the operation and maintenance log.
[0107] In an optional embodiment of the present invention, the intelligent video memory management module is further configured to: Before the service restart process is executed or during service idle periods, the inference engine's memory pool, as well as all GPU caches and temporary buffers, are released, and the inference model is completely unloaded to release all GPU memory occupied by the inference model.
[0108] In an optional embodiment of the present invention, the timed restart and health monitoring module is further configured to: In response to a health check request, the system returns the registration service running status, system resource usage information, process resource usage information, and the loading status and version information of the inference model. In response to resource monitoring requests, it queries and returns structured monitoring data in real time, including CPU utilization, system memory usage, and GPU memory usage. In response to a manual restart request, after verifying permissions, a forced restart process is triggered, and the restart status and estimated recovery time are returned.
[0109] In an optional embodiment of the present invention, the registration quality assessment module is further configured to: Calculate the root mean square error, chamfer distance, inlier ratio, and at least one statistical distance index for each candidate registration result; Compare the root mean square errors of each candidate point cloud registration result, and select the candidate point cloud registration result with the smallest root mean square error as the best point cloud registration result. If the root mean square error of all candidate point cloud registration results exceeds the preset registration quality threshold, a registration failure alarm will be generated, and a quality report containing all multi-dimensional quality evaluation indicators will be generated.
[0110] As the system implementation is basically similar to the method implementation, it is described in a relatively simple way. For relevant details, please refer to the description of the method implementation.
[0111] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0112] The various embodiments in this specification are described in a related manner. The same or similar parts between the various embodiments can be referred to each other. Each embodiment focuses on describing the differences from other embodiments.
[0113] The above description is merely a preferred embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention are included within the scope of protection of the present invention.
Claims
1. A method for operating an industrial point cloud registration service, characterized in that, The method includes: Receive a point cloud registration request and a point cloud file to be registered, detect the file format of the point cloud file to be registered, and convert the point cloud file to be registered into point cloud data in a unified format according to the parsing method corresponding to the detected file format; A validity check is performed on the inference session. If the inference session is found to be valid, the inference model loaded in the inference session is used to perform point cloud registration inference on the point cloud data. After the inference is completed, a lightweight cleanup operation is performed on the GPU. The lightweight cleanup operation includes cleaning up the intermediate tensor cache generated during the inference process, while keeping the weights of the inference model resident in the GPU memory. Perform multi-dimensional quality assessment on the candidate point cloud registration results output by the point cloud registration inference, and select the best point cloud registration result from the candidate point cloud registration results based on the quality assessment results; During the registration service operation, the service restart process is automatically triggered according to the preset time cycle, and a deep cleanup operation is performed when the deep cleanup conditions are met.
2. The method according to claim 1, characterized in that, The process involves detecting the file format of the point cloud file to be registered, and converting it into point cloud data of a unified format according to the parsing method corresponding to the detected file format. This includes: The file format is determined based on the extension of the point cloud file to be registered; if the point cloud file to be registered has no extension, the file header is read and magic number detection is performed to determine the file format. When the file format is STEP, the CAD model in the STEP file is loaded and the surface geometric information is extracted. Poisson disk sampling is performed on the surface geometric information to extract point cloud data. The extracted point cloud data is deduplicated and output as a coordinate array of preset dimensions. When the file format is PRT, the PRT file is converted to a STEP file, and the coordinate array of the preset dimensions is extracted and output through the parsing method corresponding to the STEP file. When the file format is bin, the file header is parsed to obtain the number of points and coordinate format, the point coordinate data is read in batches, and the output is a coordinate array of preset dimensions.
3. The method according to claim 1, characterized in that, After performing validity checks on the inference session, the following is also included: If the inference session is detected to be invalid, the inference model is automatically reloaded to the GPU memory and a new inference session is rebuilt, and the health status of the inference session is recorded in the log. During the inference session and point cloud registration inference process, the actual GPU memory usage information is obtained and the memory occupancy rate is calculated. When the memory occupancy rate exceeds a preset threshold, a memory alarm is triggered.
4. The method according to claim 1, characterized in that, The service restart process is automatically triggered according to a preset time period, including: Configure a scheduled task to trigger service restarts periodically according to a preset time. When a service restart is triggered, wait for the currently executing point cloud registration request to complete before executing the service restart process; After the service restart process is completed, the inference model and service configuration are automatically reloaded, and the restart process is recorded in the operation and maintenance log.
5. The method according to claim 1, characterized in that, Perform a deep cleanup operation when the conditions for deep cleanup are met, including: Before the service restart process is executed or during service idle periods, the inference engine's memory pool, as well as all GPU caches and temporary buffers, are released, and the inference model is completely unloaded to release all GPU memory occupied by the inference model.
6. The method according to claim 1, characterized in that, The registration service operation also includes: In response to a health check request, the system returns the registration service running status, system resource usage information, process resource usage information, and the loading status and version information of the inference model. In response to resource monitoring requests, it queries and returns structured monitoring data in real time, including CPU utilization, system memory usage, and GPU memory usage. In response to a manual restart request, after verifying permissions, a forced restart process is triggered, and the restart status and estimated recovery time are returned.
7. The method according to claim 1, characterized in that, Perform multi-dimensional quality assessment on the candidate point cloud registration results output by the point cloud registration inference, and select the best point cloud registration result from the candidate point cloud registration results based on the quality assessment results, including: Calculate the root mean square error, chamfer distance, inlier ratio, and at least one statistical distance index for each candidate registration result; Compare the root mean square errors of each candidate point cloud registration result, and select the candidate point cloud registration result with the smallest root mean square error as the best point cloud registration result. If the root mean square error of all candidate point cloud registration results exceeds the preset registration quality threshold, a registration failure alarm will be generated, and a quality report containing all multi-dimensional quality evaluation indicators will be generated.
8. An industrial point cloud registration service operation system, characterized in that, The system includes: The multi-format registration information receiving and conversion module is used to receive point cloud registration requests and point cloud files to be registered, detect the file format of the point cloud files to be registered, and convert the point cloud files to be registered into point cloud data in a unified format according to the parsing method corresponding to the detected file format. The intelligent video memory management module is used to perform validity checks on the inference session. If the inference session is detected to be valid, the inference model already loaded in the inference session is used to perform point cloud registration inference on the point cloud data. After the inference is completed, a lightweight cleanup operation is performed on the GPU. The lightweight cleanup operation includes cleaning up the intermediate tensor cache generated during the inference process, while keeping the weights of the inference model resident in the GPU video memory. It is also used to perform a deep cleanup operation when the deep cleanup conditions are met. The registration quality assessment module is used to perform multi-dimensional quality assessment on the candidate point cloud registration results output by the point cloud registration inference, and select the best point cloud registration result from the candidate point cloud registration results based on the quality assessment results. The scheduled restart and health monitoring module is used to automatically trigger the service restart process according to a preset time cycle during the registration service operation.
9. The system according to claim 1, characterized in that, The multi-format registration information receiving and conversion module is also used for: The file format is determined based on the extension of the point cloud file to be registered; if the point cloud file to be registered has no extension, the file header is read and magic number detection is performed to determine the file format. When the file format is STEP, the CAD model in the STEP file is loaded and the surface geometric information is extracted. Poisson disk sampling is performed on the surface geometric information to extract point cloud data. The extracted point cloud data is deduplicated and output as a coordinate array of preset dimensions. When the file format is PRT, the PRT file is converted to a STEP file, and the coordinate array of the preset dimensions is extracted and output through the parsing method corresponding to the STEP file. When the file format is bin, the file header is parsed to obtain the number of points and coordinate format, the point coordinate data is read in batches, and the output is a coordinate array of preset dimensions.
10. The system according to claim 1, characterized in that, The intelligent video memory management module is also used for: If the inference session is detected to be invalid, the inference model is automatically reloaded to the GPU memory and a new inference session is rebuilt, and the health status of the inference session is recorded in the log. During the inference session and point cloud registration inference process, the actual GPU memory usage information is obtained and the memory occupancy rate is calculated. When the memory occupancy rate exceeds a preset threshold, a memory alarm is triggered.
