Defect fault positioning method for ship navigation detection system
By using a learnable KAN network and a mixed-sample data augmentation strategy in the ship navigation detection system, the problems of complex fault mode recognition and generalization ability under small sample conditions in FPGA embedded code are solved, enabling fast and accurate fault location and improving system reliability and development efficiency.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- DALIAN MARITIME UNIVERSITY
- Filing Date
- 2026-04-07
- Publication Date
- 2026-05-12
AI Technical Summary
Existing technologies lack the ability to identify complex fault modes in FPGA embedded code for ship navigation detection systems, have poor generalization ability under small sample conditions, and are difficult to meet the requirements of high reliability.
A learnable KAN network combined with a mixed sample data augmentation strategy is adopted. By extracting multidimensional fault features and fusing hierarchical features, a KAN confidence evaluation model is constructed to identify complex fault modes and locate faults under small sample conditions.
It improved fault location accuracy and system reliability, shortened defect troubleshooting time, reduced sea trial costs, and enhanced the safety and development efficiency of ship navigation detection systems.
Smart Images

Figure CN122009431A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of marine electronics and automation technology, and specifically to a method for locating defects and faults in a ship navigation detection system. Background Technology
[0002] Ship navigation detection systems are core equipment for ensuring safe navigation. They collect information such as ship position, heading, speed, water depth, and the dynamics of surrounding vessels to provide navigation decision support for the crew. Modern ship navigation detection systems are typically implemented based on FPGAs (Field-Programmable Gate Arrays) or embedded processors. Their software functions cover key tasks such as data fusion, target tracking, route planning, and collision warning, characterized by high software complexity and stringent reliability requirements. Due to their parallel processing capabilities and low latency, FPGAs are widely used in ship navigation detection systems for real-time-critical functional modules such as radar signal processing, multi-sensor data fusion, and high-speed communication interfaces.
[0003] In the development of FPGA embedded software for ship navigation detection systems, hardware description languages are typically used, or model-based design tools are employed to create models and automatically generate code. Due to the complexity of system functions and the diversity of interfaces, various defects are easily introduced during the code writing and generation stages, including sensor data parsing errors, abnormal state machine transitions, timing races, and alarm logic timing errors. These defects can lead to abnormal navigation data display, missed / false alarms, and in severe cases, even navigation accidents. Therefore, in the development of ship navigation detection systems, quickly and accurately locating defects in the FPGA code is crucial for ensuring ship navigation safety, shortening the system development cycle, and reducing the cost of sea trials.
[0004] Currently, significant progress has been made in the field of FPGA embedded software testing for mission-critical applications in terms of embedded software defect localization. However, when applied to FPGA-based embedded code in ship navigation detection systems, the following technical shortcomings still exist:
[0005] Firstly, in terms of complex fault mode identification, existing defect localization methods are mainly based on traditional spectrum analysis and statistical correlation calculations, which are insufficient in capturing the complex fault characteristics unique to FPGA code in ship navigation inspection systems. Faults in FPGA code often manifest as abnormal state machine transitions, timing race problems, cross-clock domain synchronization errors, and abnormal fusion of multiple parallel data streams. These faults are highly nonlinear and coupled, making it difficult for traditional methods to effectively fit them.
[0006] Secondly, regarding generalization ability under small sample conditions, real, high-quality fault samples are extremely scarce in the FPGA code of ship navigation inspection systems during the research and development and testing process. Existing defect localization methods lack targeted data augmentation mechanisms, and the localization accuracy of the model drops significantly when facing intermittent faults or unseen navigation scenarios, failing to meet the stringent reliability requirements of ship navigation inspection systems.
[0007] Therefore, there is an urgent need for a fault location method specifically designed for FPGA embedded code in ship navigation detection systems, which can effectively identify complex fault modes in FPGA code and maintain good generalization ability under small sample conditions. Summary of the Invention
[0008] To address the shortcomings of existing technologies in fault localization using FPGA embedded code in ship navigation inspection systems, such as insufficient ability to identify complex fault modes and poor generalization under small sample conditions, this invention provides a defect fault localization method for ship navigation inspection systems, comprising the following steps: S1. Obtain the execution data of each code module in the ship navigation detection system under test cases, wherein the test cases include pass cases and fail cases.
[0009] S11. Construct a test case set covering typical navigation scenarios based on the ship navigation simulation environment.
[0010] S12. Run the test case set and record the execution coverage of each code module.
[0011] Furthermore, the ship navigation simulation environment includes normal navigation scenarios and fault injection scenarios; the test cases include pass cases, failure cases, and auxiliary cases; the code modules include a radar echo processing module, an AIS data decoding module, a Kalman filter fusion module, an autonomous collision avoidance decision module, and a navigation data display module.
[0012] S2. Based on the execution data, extract multi-dimensional fault features for each code module, and concatenate the multi-dimensional fault features to construct a comprehensive feature vector for each code module.
[0013] S21. Extract suspicious features based on spectrum analysis, wherein the suspicious features based on spectrum analysis are used to characterize the statistical correlation between the coverage frequency of the code module in failed test cases and the test results.
[0014] S22. Extract suspicious features based on mutation analysis. The suspicious features based on mutation analysis are used to characterize the ability of the test case set to detect variants after the code module is mutated by the mutation tool. The suspicious features based on mutation analysis are divided into multiple subsets according to the test result type.
[0015] S23. Extract static features based on code complexity, including cyclomatic complexity, nesting depth, Holster length, and Holster difficulty.
[0016] S24. Extract text similarity-based features, which are used to characterize the text similarity between the description text of the failed use case and the identification information of the code module.
[0017] Furthermore, the suspicious features based on spectrum analysis are calculated using multiple spectrum formulas; the suspicious features based on mutation analysis are obtained by generating multiple variants of the code module and statistically analyzing the detection capability of the test case set against the variants; the features based on text similarity are obtained by performing word segmentation and similarity calculation on the description text of failed test cases and the module name, function name, signal name, and comments of the code module.
[0018] S3. Establish an initial KAN confidence evaluation model, wherein the initial KAN confidence evaluation model uses learnable spline parameters as activation functions.
[0019] Furthermore, the initial KAN confidence assessment model includes multiple hidden layers, each with multiple nodes. Each node is mapped using multiple piecewise linear basis functions, and the spline coefficients of the basis functions are updated as learnable parameters during network training. The initial KAN confidence assessment model employs a hierarchical feature fusion strategy to fuse multiple subsets of the suspicious features based on mutation analysis, hierarchically integrating the suspicious features based on spectrum analysis, the static features based on code complexity, and the features based on text similarity.
[0020] S4. The initial KAN confidence assessment model is trained using a mixed sample data augmentation strategy to obtain a trained KAN confidence assessment model.
[0021] S41. Sample the mixed weights from the beta distribution, randomly select two real fault samples and mix them to generate virtual training samples.
[0022] Furthermore, the feature vector of the virtual training sample is a weighted average of the feature vectors of two real fault samples, and the label is a soft label corresponding to the fault type.
[0023] S42. During training, a weighted cross-entropy loss function is used. The loss weights of the weighted cross-entropy loss function are determined based on the mixed weights. The gradient descent algorithm is used to optimize the network parameters to minimize the classification loss and regularization term.
[0024] S5. Input the comprehensive feature vector into the trained KAN confidence evaluation model, output the fault confidence of each code module, sort the code modules based on the fault confidence, and determine at least one code module with the highest ranking as the defect location.
[0025] Furthermore, after identifying at least one of the top-ranked code modules as the defect location, the defect location results are evaluated using the top N recall rate, average ranking, and first fault ranking as evaluation indicators.
[0026] Compared with the prior art, the present invention has the following beneficial effects: (1) This invention uses a learnable KAN network to replace the traditional neural network with a fixed activation function. Through adaptive adjustment of spline parameters, it can effectively fit the deep-seated fault modes caused by complex sensor interactions, timing competition, and nonlinear control logic in the ship navigation detection system. Compared with existing methods, this invention significantly enhances the ability to express the unique and complex fault characteristics of ships, and effectively improves the fault location accuracy.
[0027] (2) The present invention introduces a hybrid sample data augmentation strategy, which performs linear interpolation on the limited fault samples of the ship system in the feature space, effectively expanding the distribution of training data, enabling the KAN confidence assessment model to learn a smoother decision boundary. In the case of scarce real fault samples, the ability to locate occasional faults and unseen navigation scenarios is significantly improved, solving the problem of overfitting of existing methods under small sample conditions.
[0028] (3) The method of the present invention improves the reliability and development efficiency of the ship navigation detection system, which can help ship engineers quickly and accurately locate the source of failure in the complex code library, greatly shorten the defect investigation time, reduce the cost of sea trials, and ultimately improve the product reliability of the ship navigation detection system, providing a more solid technical guarantee for ship navigation safety. Attached Figure Description
[0029] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0030] Figure 1 This is a flowchart of a defect and fault location method for a ship navigation detection system according to the present invention.
[0031] Figure 2This is a schematic diagram illustrating the fault location principle based on KAN network and hybrid sample data enhancement of the present invention. Detailed Implementation
[0032] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0033] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0034] This invention provides the following technical solutions: like Figure 1 As shown, the present invention provides a method for locating defects in a ship navigation detection system, specifically including the following steps: S1. Obtain the execution data of each code module in the ship navigation detection system under the test cases.
[0035] S11. Construct a test case set covering typical navigation scenarios for the FPGA embedded code of the ship navigation detection system. The test cases are generated based on the ship navigation simulation environment and include normal navigation scenarios and fault injection scenarios.
[0036] S12. Construct a normal navigation test under good visibility conditions as a pass test case, a multi-target tracking test under poor visibility conditions as a fail test case, and a track estimation test after GPS signal loss as an auxiliary test case. These test cases simulate various complex operating conditions that ships may encounter in actual navigation.
[0037] S13. Run the above test cases and record the execution coverage of each FPGA code module in the ship navigation detection system. The code modules include the radar echo processing module, AIS data decoding module, Kalman filter fusion module, autonomous collision avoidance decision module, and navigation data display module. During the multi-target tracking test under poor visibility conditions in the failed test cases, the system records the execution counts of the radar target detection function in the radar echo processing module, the AIS message parsing function in the AIS data decoding module, and the collision risk calculation function in the autonomous collision avoidance decision module. This execution data provides the foundation for subsequent feature extraction.
[0038] S2. After obtaining the execution data of each module, multi-dimensional fault features of each module are extracted from multiple dimensions to form a feature vector. These features characterize the fault tendency of the module from different perspectives.
[0039] S21. Extract suspicious features based on spectrum analysis. Multiple spectrum formulas are used to calculate the statistical correlation between the coverage frequency of each code module in failed test cases and the test results. In this embodiment, the number of times a module is executed in a failed test case is divided by the square root of the product of the total number of failed test cases and the total number of times the module is executed. The suspiciousness score of each module can be obtained through calculation, forming a spectrum feature vector. If the suspiciousness scores of the autonomous collision avoidance decision module and the radar echo processing module are relatively high, it indicates that they are more strongly correlated with the fault.
[0040] S22. Extract suspicious features based on mutation analysis. Using meta-quantitative and mutation tools, generate multiple variants from the FPGA code of the ship navigation detection system to simulate common programming errors in ship systems. In this embodiment, the constructed variants include: changing the addition to subtraction in the calculation formula of the filter gain matrix in the Kalman filter module to simulate filter parameter setting errors; modifying the comparison logic of the calculation function in the autonomous collision avoidance decision module to simulate alarm threshold judgment errors; and swapping the bit operation order of the checksum calculation logic in the AIS data decoding module to simulate data parsing errors. Run the test case set, count the number of mutations detected for each variant, calculate the mutation suspicion of each module based on the results of the mutation detection, form a mutation feature vector, and divide it into multiple subsets according to the test result type.
[0041] S23. Extract static features based on code complexity. Using code metric tools, calculate the static complexity indices of each FPGA module in the ship navigation detection system, including cyclomatic complexity, nesting depth, Holstead length, and Holstead difficulty. In this embodiment, the Kalman filter fusion module has the highest code complexity, followed by the autonomous collision avoidance decision module, while the AIS data decoding module and the navigation data display module have relatively lower complexity. Modules with higher complexity have more complex code logic and a higher probability of failure.
[0042] S24. Extract features based on text similarity. Calculate the text similarity between the description text of the failed test cases and the module names, function names, signal names, and comments in the source code. In this embodiment, the description text of the failed test cases is: Radar target association failed under poor visibility conditions; the autonomous collision avoidance decision module did not trigger a warning. After word segmentation of the description text, similarity is calculated with the identification information of each module. The autonomous collision avoidance decision module and the radar echo processing module have higher text similarity scores, while the navigation data display module has a lower score.
[0043] S25, such as Figure 2 As shown, the above-mentioned multiple features are concatenated to form a comprehensive feature vector for each code module, which serves as the input to the subsequent confidence evaluation model.
[0044] S3. Establish an initial KAN confidence assessment model.
[0045] S31. Construct a KAN network as the core evaluation model. The KAN network uses learnable spline parameters as activation functions, enabling it to adaptively fit the complex nonlinear fault modes unique to FPGA code in ship navigation detection systems. The constructed KAN network contains multiple hidden layers, each with multiple nodes. At each node, multiple piecewise linear basis functions are used for mapping, and the spline coefficients of the basis functions are updated as learnable parameters during network training. The network input layer receives the comprehensive feature vector extracted in the above steps, and the output layer outputs the fault confidence of each code module through the Sigmoid function.
[0046] S32. Perform a linear transformation on the extracted comprehensive feature vector and normalize it to map it to a suitable interval to fit the domain of the basis functions of the KAN network.
[0047] S33. At each hidden layer node of the KAN network, a set of learnable spline coefficients is used to perform a nonlinear transformation on the input. This enables the model to learn complex nonlinear transmission relationships in the ship system, such as radar signal strength, target detection probability, and collision avoidance decision output, as well as deep-seated fault modes such as sensor data timing competition and abnormal state machine transitions.
[0048] As a preferred embodiment of this application, the network employs a hierarchical feature fusion strategy: first, multiple subsets within the mutation feature group are fused, and then spectral features, complexity features, and text similarity features are hierarchically integrated. This fusion method simulates the propagation process of faults from the lower-level signal processing module to the upper-level application module in a ship system. Through the stacking of multiple KAN networks, the fault confidence of each code module is finally output.
[0049] S4. The initial KAN confidence assessment model is trained using a mixed sample data augmentation strategy to obtain a trained KAN confidence assessment model.
[0050] S41. Select real fault samples from the historical test database of the ship navigation detection system. In this embodiment, these include servo response delay fault samples, compass data jump fault samples, and AIS target loss fault samples. Sample mixed weights from the beta distribution, randomly select two samples, and mix them to generate virtual training samples. Mix a servo response delay sample with a compass data jump sample to generate a new virtual fault sample. Its feature vector is the weighted average of the features of the two samples, and the label is a soft label corresponding to the fault type. The virtual sample generated in this way integrates the features of two different types of faults, enabling the model to learn a smoother decision boundary.
[0051] S42. A weighted cross-entropy loss function is adopted, and the loss weights of the weighted cross-entropy loss function are determined based on the mixed weights. The KAN network parameters are optimized using the gradient descent algorithm to minimize the classification loss and regularization term. After training, the model can effectively cope with label uncertainty caused by sensor noise and changes in operating conditions in the ship navigation environment.
[0052] S5. Input the comprehensive feature vector into the trained KAN confidence evaluation model, output the fault confidence of each code module, sort the code modules based on the fault confidence, and determine at least one code module with the highest ranking as the defect fault location.
[0053] S51. For faults in the ship navigation detection system, such as radar target association failure or failure of autonomous collision avoidance decision to trigger early warning, repeat the above S2 for each FPGA module in the system to extract its multi-dimensional fault characteristics.
[0054] S52. Input the feature vectors of each module into the trained KAN confidence assessment model, and calculate the fault confidence of each module. Sort all modules from high to low confidence, and output the top-ranked suspected fault locations.
[0055] S53. In the output results, the autonomous collision avoidance decision module and the radar target association module have the highest confidence levels, followed by the AIS data decoding module. Based on the ranking, the autonomous collision avoidance decision module with the highest confidence level was checked first. Code review revealed a defect in the calculation function of the autonomous collision avoidance decision module, which failed to correctly filter out AIS static target signals, leading to incorrect responses to non-ship targets. After fixing the defect in the calculation function and rerunning the test cases, the radar target association was successful, the autonomous collision avoidance decision module correctly calculated the collision risk and triggered the warning, and the fault was resolved.
[0056] S54. The method of this invention is compared with existing methods on the same test set. The test set contains real-world failure cases of ship navigation detection systems, covering various failure types in radar signal processing, data fusion, and collision avoidance decision-making. The top N recall rate, average ranking, and first failure ranking are used as evaluation metrics. The top N recall rate is calculated as the proportion of real-world fault modules successfully located in the top positions of the ranking; the average ranking is calculated as the average position of all real-world fault modules in the ranking list; and the first failure ranking records the ranking of the first identified fault module and calculates the average of all cases.
[0057] Experimental results show that the method of the present invention is superior to existing methods in terms of complex fault mode recognition capability and generalization capability under small sample conditions. It can help marine engineers quickly and accurately locate the source of faults in complex FPGA code libraries, significantly shorten the defect investigation time, reduce the cost of sea trials, and improve the product reliability of ship navigation detection systems.
[0058] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for locating defects in a ship navigation detection system, characterized in that, Includes the following steps: Obtain execution data of each code module in the ship navigation detection system under test cases, wherein the test cases include pass cases and fail cases; Based on the execution data, multi-dimensional fault features of each code module are extracted, and the multi-dimensional fault features are concatenated to construct a comprehensive feature vector for each code module. An initial KAN confidence evaluation model is established, wherein the initial KAN confidence evaluation model uses learnable spline parameters as activation functions; The initial KAN confidence assessment model is trained using a mixed sample data augmentation strategy to obtain a trained KAN confidence assessment model. The comprehensive feature vector is input into the trained KAN confidence evaluation model, and the fault confidence of each code module is output. The code modules are sorted based on the fault confidence, and at least one code module with the highest ranking is identified as the defect location.
2. The defect and fault location method for a ship navigation detection system according to claim 1, characterized in that, The steps for obtaining execution data of each code module in the ship navigation detection system under test cases include: constructing a test case set covering typical navigation scenarios based on the ship navigation simulation environment; running the test case set and recording the execution coverage of each code module.
3. The defect and fault location method for a ship navigation detection system according to claim 2, characterized in that, The ship navigation simulation environment includes normal navigation scenarios and fault injection scenarios; the test cases include pass cases, failure cases, and auxiliary cases; the code modules include radar echo processing module, AIS data decoding module, Kalman filter fusion module, autonomous collision avoidance decision module, and navigation data display module.
4. The defect and fault location method for a ship navigation detection system according to claim 1, characterized in that, The steps for extracting multidimensional fault features for each code module include: Suspicious features based on spectrum analysis are extracted, which are used to characterize the statistical correlation between the coverage frequency of code modules in failed test cases and test results; Extract suspicious features based on mutation analysis. The suspicious features based on mutation analysis are used to characterize the ability of the test case set to detect variants after the code module is mutated by mutation tools. The suspicious features based on mutation analysis are divided into multiple subsets according to the test result type. Extract static features based on code complexity, including cyclomatic complexity, nesting depth, Holstead length, and Holstead difficulty; Extract text similarity-based features, which are used to characterize the text similarity between the description text of the failed use cases and the identification information of the code modules.
5. A defect fault location method for a ship navigation detection system according to claim 4, characterized in that, The suspicious features based on spectrum analysis are calculated using multiple spectrum formulas; the suspicious features based on mutation analysis are obtained by generating multiple variants of the code module and statistically analyzing the detection capability of the test case set for the variants; the features based on text similarity are obtained by performing word segmentation and similarity calculation on the description text of failed test cases and the module name, function name, signal name, and comments of the code module.
6. A defect fault location method for a ship navigation detection system according to claim 4, characterized in that, The initial KAN confidence assessment model includes multiple hidden layers, each with multiple nodes. Each node is mapped using multiple piecewise linear basis functions, and the spline coefficients of the basis functions are updated as learnable parameters during network training. The initial KAN confidence assessment model employs a hierarchical feature fusion strategy to fuse multiple subsets of the suspicious features based on mutation analysis, hierarchically integrating the suspicious features based on spectrum analysis, the static features based on code complexity, and the features based on text similarity.
7. A defect fault location method for a ship navigation detection system according to claim 1, characterized in that, The mixed sample data augmentation strategy includes: sampling mixed weights from the beta distribution, randomly selecting two real fault samples for mixing to generate virtual training samples, wherein the feature vector of the virtual training samples is the weighted average of the feature vectors of the two real fault samples, and the label is a soft label corresponding to the fault type; during training, a weighted cross-entropy loss function is used, the loss weight of the weighted cross-entropy loss function is determined based on the mixed weights, and the gradient descent algorithm is used to optimize the network parameters to minimize the classification loss and regularization term.
8. A defect fault location method for a ship navigation detection system according to claim 1, characterized in that, After identifying at least one of the top-ranked code modules as the defect location, the defect location results are evaluated using the top N recall rate, average ranking, and first fault ranking as evaluation indicators.