Fault detection method and device for controller area network bus and vehicle
By combining the target hybrid detection model of one-dimensional convolutional neural network and long short-term memory network, the spatial characteristics and time dependence of the controller area network bus are extracted, which solves the problem of low fault detection accuracy in the existing technology and achieves real-time, Accurate fault identification and classification reduce dependence on professional knowledge and improve system stability.
Patent Information
- Application Number
- CN202410718360.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-04
- Publication Date
- 2024-09-17
AI Technical Summary
The fault detection accuracy of the controller LAN bus in the existing technology is low, and complex faults cannot be identified in real time. It also requires professional knowledge and detection before equipment installation or after the fault occurs, and cannot meet the needs of real-time fault diagnosis.
A target hybrid detection model composed of a one-dimensional convolutional neural network and a long short-term memory network is used to detect the controller area network bus data, extract spatial features and time dependencies, and realize the identification and classification of fault states through a deep learning model.
It improves the accuracy of controller LAN bus fault detection, achieves real-time monitoring and accurate identification of fault status, reduces dependence on professional knowledge, reduces labor costs, and improves system reliability and stability.
Smart Images

Figure CN118656729A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of vehicles, and in particular to a method and device for detecting a fault of a controller area network bus, and a vehicle. Background Art
[0002] Currently, the Controller Area Network (CAN) bus is a communication protocol widely used in the vehicle industry for connecting various electronic devices in the vehicle.
[0003] In the related art, the fault detection technology for the CAN bus usually relies on traditional hardware testing methods. For example, the voltage measurement method measures the voltage of the high level (CAN-H) and low level (CAN-L) wires of the CAN bus to determine whether the line has problems such as short circuit to ground or power supply, short circuit between phase lines, etc., which is effective in identifying short circuit faults. However, this method cannot determine other types of faults and requires the operator to have professional knowledge. It can usually only be used before the equipment is installed or after the fault occurs. It cannot meet the needs of real-time fault diagnosis, and thus has the problem of low accuracy in fault detection of the controller area network bus.
[0004] Currently, no effective solution has been proposed to the above-mentioned problem of low accuracy in fault detection on the CAN bus. Summary of the invention
[0005] The embodiments of the present invention provide a method, a device and a vehicle for detecting faults of a controller area network bus, so as to at least solve the technical problem of low accuracy in detecting faults of a controller area network bus.
[0006] According to one aspect of an embodiment of the present invention, a method for detecting a fault of a controller area network bus is provided. The method may include: obtaining controller area network bus data of a vehicle; calling a target hybrid detection model to detect the controller area network bus data to obtain a detection result, wherein the target hybrid detection model is composed of a one-dimensional convolutional neural network and a long short-term memory network, and is trained based on the controller area network bus fault data, and the detection result is used to characterize the probability of the fault category to which the controller area network bus data belongs.
[0007] Optionally, calling the target hybrid detection model to detect the controller LAN bus data to obtain a detection result, including: calling the convolution layer of the target hybrid detection model, performing a convolution operation on the controller LAN bus data, and extracting the spatial features of the controller LAN bus data; determining a feature map associated with the spatial features; and determining the detection result based on the feature map.
[0008] Optionally, based on the feature map, the detection result is determined, including: calling the pooling layer of the target mixed detection model to reduce the dimension of the feature map and save the target feature information in the feature map after the dimension reduction; calling the long short-term memory network layer of the target mixed detection model to associate the controller local area network bus data with each feature in the feature map after the dimension reduction to obtain the time dependency of the controller local area network bus data; based on the time dependency, the detection result is determined.
[0009] Optionally, based on the time dependency, the detection result is determined, including: calling the fully connected layer of the target mixed detection model to compress the time dependency output by the long short-term memory network layer into a vector; calling the output layer of the target mixed detection model to perform a nonlinear transformation on the vector according to the activation function to obtain the detection result.
[0010] Optionally, the long short-term memory network layer is called to associate the controller local area network bus data with each feature in the feature map to obtain the time dependency of the controller local area network bus data, including: according to the gating mechanism of the long short-term memory network layer, the controller local area network bus data is associated with each feature in the feature map to obtain the time dependency of the controller local area network bus data, wherein the gating mechanism includes at least one of the following: a forgetting gate mechanism, an input gate mechanism, and an output gate mechanism.
[0011] Optionally, the method further includes: acquiring controller area network bus fault data; preprocessing the controller area network bus fault data and determining the preprocessed controller area network bus fault data as a data set; and using the data set to train an initial hybrid detection model to obtain a target hybrid detection model.
[0012] Optionally, preprocessing the controller area network bus fault data includes: normalizing the controller area network bus fault number, and dividing the normalized controller area network bus fault data into short sequence data, wherein the normalized controller area network bus fault data is long sequence data.
[0013] Optionally, an initial mixed detection model is trained using a data set to obtain a target mixed detection model, including: determining a training set and a validation set from the data set, wherein the amount of data in the training set satisfies a preset ratio to the amount of data in the validation set; inputting the training set into the initial mixed detection model for training to obtain a trained initial mixed detection model; inputting the validation set into the trained initial mixed detection model for verification to determine the accuracy of the trained initial mixed detection model; and determining the initial mixed detection model with the highest accuracy among the trained initial mixed detection models as the target mixed detection model.
[0014] Optionally, the method further includes: determining a test set from the data set; testing the target mixture detection model using the test set to obtain a test result; and adjusting the target mixture detection model based on the test result.
[0015] Optionally, the method further includes: determining a cross entropy loss function as an objective function for training the initial hybrid detection model.
[0016] According to another aspect of an embodiment of the present invention, a fault detection device for a controller area network bus is also provided. The device may include: a first acquisition unit, used to acquire controller area network bus data of a vehicle; a detection unit, used to call a target hybrid detection model to detect the controller area network bus data to obtain a detection result, wherein the target hybrid detection model is composed of a one-dimensional convolutional neural network and a long short-term memory network, and is trained based on the controller area network bus fault data, and the detection result is used to characterize the probability of the fault category to which the controller area network bus data belongs.
[0017] According to another aspect of an embodiment of the present invention, a computer-readable storage medium is provided. The computer-readable storage medium includes a stored executable program, wherein when the executable program is running, the device where the computer-readable storage medium is located is controlled to execute the methods in various embodiments of the present invention.
[0018] According to another aspect of an embodiment of the present invention, there is further provided an electronic device, comprising: a memory storing an executable program; and a processor for running the program, wherein the method in each embodiment of the present invention is executed when the program is running.
[0019] According to another aspect of an embodiment of the present invention, a vehicle is further provided. When the vehicle is executed, the method in each embodiment of the present invention is implemented.
[0020] According to another aspect of an embodiment of the present invention, a computer program product is provided, including a computer program. When the computer program is executed by a processor, the method in each embodiment of the present invention is implemented.
[0021] According to another aspect of an embodiment of the present invention, a computer program product is provided, including a non-volatile computer-readable storage medium, wherein the non-volatile computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method in each embodiment of the present invention is implemented.
[0022] According to another aspect of the embodiments of the present invention, a computer program is further provided. When the computer program is executed by a processor, the methods in the embodiments of the present invention are implemented.
[0023] In an embodiment of the present invention, the controller area network bus data of the vehicle is obtained; the target hybrid detection model is called to detect the controller area network bus data to obtain a detection result, wherein the target hybrid detection model is composed of a one-dimensional convolutional neural network and a long short-term memory network, and is obtained based on the training of the controller area network bus fault data, and the detection result is used to characterize the probability of the fault category to which the controller area network bus data belongs. That is to say, the embodiment of the present invention combines a one-dimensional convolutional neural network and a long short-term memory network, extracts the spatial features of the CAN bus data by the one-dimensional convolutional neural network, and processes the time dependency in the CAN bus data by the long short-term memory network, so as to more accurately identify and classify the fault state of the CAN bus, thereby achieving the technical effect of improving the accuracy of fault detection of the controller area network bus, and solving the technical problem of low accuracy of fault detection of the controller area network bus. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:
[0025] Figure 1 is a flow chart of a method for detecting a fault of a controller area network bus according to an embodiment of the present invention;
[0026] Figure 2 is a flow chart of a fault diagnosis method based on deep learning according to an embodiment of the present invention;
[0027] Figure 3 It is a schematic diagram of a fault detection device for a controller area network bus according to an embodiment of the present invention. DETAILED DESCRIPTION
[0028] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0029] It should be noted that the terms "first", "second", etc. in the specification of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0030] Example 1
[0031] According to an embodiment of the present invention, an embodiment of a method for detecting a fault of a controller local area network bus is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0032] Figure 1 FIG. 1 is a flow chart of a method for detecting a fault of a controller area network bus according to an embodiment of the present invention. Figure 1 As shown, the method may include the following steps:
[0033] Step S102, obtaining the vehicle's controller area network bus data.
[0034] In the technical solution provided in step S102 of the present invention, the vehicle's controller area network bus data can be obtained. The controller area network CAN bus data can at least include information such as control commands, sensor data, and actuator status between different devices in the vehicle, and can be used for mutual communication and collaboration between various devices to achieve complex system control and data exchange.
[0035] Step S104, calling the target hybrid detection model to detect the controller area network bus data to obtain a detection result, wherein the target hybrid detection model is composed of a one-dimensional convolutional neural network and a long short-term memory network, and is trained based on the controller area network bus fault data, and the detection result is used to characterize the probability of the fault category to which the controller area network bus data belongs.
[0036] In the technical solution provided in the above step S104 of the present invention, after obtaining the controller area network bus data of the vehicle, the target hybrid detection model can be called to detect the controller area network bus data to obtain the detection result. Among them, the target hybrid detection model can be composed of a one-dimensional convolutional neural network (One Dimensional Convolutional Neural Network, referred to as 1DCNN) and a long short-term memory network (Long Short Term Memory, referred to as LSTM), and the target hybrid detection model can be trained based on the controller area network bus fault data, and the target hybrid detection model can be called a 1DCNN-LSTM model. The controller area network bus fault data can be collected from the industrial site. The detection result can be used to characterize the probability of the fault category to which the controller area network bus data belongs.
[0037] In this embodiment, the one-dimensional convolutional neural network 1DCNN can be a neural network model for processing one-dimensional data (such as text and time series, etc.), which can extract features from input data through convolutional layers and pooling layers, and then perform classification or regression tasks through fully connected layers. It can be used for feature extraction and pattern recognition of one-dimensional data, thereby achieving classification, regression or other prediction tasks for the data. The long short-term memory network LSTM can be an artificial neural network for processing and predicting time series data, which is suitable for data with long-term dependencies. By introducing a gating mechanism, it can effectively capture and memorize long-term dependencies in the input sequence, thereby achieving good results in the fields of speech recognition, natural language processing, time series prediction, etc. It can be used to solve the problem of gradient vanishing or gradient explosion that is prone to occur in traditional neural networks when processing time series data, so as to better capture long-term dependencies in the data.
[0038] In the above steps S102 to S104 of the present invention, the controller area network bus data of the vehicle is obtained; the target hybrid detection model is called to detect the controller area network bus data to obtain the detection result, wherein the target hybrid detection model is composed of a one-dimensional convolutional neural network and a long short-term memory network, and is obtained based on the training of the controller area network bus fault data, and the detection result is used to characterize the probability of the fault category to which the controller area network bus data belongs. That is to say, the embodiment of the present invention can more accurately identify and classify the fault state of the CAN bus by combining a one-dimensional convolutional neural network and a long short-term memory network, extracting the spatial features of the CAN bus data by the one-dimensional convolutional neural network, and processing the time dependency in the CAN bus data by the long short-term memory network, thereby achieving the technical effect of improving the accuracy of fault detection of the controller area network bus, and solving the technical problem of low accuracy of fault detection of the controller area network bus.
[0039] The above method of this embodiment is further introduced below.
[0040] As an optional implementation method, step S104, calling the target hybrid detection model to detect the controller LAN bus data to obtain the detection result, including: calling the convolution layer of the target hybrid detection model, performing a convolution operation on the controller LAN bus data, and extracting the spatial features of the controller LAN bus data; determining a feature map associated with the spatial features; and determining the detection result based on the feature map.
[0041] In this embodiment, after acquiring the controller area network bus data of the vehicle, the convolution layer of the target hybrid detection model can be called to perform a convolution operation on the controller area network bus data to extract the spatial features of the controller area network bus data. After extracting the spatial features of the controller area network bus data, a feature map associated with the spatial features can be determined. Further based on the determined feature map, the detection result can be determined. Among them, the convolution layer of the target hybrid detection model can be called a 1DCNN layer. The spatial features can be characteristics such as the distribution, shape, and structure of the CAN bus data in space. The feature map can be an image feature representation obtained by a convolution operation, and can be the output obtained after the input data is processed by the convolution layer, reflecting the spatial features of the input data, such as edges, textures, colors, and other information, which can be used as important information for subsequent processing and classification.
[0042] Optionally, after acquiring the CAN bus data of the vehicle, the spatial features of the data can be extracted through a convolution layer, and the convolution kernel can be used to slide on the sequence to capture the local pattern. After the convolution operation is performed on the CAN bus data, a feature map can be obtained. Further based on the obtained feature map, the detection result can be determined.
[0043] As an optional implementation method, the detection result is determined based on the feature map, including: calling the pooling layer of the target mixed detection model to reduce the dimension of the feature map and save the target feature information in the feature map after the dimension reduction; calling the long short-term memory network layer of the target mixed detection model to associate the controller local area network bus data with each feature in the feature map after the dimension reduction to obtain the time dependency of the controller local area network bus data; and determining the detection result based on the time dependency.
[0044] In this embodiment, after determining the feature map associated with the spatial feature, the pooling layer of the target mixed detection model can be called to reduce the dimension of the feature map and save the target feature information in the feature map after the dimension reduction. After the feature map is reduced in dimension, the long short-term memory network layer of the target mixed detection model can be called to associate the controller area network bus data with each feature in the feature map after the dimension reduction to obtain the time dependency of the controller area network bus data. Further based on the obtained time dependency, the detection result can be determined. Among them, the long short-term memory network layer can be called an LSTM layer. The target feature information can be important information in the feature map.
[0045] Optionally, after performing a convolution operation on the CAN bus data to obtain a feature map, that is, after the convolution layer, a pooling layer (average pooling and maximum pooling) can be used to reduce the dimension of the feature map while retaining important information. Further, an LSTM layer can be introduced to handle the time dependency of the sequence data. Further based on the obtained time dependency, the detection result can be determined.
[0046] As an optional implementation method, the detection result is determined based on the time dependency, including: calling the fully connected layer of the target mixed detection model to compress the time dependency output by the long short-term memory network layer into a vector; calling the output layer of the target mixed detection model to perform a nonlinear transformation on the vector according to the activation function to obtain the detection result.
[0047] In this embodiment, after obtaining the time dependency, the fully connected layer of the target mixture detection model can be called to compress the time dependency output by the long short-term memory network layer into a vector. Further, the output layer of the target mixture detection model can be called to perform a nonlinear transformation on the vector according to the activation function to obtain the detection result. Among them, the activation function can be called a softmax activation function, which can be used to output the probability of each category.
[0048] Optionally, after the LSTM layer, a fully connected layer can be used to perform high-level feature extraction and prepare for the final classification task. Finally, the output layer uses a softmax activation function to output the probability of each category to achieve the classification of the fault state.
[0049] As an optional implementation method, calling the long short-term memory network layer, associating the controller local area network bus data with each feature in the feature map, and obtaining the time dependency of the controller local area network bus data, including: according to the gating mechanism of the long short-term memory network layer, associating the controller local area network bus data with each feature in the feature map, and obtaining the time dependency of the controller local area network bus data, wherein the gating mechanism includes at least one of the following: a forgetting gate mechanism, an input gate mechanism, and an output gate mechanism.
[0050] In this embodiment, the controller area network bus data can be associated with each feature in the feature map according to the gating mechanism of the long short-term memory network layer to obtain the time dependency of the controller area network bus data. The gating mechanism includes at least one of the following: a forget gate mechanism, an input gate mechanism, and an output gate mechanism. The forget gate mechanism can be a mechanism for controlling whether the information in the memory cell of the previous time step is forgotten. When the forget gate output is close to 0, it means that the information in the memory cell needs to be forgotten; when it is close to 1, it means that the information in the memory cell needs to be retained. The input gate mechanism can be a mechanism for controlling how the input information of the current time step is integrated into the memory cell. The input gate will decide whether to integrate the new information into the memory cell based on the input information and the state of the memory cell of the previous time step. The output gate mechanism can be a mechanism for controlling how the information in the memory cell is output. The output gate will decide the output information based on the state of the memory cell.
[0051] Optionally, after the pooling layer, an LSTM layer can be introduced to handle the temporal dependencies of sequence data, capturing long-term dependencies through its internal forget gate, input gate, and output gate mechanisms.
[0052] As an optional implementation manner, the method also includes: obtaining controller LAN bus fault data; preprocessing the controller LAN bus fault data, and determining the preprocessed controller LAN bus fault data as a data set; using the data set to train an initial hybrid detection model to obtain a target hybrid detection model.
[0053] In this embodiment, controller area network bus fault data may be obtained. After obtaining the controller area network bus fault data, the controller area network bus fault data may be preprocessed, and the preprocessed controller area network bus fault data may be determined as a data set. Further, the data set may be used to train an initial hybrid detection model to obtain a target hybrid detection model. The controller area network bus fault data may be referred to as CAN bus fault data.
[0054] Optionally, CAN bus fault data is collected from an industrial site, preprocessed, and the preprocessed CAN bus fault data is used as a data set, which includes a normal state and eight types of abnormal states of the CAN bus signal line voltage. The data set can be further used to train an initial hybrid detection model to obtain a target hybrid detection model.
[0055] As an optional implementation method, the controller area network bus fault data is preprocessed, including: normalizing the number of controller area network bus faults, and dividing the normalized controller area network bus fault data into short sequence data, wherein the normalized controller area network bus fault data is long sequence data.
[0056] In this embodiment, after acquiring the CAN bus fault data, the acquired CAN bus fault data may be normalized, and the normalized CAN bus fault data may be segmented into short sequence data, wherein the normalized CAN bus fault data is long sequence data.
[0057] Optionally, after collecting CAN bus fault data from the industrial site, each type of data can be normalized to eliminate the influence of voltage amplitude. The sliding window method can be further applied to divide the data into short sequences of length 400. That is, each data sequence is normalized to eliminate the difference in voltage amplitude between different types of data, thereby reducing interference factors during model training. The sliding window method is further used to divide the long sequence of CAN bus fault data into short sequences, each sequence containing a fixed number of data units, for example, 400 data points.
[0058] As an optional implementation method, an initial mixed detection model is trained using a data set to obtain a target mixed detection model, including: determining a training set and a validation set from the data set, wherein the data volume of the training set satisfies a preset ratio to the data volume of the validation set; inputting the training set into the initial mixed detection model for training to obtain a trained initial mixed detection model; inputting the validation set into the trained initial mixed detection model for verification to determine the accuracy of the trained initial mixed detection model; and determining the initial mixed detection model with the highest accuracy among the trained initial mixed detection models as the target mixed detection model.
[0059] In this embodiment, after the preprocessed controller LAN bus fault data is determined as a data set, a training set and a validation set can be determined from the data set according to a preset ratio. The training set can be input into the initial mixed detection model for training to obtain a trained initial mixed detection model. The validation set can further be input into the trained initial mixed detection model for verification to determine the accuracy of the trained initial mixed detection model. After determining the accuracy of the trained initial mixed detection model, the initial mixed detection model with the highest accuracy can be determined as the target mixed detection model. Among them, the preset ratio can be a ratio set in advance according to actual conditions, for example, it can be 7:2:1, that is, the data set can be divided into a training set, a validation set and a test set according to a ratio of 7:2:1. This is only for example, and no specific limitation is made on the specific allocation ratio of the preset ratio.
[0060] Optionally, after using the CAN bus fault data collected from the industrial site as a data set, the data set can be divided into a training set, a validation set, and a test set in a ratio of 7:2:1 to complete the preparation of the data set. The prepared data set can be further input into the 1DCNN-LSTM model for training. Finally, the model with the highest accuracy on the validation set during the training process is saved as the final model to complete the model training.
[0061] This embodiment divides the data set into a training set, a validation set, and a test set, and selects the optimal model based on the validation accuracy during the training process.
[0062] As an optional implementation manner, the method also includes: determining a test set from the data set; using the test set to test the target mixture detection model to obtain a test result; and adjusting the target mixture detection model based on the test result.
[0063] In this embodiment, after the preprocessed controller area network bus fault data is determined as a data set, a test set can be determined from the data set. After the test set is determined, the target hybrid detection model can be tested using the test set to obtain a test result. Further based on the obtained test result, the target hybrid detection model can be adjusted.
[0064] As an optional implementation manner, the method further includes: determining a cross entropy loss function as an objective function for training the initial hybrid detection model.
[0065] In this embodiment, the cross entropy loss function can be determined as the objective function for training the initial hybrid detection model. The cross entropy loss function can be a loss function that measures the difference between two probability distributions. Using the cross entropy loss function as the objective function for model training can minimize the difference between the predicted result and the actual label.
[0066] This embodiment combines 1DCNN and LSTM, and uses the advantages of the two networks to process the characteristics of CAN bus data. 1DCNN is responsible for extracting local spatial features in the data, and LSTM processes long-term dependencies in time series data, so that the model can more comprehensively understand the operating status of the CAN bus, monitor the voltage changes on the CAN bus in real time, and quickly and accurately identify normal states and various abnormal states. This real-time performance is crucial for early detection and prevention of potential system failures, and helps reduce downtime and economic losses.
[0067] This embodiment obtains the controller area network bus data of the vehicle; calls the target hybrid detection model to detect the controller area network bus data to obtain the detection result, wherein the target hybrid detection model is composed of a one-dimensional convolutional neural network and a long short-term memory network, and is obtained based on the training of the controller area network bus fault data, and the detection result is used to characterize the probability of the fault category to which the controller area network bus data belongs. That is to say, the embodiment of the present invention combines the one-dimensional convolutional neural network and the long short-term memory network, extracts the spatial characteristics of the CAN bus data by the one-dimensional convolutional neural network, and processes the time dependency in the CAN bus data by the long short-term memory network, so as to more accurately identify and classify the fault state of the CAN bus, thereby achieving the technical effect of improving the accuracy of fault detection of the controller area network bus, and solving the technical problem of low accuracy of fault detection of the controller area network bus.
[0068] Example 2
[0069] The technical solution of the embodiment of the present invention is illustrated below in conjunction with preferred implementation modes.
[0070] At present, CAN bus is a communication protocol widely used in the vehicle industry. It is used to connect various electronic devices in the vehicle, including but not limited to: engine control module, braking system, air conditioning system, airbag and door controller. For the engine control module, CAN bus is used to transmit engine-related data, such as engine speed, temperature, oil pressure, etc. The CAN bus is used to transmit brake pressure, anti-lock braking system (ABS) information, etc. in the braking system. The CAN bus connects the air conditioning control unit to transmit settings such as temperature and wind speed. The CAN bus is used to transmit airbag deployment status, fault information, etc. The CAN bus connects the door control unit to transmit instructions such as door locking and window lifting.
[0071] In addition, some high-end vehicles also use a third CAN bus, the infotainment bus, which is mainly used for satellite navigation, intelligent communication systems, etc. In summary, the CAN bus plays a key role in the vehicle electronic control system, simplifies wiring design, improves reliability, and makes the system more flexible and easy to expand.
[0072] Existing CAN bus fault diagnosis technology mainly relies on traditional hardware testing methods. For example, the voltage measurement method measures the voltage of the CAN-H and CAN-L wires to determine whether the line has problems such as short circuit to ground or power supply, short circuit between phase lines, etc. The resistance measurement method measures the resistance between CAN-H and CAN-L of the diagnostic interface to determine whether there is a terminal resistance short circuit. Communication quality analysis is to analyze the communication quality on the CAN bus, including signal interference, transmission rate, data integrity, etc. Although the above method is effective in identifying short-circuit faults, it cannot determine other types of faults. In addition, the above method also requires the operator to have certain professional knowledge, and can usually only be used before the equipment is installed or after a fault occurs, which cannot meet the needs of real-time fault diagnosis.
[0073] Since the CAN bus may be affected by harsh working environments and high-load operations, the fault types are diverse and complex, and traditional fault diagnosis methods may not be effective enough in dealing with these complex faults, especially when no fault signs can be observed, resulting in a high complexity of fault diagnosis. As the requirements for real-time performance of automation systems continue to increase, existing fault diagnosis technologies face the dual challenges of real-time performance and accuracy, while traditional hardware testing methods cannot achieve real-time monitoring, and methods based on signal processing may be insufficient in accuracy, resulting in low real-time performance and accuracy of fault diagnosis.
[0074] Existing fault diagnosis methods usually require professional personnel to operate and interpret, which not only increases labor costs, but may also be impractical in resource-limited environments, resulting in problems of limited expertise and resources in fault diagnosis. In practical applications, the CAN bus may have multiple types of faults at the same time, and existing fault diagnosis technologies may have difficulty in identifying and processing these complex fault conditions at the same time, resulting in poor diagnostic capabilities for multiple fault types.
[0075] As an optional implementation, a method and system for automatically generating software code for CAN fault diagnosis is proposed. The method automatically generates CAN fault diagnosis software code based on a cyclic redundancy check (CRC) function.
[0076] As another optional implementation, a track circuit fault diagnosis method based on deep convolutional neural network is proposed. The method monitors track circuit segment variables in real time, divides training samples and test samples, performs data normalization, establishes a convolutional neural network model, optimizes fault parameters, trains the model, and performs performance analysis and fault diagnosis result output. However, the method does not involve the hybrid model architecture of 1DCNN and LSTM.
[0077] As another optional implementation, a DSP software update method, system and storage medium based on CAN diagnosis are proposed. The method is based on CAN diagnosis refresh DSP software update, including compressing and converting the digital signal processing (Digital Signal Processing, referred to as DSP) application into a corresponding format file, transmitting the data to the micro control unit (Micro Control Unit, referred to as MCU) through CAN diagnosis refresh, and the MCU and DSP complete data transmission and update through the interface, which can be used to transmit data through CAN diagnosis. However, the method does not involve CAN bus fault diagnosis.
[0078] In order to solve the above problems, this application proposes a fault diagnosis method based on deep learning. The method combines a one-dimensional convolutional neural network 1DCNN and a long short-term memory network LSTM. By real-time monitoring of the voltage changes on the CAN bus, and utilizing the powerful feature extraction and pattern recognition capabilities of the deep learning model, it achieves accurate diagnosis of CAN bus faults, improves the accuracy and real-time performance of fault diagnosis, and reduces dependence on professional knowledge.
[0079] This embodiment can more accurately identify and classify the fault status of the CAN bus by combining the one-dimensional convolutional neural network 1DCNN and the long short-term memory network LSTM. Among them, 1DCNN is responsible for extracting the spatial features of the data, and LSTM processes the long-term dependencies in the time series data. The fusion of this deep learning model makes the accuracy of fault diagnosis reach 99.71%, thereby achieving the effect of improving the accuracy of fault diagnosis. In addition, the deep learning model can process and analyze the voltage change data on the CAN bus in real time, so as to realize the real-time monitoring of faults, which is crucial for preventing potential system failures and reducing unexpected downtime, especially in industrial automation and vehicle electronic control systems with extremely high real-time requirements, so as to achieve the purpose of real-time fault monitoring.
[0080] The model proposed in this embodiment has fewer parameters and can be easily deployed on embedded devices, which is particularly important for achieving real-time monitoring in resource-constrained environments. In addition, the flexibility and efficiency of the model allow it to be integrated with other systems to improve the overall fault diagnosis and processing capabilities, thereby having the advantages of easy deployment and integration. In addition, traditional fault diagnosis methods usually require operators to have certain professional knowledge to interpret voltage waveforms or perform connectivity tests. The deep learning-based model in this embodiment can automatically learn and identify fault modes from data, reducing dependence on professional technicians, making fault diagnosis easier and faster, thereby achieving the effect of reducing dependence on professional knowledge.
[0081] Furthermore, in terms of improving the reliability and stability of the system, this embodiment can significantly improve the reliability and stability of the entire system through accurate fault diagnosis and timely fault response. By timely discovering and handling faults, the spread and deterioration of faults can be avoided, thereby reducing maintenance costs and avoiding potential production losses. In summary, the deep learning model proposed in this embodiment has produced significant beneficial effects in improving the accuracy of fault diagnosis, achieving real-time monitoring, reducing professional knowledge requirements, facilitating deployment, improving system stability, and promoting future research.
[0082] After acquiring the CAN bus data, the CAN bus data may be preprocessed, which may at least include data segmentation and normalization. When segmenting the CAN bus data, a sliding window method may be used to segment a long sequence of CAN bus data into short sequences, each sequence containing a fixed number of data units, for example, 400 data points. When normalizing the CAN bus data, each data sequence may be normalized to eliminate the difference in voltage amplitude between different categories of data, thereby reducing interference factors during model training.
[0083] Figure 2 is a flow chart of a fault diagnosis method based on deep learning according to an embodiment of the present invention. Figure 2 As shown, the process of the fault diagnosis method based on deep learning may include the following steps:
[0084] Step S201, input CAN bus high and low level data.
[0085] In the above step S201, the high level data and low level data of the CAN bus may be input into the 1DCNN-LSTM model.
[0086] Step S202, using three convolutional layers to extract the spatial features of the data.
[0087] In the above step S202, the spatial features of the data are extracted through the convolution layer, that is, the 1DCNN layer, and the convolution kernel is used to slide on the sequence to capture the local pattern. Among them, the first convolution layer uses four filters, after average pooling processing, the second convolution layer uses eight filters, after average pooling processing, the third convolution layer uses sixteen filters, after large pooling processing, and input into the LSTM layer.
[0088] Step S203, flattening the data to adapt to the subsequent network structure.
[0089] In the above step S203, pooling layers (average pooling and maximum pooling) are used after the convolutional layer to reduce the dimension of the feature map while retaining important information.
[0090] Step S204, using the LSTM layer to extract the time features of the data.
[0091] In the above step S204, the LSTM layer is introduced to process the temporal dependency of the sequence data, and the long-term dependency is captured through its internal forget gate, input gate and output gate mechanism.
[0092] Step S205, use the fully connected layer to perform feature fusion and directly output after dimensionality reduction.
[0093] In the above step S205, a fully connected layer is used after the LSTM layer to perform high-level feature extraction and prepare for the final classification task.
[0094] Step S206, output the diagnosis result.
[0095] In the above step S206, the probability of the fault category is output through the output layer, and the probability of each category is output using the softmax activation function to achieve the classification of the fault state.
[0096] It should be noted that the cross entropy loss function is used as the objective function of model training to minimize the difference between the predicted results and the actual labels. During the training process, the data set is divided into a training set, a validation set, and a test set, and the optimal model is selected by the validation accuracy during the training process.
[0097] The CAN bus fault data collected from the industrial site is used as the data set. The data set includes the normal state and eight abnormal states of the CAN bus signal line voltage. First, each type of data is normalized to eliminate the influence of the voltage amplitude. Secondly, the sliding window method is used to divide the data into short sequences of length 400, and the data set is divided into training set, validation set and test set in a ratio of 7:2:1 to complete the preparation of the data set. The prepared data set is further input into the 1DCNN-LSTM model for training. The model with the highest accuracy on the validation set during the training process is saved as the final model to complete the model training.
[0098] This embodiment combines 1DCNN and LSTM, and uses the advantages of the two networks to process the characteristics of CAN bus data. 1DCNN is responsible for extracting local spatial features in the data, and LSTM processes long-term dependencies in time series data, so that the model can more comprehensively understand the operating status of the CAN bus, monitor the voltage changes on the CAN bus in real time, and quickly and accurately identify normal states and various abnormal states. This real-time performance is crucial for early detection and prevention of potential system failures, and helps reduce downtime and economic losses.
[0099] This embodiment obtains the controller area network bus data of the vehicle; calls the target hybrid detection model to detect the controller area network bus data to obtain the detection result, wherein the target hybrid detection model is composed of a one-dimensional convolutional neural network and a long short-term memory network, and is obtained based on the training of the controller area network bus fault data, and the detection result is used to characterize the probability of the fault category to which the controller area network bus data belongs. That is to say, the embodiment of the present invention combines the one-dimensional convolutional neural network and the long short-term memory network, extracts the spatial characteristics of the CAN bus data by the one-dimensional convolutional neural network, and processes the time dependency in the CAN bus data by the long short-term memory network, so as to more accurately identify and classify the fault state of the CAN bus, thereby achieving the technical effect of improving the accuracy of fault detection of the controller area network bus, and solving the technical problem of low accuracy of fault detection of the controller area network bus.
[0100] Example 3
[0101] According to an embodiment of the present invention, a controller area network bus fault detection device is also provided. It should be noted that the controller area network bus fault detection device can be used to execute the controller area network bus fault detection method in embodiment 1.
[0102] Figure 3 is a schematic diagram of a controller area network bus fault detection device according to an embodiment of the present invention, such as Figure 3 As shown, the controller area network bus fault detection device 300 may include: a first acquisition unit 302 and a detection unit 304 .
[0103] The first acquisition unit 302 is used to acquire the controller area network bus data of the vehicle.
[0104] The detection unit 304 is used to call the target hybrid detection model to detect the controller area network bus data to obtain a detection result, wherein the target hybrid detection model is composed of a one-dimensional convolutional neural network and a long short-term memory network, and is trained based on the controller area network bus fault data, and the detection result is used to characterize the probability of the fault category to which the controller area network bus data belongs.
[0105] Optionally, the detection unit 304 includes: an extraction module, used to call the convolution layer of the target hybrid detection model, perform a convolution operation on the controller LAN bus data, and extract the spatial features of the controller LAN bus data; a first determination module, used to determine a feature map associated with the spatial features; and a second determination module, used to determine the detection result based on the feature map.
[0106] Optionally, the second determination module includes: a processing submodule, which is used to call the pooling layer of the target mixed detection model, perform dimensionality reduction processing on the feature map, and save the target feature information in the feature map after dimensionality reduction; an association submodule, which is used to call the long short-term memory network layer of the target mixed detection model, associate the controller LAN bus data with each feature in the feature map after dimensionality reduction, and obtain the time dependency of the controller LAN bus data; and a determination submodule, which is used to determine the detection result based on the time dependency.
[0107] Optionally, the determination submodule is also used to: call the fully connected layer of the target mixture detection model to compress the time dependency of the long short-term memory network layer output into a vector; call the output layer of the target mixture detection model to perform a nonlinear transformation on the vector according to the activation function to obtain the detection result.
[0108] Optionally, the association submodule is also used to: associate the controller area network bus data with each feature in the feature map according to the gating mechanism of the long short-term memory network layer to obtain the time dependency of the controller area network bus data, wherein the gating mechanism includes at least one of the following: a forgetting gate mechanism, an input gate mechanism, and an output gate mechanism.
[0109] Optionally, the device also includes: a second acquisition unit, used to acquire controller LAN bus fault data; a first determination unit, used to preprocess the controller LAN bus fault data and determine the preprocessed controller LAN bus fault data as a data set; and a training unit, used to train an initial hybrid detection model using the data set to obtain a target hybrid detection model.
[0110] Optionally, the first determining unit includes: a processing module, configured to normalize the controller area network bus fault data, and divide the normalized controller area network bus fault data into short sequence data,
[0111] The normalized controller area network bus fault data is long sequence data.
[0112] Optionally, the training unit includes: a third determination module, used to determine a training set and a validation set from a data set, wherein the data volume of the training set and the data volume of the validation set satisfy a preset ratio; a training module, used to input the training set into the initial mixed detection model for training to obtain a trained initial mixed detection model; a verification module, used to input the validation set into the trained initial mixed detection model for verification to determine the accuracy of the trained initial mixed detection model; a fourth determination module, used to determine the initial mixed detection model with the highest accuracy among the trained initial mixed detection models as the target mixed detection model.
[0113] Optionally, the device also includes: a second determination unit, used to determine a test set from the data set; a testing unit, used to test the target mixed detection model using the test set to obtain a test result; and an adjustment unit, used to adjust the target mixed detection model based on the test result.
[0114] Optionally, the device also includes: a third determination unit, used to determine the cross entropy loss function as an objective function for training the initial hybrid detection model.
[0115] In the embodiment of the present invention, the controller area network bus data of the vehicle is acquired by the first acquisition unit 302. The target hybrid detection model is called by the detection unit 304 to detect the controller area network bus data to obtain a detection result, wherein the target hybrid detection model is composed of a one-dimensional convolutional neural network and a long short-term memory network, and is obtained by training based on the controller area network bus fault data, and the detection result is used to characterize the probability of the fault category to which the controller area network bus data belongs. That is to say, the embodiment of the present invention combines a one-dimensional convolutional neural network and a long short-term memory network, extracts the spatial features of the CAN bus data by the one-dimensional convolutional neural network, and processes the time dependency in the CAN bus data by the long short-term memory network, so as to more accurately identify and classify the fault state of the CAN bus, thereby achieving the technical effect of improving the accuracy of fault detection of the controller area network bus, and solving the technical problem of low accuracy of fault detection of the controller area network bus.
[0116] Example 4
[0117] An embodiment of the present invention further provides a computer-readable storage medium, which includes a stored executable program, wherein when the executable program is running, the device where the computer-readable storage medium is located is controlled to execute the methods in various embodiments of the present invention.
[0118] Example 5
[0119] An embodiment of the present invention further provides an electronic device, comprising: a memory storing an executable program; and a processor for running the program, wherein the method in each embodiment of the present invention is executed when the program is running.
[0120] Example 6
[0121] An embodiment of the present invention further provides a vehicle, which is used to implement the methods in the above-mentioned various embodiments of the present invention.
[0122] Example 7
[0123] An embodiment of the present invention further provides a computer program product, including a computer program, and when the computer program is executed by a processor, the method in each embodiment of the present invention is implemented.
[0124] Example 8
[0125] An embodiment of the present invention further provides a computer program product, including a non-volatile computer-readable storage medium, wherein the non-volatile computer-readable storage medium is used to store a computer program, and when the computer program is executed by a processor, the method in each embodiment of the present invention is implemented.
[0126] Example 9
[0127] An embodiment of the present invention further provides a computer program, which implements the methods in the above-mentioned embodiments of the present invention when executed by a processor.
[0128] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.
[0129] In the above embodiments of the present invention, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0130] In the several embodiments provided by the present invention, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units can be a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.
[0131] The units determined as separate components may or may not be physically separated, and the components determined as unit displays may or may not be physical units, that is, they may be located in one place or distributed on multiple units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0132] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0133] If the integrated unit is implemented in the form of a software functional unit and determined to be sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, magnetic disk or optical disk and other media that can store program codes.
[0134] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. A method for detecting a fault of a controller area network bus, characterized in that: include: Get the vehicle's Controller Area Network bus data; A target hybrid detection model is called to detect the controller area network bus data to obtain a detection result, wherein the target hybrid detection model is composed of a one-dimensional convolutional neural network and a long short-term memory network, and is trained based on controller area network bus fault data, and the detection result is used to characterize the probability of the fault category to which the controller area network bus data belongs.
2. The method according to claim 1, characterized in that Calling the target hybrid detection model to detect the controller area network bus data to obtain a detection result, including: Calling the convolution layer of the target hybrid detection model to perform a convolution operation on the controller area network bus data to extract spatial features of the controller area network bus data; determining a feature map associated with the spatial feature; Based on the feature map, the detection result is determined.
3. The method according to claim 2, characterized in that Determining the detection result based on the feature graph includes: Calling the pooling layer of the target mixed detection model to perform dimensionality reduction processing on the feature map, and saving the target feature information in the feature map after dimensionality reduction; Calling the long short-term memory network layer of the target hybrid detection model to associate the controller area network bus data with each feature in the feature map after dimensionality reduction to obtain a time dependency relationship of the controller area network bus data; Based on the time dependency, the detection result is determined.
4. The method according to claim 3, characterized in that Determining the detection result based on the time dependency includes: Calling the fully connected layer of the target hybrid detection model to compress the time dependency relationship output by the long short-term memory network layer into a vector; The output layer of the target hybrid detection model is called, and the vector is nonlinearly transformed according to the activation function to obtain the detection result.
5. The method according to claim 3, characterized in that: Calling the long short-term memory network layer to associate the controller area network bus data with each feature in the feature graph to obtain a time dependency relationship of the controller area network bus data, including: According to the gating mechanism of the long short-term memory network layer, the controller area network bus data is associated with each feature in the feature map to obtain the time dependency of the controller area network bus data, wherein the gating mechanism includes at least one of the following: a forget gate mechanism, an input gate mechanism, and an output gate mechanism.
6. The method according to claim 1, characterized in that The method further comprises: Obtaining the controller area network bus fault data; Preprocessing the controller area network bus fault data, and determining the preprocessed controller area network bus fault data as a data set; The data set is used to train an initial mixed detection model to obtain the target mixed detection model.
7. The method according to claim 6, characterized in that Preprocessing the controller area network bus fault data includes: The controller area network bus fault data is normalized, and the normalized controller area network bus fault data is divided into short sequence data, wherein the normalized controller area network bus fault data is long sequence data.
8. The method according to claim 6, characterized in that Using the data set to train an initial hybrid detection model to obtain the target hybrid detection model includes: Determine a training set and a validation set from the data set, wherein the amount of data in the training set and the amount of data in the validation set satisfy a preset ratio; Inputting the training set into the initial mixed detection model for training to obtain a trained initial mixed detection model; Inputting the verification set into the trained initial hybrid detection model for verification to determine the accuracy of the trained initial hybrid detection model; The initial mixed detection model with the highest accuracy among the trained initial mixed detection models is determined as the target mixed detection model.
9. The method according to claim 8, characterized in that The method further comprises: determining a test set from the data set; Using the test set to test the target hybrid detection model, to obtain a test result; Based on the test results, the target hybrid detection model is adjusted.
10. The method according to claim 8, characterized in that The method further comprises: A cross entropy loss function is determined as an objective function for training the initial hybrid detection model.
11. A controller area network bus fault detection device, characterized in that: include: A first acquisition unit, used for acquiring controller area network bus data of the vehicle; A detection unit is used to call a target hybrid detection model to detect the controller area network bus data to obtain a detection result, wherein the target hybrid detection model is composed of a one-dimensional convolutional neural network and a long short-term memory network, and is trained based on controller area network bus fault data, and the detection result is used to characterize the probability of the fault category to which the controller area network bus data belongs.
12. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a stored program, wherein when the program is executed by a processor, the device where the storage medium is located is controlled to execute the method according to any one of claims 1 to 10.
13. An electronic device, characterized in that: include: A memory storing an executable program; A processor, configured to run the program, wherein the program executes the method according to any one of claims 1 to 10 when running.
14. A vehicle, characterized in that: Used to perform the method according to any one of claims 1 to 10.
15. A computer program product, characterized in that The computer program product comprises a computer program, wherein the computer program is configured to perform the method according to any one of claims 1 to 10 when executed by a processor.
Citation Information
Patent Citations
Vehicle-mounted network fault detection method and device thereof, readable storage medium and electronic equipment
CN113660137A
Analog circuit fault diagnosis method based on one-dimensional convolution long short-term memory network
CN114818579A
Elevator fault diagnosis and early warning method and system based on Internet of Things
CN118025920A
Power fault detection system for a communication bus
US6881106B1
Cited By
Controller performance test method and system
CN119690052A
Bus anomaly prediction and processing method, equipment, medium and product
CN120670254A
Fault detection method, cabin area control system and vehicle
CN121143284A
