Detection method based on neural network, electronic equipment and readable storage medium
By introducing primary and secondary hidden layers into the neural network, combining error judgment and probability value calculation, the problems of large computing power consumption and error in the prior art are solved, and efficient and accurate detection results are achieved.
Patent Information
- Application Number
- CN202410170658.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-02-06
- Publication Date
- 2025-08-15
AI Technical Summary
The existing neural network-based detection model has many hidden layers in the middle, which consumes a lot of computing power. It is easy to generate large errors when there are interfering signals, and even fails to output detection results.
The structure of the primary hidden layer and the secondary hidden layer is adopted. By judging whether the error of the data to be tested exceeds the threshold, it is determined whether to re-acquire the data, and the number of hidden layers participating in the calculation is determined based on the vector probability value output by the secondary hidden layer to reduce the calculation amount.
It effectively reduces detection error and calculation amount, improves the accuracy and efficiency of detection results, especially when there is an interfering signal, unnecessary calculations are avoided and the reliability of detection is ensured.
Smart Images

Figure CN120492320A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of detection, and in particular to a detection method based on a neural network, an electronic device and a readable storage medium. Background Art
[0002] Existing neural network-based detection models typically include multiple hidden layers. On the one hand, the presence of these hidden layers results in a significant computational overhead for each detection process, regardless of the quality of the input signal. On the other hand, even with multiple hidden layers, when the input signal includes interference, the final output can easily contain significant errors or even fail to produce a detection result, wasting time and computing power. Summary of the Invention
[0003] In view of the above, it is necessary to provide a detection method, electronic device and readable storage medium based on a neural network to reduce detection errors.
[0004] In a first aspect, the present application provides a detection method based on a neural network, wherein the neural network includes a primary hidden layer and a plurality of sequentially connected secondary hidden layers, and the detection method includes:
[0005] (a) Obtaining the data to be tested;
[0006] (b) inputting the test data into the primary hidden layer to generate a primary output vector;
[0007] (c) determining whether an error of the data to be measured exceeds a preset threshold value based on the primary output vector;
[0008] (d) when the error of the measured data is greater than a preset threshold, returning to step (a);
[0009] (e) when the error of the measured data is less than or equal to the preset threshold, outputting the primary output vector in sequence to the next secondary hidden layer to generate a corresponding secondary output vector;
[0010] (f) Determine whether to output the detection result according to the secondary output vector.
[0011] A second aspect of the present application provides an electronic device, comprising:
[0012] a memory storing at least one instruction; and
[0013] The processor executes the instructions stored in the memory to implement the detection method described above.
[0014] A third aspect of the present application provides a readable storage medium, wherein the readable storage medium stores at least one instruction, and the at least one instruction is executed by a processor in an electronic device to implement the detection method as described above.
[0015] The neural network-based detection method provided in the present application, on the one hand, calculates the error of the vector output by the hidden layer in advance to determine whether the interference signal of the data to be tested is too excessive, and when the interference signal included in the data to be tested is within an unacceptable range, the data to be tested is reacquired to reduce the amount of calculation; on the other hand, by calculating the probability value of the vector output by the secondary hidden layer, the number of secondary hidden layers involved in the calculation can be flexibly determined, thereby further reducing the amount of calculation. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] Figure 1 This is a flow chart of a detection method provided in one embodiment of the present application.
[0017] Figure 2 For application Figure 1 Schematic diagram of the neural network structure of the detection method shown.
[0018] Figure 3 Schematic diagram of the structure of an electronic device for implementing the detection method in an embodiment of the present application.
[0019] Description of main component symbols
[0020] Electronic equipment 200
[0021] Memory 201
[0022] Processor 202
[0023] Computer Programs 203
[0024] The following specific embodiments will further illustrate the present invention in conjunction with the above-mentioned drawings. DETAILED DESCRIPTION
[0025] In order to make the purpose, technical solutions and advantages of the present invention more clear, the present invention is described in detail below with reference to the accompanying drawings and specific embodiments. It should be noted that the embodiments of the present application and the features in the embodiments can be combined with each other without conflict.
[0026] The following description sets forth numerous specific details to facilitate a thorough understanding of the present invention. The embodiments described are merely a portion of the embodiments of the present invention, not all of them. All other embodiments derived by persons of ordinary skill in the art based on the embodiments of the present invention without inventive effort are intended to fall within the scope of protection of the present invention.
[0027] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art of the present invention. The terms used in this specification of the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention.
[0028] As you can understand, existing neural network-based detection models typically include multiple hidden layers. On the one hand, the presence of these hidden layers results in a significant amount of computing power consumed during each detection process, regardless of the quality of the input signal. On the other hand, even with multiple hidden layers, if the input signal includes interference, the final output can easily contain significant errors or even fail to produce a detection result, wasting both time and computing power.
[0029] Thus, an embodiment of the present application provides a detection method based on a neural network, which can reduce errors and reduce the amount of computation. Figure 1 FIG. 1 is a flow chart of a detection method according to an embodiment of the present invention. According to different requirements, the order of the steps in the flow chart can be changed, and some steps can be omitted.
[0030] It is understood that the detection method provided in this application can be applied to various neural network-based detection methods. This application does not limit the application field and application device of this detection method. For example, in the embodiments of this application, the detection method is applied to an in-vehicle system as an example. In other embodiments, the neural network-based detection method provided in this application can also be applied to plant pest and disease identification in the agricultural field or defect image recognition in the industrial field.
[0031] Please continue reading Figure 2 In the embodiment of the present application, the neural network comprises at least an input layer, a primary hidden layer, several secondary hidden layers and an output layer connected in sequence. It can be understood that Figure 2 The neural network shown is only used to illustrate the structure of the neural network and does not limit the various parameters of the neural network (such as height, width and depth) and setting methods (such as full connection or local connection).
[0032] Furthermore, the neural network-based detection method includes:
[0033] Step S1: Obtain the data to be tested.
[0034] In an embodiment of the present application, the vehicle-mounted system obtains the data to be measured through a Lidar installed on the vehicle, and the data to be measured is point cloud data.
[0035] It can be understood that lidar, also known as optical radar, determines the distance, size and other parameters of the target by irradiating a laser at the target. In an embodiment of the present application, the vehicle uses the lidar installed thereon to sense the surrounding road environment during the vehicle's driving process, thereby establishing point cloud data representing the vehicle's surrounding environment. The on-board system can obtain the corresponding road, vehicle position and obstacle information by analyzing the point cloud data, thereby adjusting the vehicle's driving parameters, thereby enabling the vehicle to safely and reliably drive on the road and reach the predetermined destination. However, due to the complex road environment of the vehicle, the point cloud data obtained by the lidar may contain some interference signals, thereby interfering with the on-board system's recognition of the road environment, and may even affect driving safety.
[0036] Step S2: Input the data to be tested into the primary hidden layer to generate a primary output vector.
[0037] See also Figure 2 The data to be tested in steps S1 and S2 is input to the primary hidden layer through the first input layer. The primary hidden layer can be a convolutional layer. It is understood that the convolutional layer is used to extract features from the input data to be tested. In the embodiment of the present application, the neural structure applying the detection method includes two primary hidden layers.
[0038] In step S2, the on-board system inputs the point cloud data acquired by the lidar into the primary hidden layer to generate a corresponding primary vector, that is, a preliminary feature vector of the data to be measured.
[0039] Step S3: judging whether the error of the data to be measured is greater than a preset threshold according to the primary output vector.
[0040] In the embodiment of the present application, after the test data is input to the primary hidden layer through the first input layer, the test data is processed by the two primary hidden layers, and then the primary output vector is output through the first output layer.
[0041] Step S4: When the error of the data to be measured is greater than the preset threshold, return to step S1 and reacquire the data to be measured.
[0042] Step S5: When the error of the data to be measured is less than or equal to the preset threshold, the primary output vector is output to the secondary hidden layer to generate a corresponding secondary output vector.
[0043] In some possible implementations, in step S3 , the onboard system compares the primary output vector with a preset output vector that does not include an interference signal to obtain an error of the primary output vector.
[0044] In step S3, if the error in the primary output vector is greater than a preset threshold, the vehicle system determines that the error in the test data is greater than the preset threshold, meaning that the interference signal included in the test data is within an unacceptable range. The vehicle system then returns to step S1 and reacquires the test data for testing.
[0045] It can be understood that by returning to step S1, when it is preliminarily determined that the data to be tested includes a large number of interference signals, the data can be re-acquired for calculation to avoid inaccurate detection results due to a large number of interference signals, thereby affecting driving safety; and avoiding the data to be tested including interference signals from undergoing a large number of calculations through the neural network, thereby reducing the waste of computing power and time.
[0046] In step S3, if the error of the primary output vector is less than or equal to the preset threshold, the onboard system determines that the error of the test data is less than or equal to the preset threshold. In other words, the interference signal included in the test data is within an acceptable range. The onboard system then executes step S5, outputting the primary output vector to the secondary hidden layer via the second input layer to generate a corresponding secondary output vector.
[0047] In the embodiment of the present application, the secondary hidden layer is also a convolutional layer, which is used to extract other features of the data to be tested. In this way, the secondary output vector is also a feature vector representing the data to be tested.
[0048] Step S6: Obtain a corresponding probability value according to the secondary output vector, and determine whether the probability value is less than a preset probability threshold.
[0049] Please continue reading Figure 2 It is understood that in some embodiments, an activation layer, a pooling layer, and a fully connected layer are sequentially connected between the secondary hidden layer and the second output layer. In step S6, the vehicle system inputs the secondary output vector into the activation layer, passes it through the pooling layer and the fully connected layer, and outputs the corresponding probability value through the second output layer. The sum of all probability values is less than or equal to 1.
[0050] Step S7: When the probability value is greater than or equal to the preset probability threshold, the detection result is output.
[0051] For example, in one embodiment, the preset probability threshold is 95%, and after the secondary output vector is calculated through the activation layer, pooling layer, and fully connected layer, the possible results are: the probability that the test data is object A is 0.6%; the probability that the test data is object B is 1.4%; and the probability that the test data is object C is 98%. In other words, there is a probability that the test data is object C with a value greater than 95%. In this case, the output layer outputs the result: the test data is object C.
[0052] Step S8: When the probability value is less than a preset probability threshold, it is determined whether the number of the secondary hidden layers involved in the calculation reaches a preset number.
[0053] For example, in other embodiments, after the secondary output vector passes through the activation layer, pooling layer, and fully connected layer, the results may be: the probability that the test data is object A is 10%; the probability that the test data is object B is 20%; and the probability that the test data is object C is 70%. In this way, after the secondary output vector passes through the activation layer, pooling layer, and fully connected layer, the probability values obtained are all less than the preset probability threshold. Thus, in this embodiment of the present application, when the probability values obtained based on the secondary output vector are all less than the preset probability threshold, the vehicle system determines whether the number of secondary hidden layers involved in the calculation has reached the preset number.
[0054] In the embodiment of the present application, the preset number is 3. That is, when the probability values obtained according to the secondary output vectors are all less than the preset probability threshold, the vehicle system determines whether the number of secondary hidden layers involved in the calculation reaches 3 layers.
[0055] Step S9: When the number of the secondary hidden layers involved in the calculation is less than the preset number, the secondary output vector is output to the next secondary hidden layer to generate another corresponding secondary output vector, and it is determined based on the other secondary output vector whether the error of the data to be measured exceeds the preset threshold.
[0056] It is understood that in step S7, if the probability values obtained are all less than the preset probability threshold, it indicates that the detection result of the test data cannot be obtained through the primary hidden layer and one secondary hidden layer. In this case, the relevant features of the test data are further extracted through another secondary hidden layer in step S9 to further determine the detection result.
[0057] S10: When it is determined according to another secondary output vector that the error of the data to be measured exceeds a preset threshold, the process returns to step S1 to reacquire the data.
[0058] It will be appreciated that in step S10, the onboard system compares the secondary output vector with a preset secondary output vector that does not include interference signals to obtain an error in the other secondary output vector. It will be appreciated that if the error in the other secondary output vector exceeds a preset threshold, it indicates that the test data acquired in step S1 contains a significant amount of interference signals, and the test data needs to be reacquired.
[0059] S11: When the error of the data to be measured is equal to or less than the preset threshold value according to another secondary output vector, return to step S6 until the number of secondary hidden layers participating in the calculation reaches the preset number.
[0060] It can be understood that if the error of the test data is equal to or less than the preset threshold value based on the other secondary output vector, it indicates that the interference signal included in the test data obtained in step S1 is within the acceptable range. Therefore, the process returns to step S6 to confirm whether to output the detection result based on the other secondary vector.
[0061] Step S12: When the number of the secondary hidden layers involved in the calculation is greater than or equal to the preset number, return to step S1.
[0062] It is understood that in step S12, if the number of secondary hidden layers involved in the calculation is greater than or equal to the predetermined number and a detection result that meets the predetermined probability threshold is still not obtained, it also indicates that the test data obtained in step S1 may contain a large amount of interference signals. In this case, the vehicle system returns to step S1 and re-acquires the test data to confirm the detection result.
[0063] It is understood that, depending on different application fields or devices, in some embodiments, the data to be measured may also be two-dimensional image data that has been grayscale processed. This application does not limit the type of data to be measured.
[0064] It is understood that in other embodiments, after executing step S6, if it is determined in step S8 that the number of secondary hidden layers involved in the calculation has not reached a preset number, the secondary output vector is output to the next secondary hidden layer to generate another corresponding secondary output vector, and the process returns to step S6 to obtain a corresponding probability value based on the other secondary output vector, thereby determining whether to output a detection result. In this way, in these embodiments, computing power and time can be further saved.
[0065] It is understood that the present application does not limit the method for determining whether the error of the measured data exceeds a preset threshold in steps S3 and S9. Those skilled in the art may adjust the corresponding error determination method according to actual needs. For example, in some embodiments, a corresponding probability value may be obtained from the primary output vector or the secondary output vector, and when the probability value is less than another preset probability threshold, it is determined that the error of the measured probability exceeds the preset threshold. It is understood that the other preset probability threshold is less than the preset probability threshold in step S6.
[0066] It can be understood that the neural network-based detection method provided in the present application, on the one hand, calculates the error of the vector output by the hidden layer in advance to determine whether the interference signal of the data to be tested is too much, and when the interference signal included in the data to be tested is within an unacceptable range, the data to be tested is re-acquired to reduce the amount of calculation; on the other hand, the probability value of the vector output by the secondary hidden layer is calculated to flexibly determine the number of secondary hidden layers involved in the calculation, thereby further reducing the amount of calculation.
[0067] Please also refer to Figure 3 Another embodiment of the present application further provides an electronic device 200. The electronic device 200 includes a memory 201, a processor 202, and a computer program 203 stored in the memory 201 and executable on the processor 202.
[0068] The electronic device 200 may be any one of a cloud system, an embedded computer, an in-vehicle system, or a server, etc. Those skilled in the art will appreciate that the schematic diagram is merely an example of the electronic device 200 and does not limit the electronic device 200 , which may include more or fewer components than shown, or a combination of certain components, or different components.
[0069] The processor 202 is configured to execute the computer program 203 to implement the steps in the above-mentioned detection method embodiment, such as steps S1 to S12 shown in the first embodiment.
[0070] Exemplarily, the computer program 203 may be divided into one or more modules / units, which are stored in the memory 201 and executed by the processor 202 to implement the present invention. The one or more modules / units may be a series of computer program instruction segments capable of implementing specific functions, and the instruction segments are used to describe the execution process of the computer program 203 in the electronic device 200.
[0071] The processor 202 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor, or the processor 202 may be any conventional processor, etc. The processor 202 is the control center of the electronic device 200, and connects various parts of the entire electronic device 200 using various interfaces and lines.
[0072] The memory 201 can be used to store the computer program 203 and / or modules / units. The processor 202 implements various functions of the electronic device 200 by running or executing the computer program and / or modules / units stored in the memory 201 and calling data stored in the memory 201. The memory 201 may mainly include a program storage area and a data storage area. The program storage area may store an operating system, at least one application required for a function (such as a sound playback function, an image playback function, etc.), etc. The data storage area may store data created based on the use of the electronic device 200 (such as video data, audio data, a phone book, etc.). In addition, the memory 201 may include high-speed random access memory and may also include non-volatile memory, such as a hard disk, internal memory, a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, at least one disk storage device, a flash memory device, or other volatile solid-state storage device.
[0073] In one embodiment of the present invention, the electronic device 200 is a mobile device, such as a vehicle.
[0074] If the modules / units integrated in the electronic device 200 are implemented in the form of software functional modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the present invention implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium. When the computer program is executed by the processor, it can implement the steps of the above-mentioned various method embodiments. Among them, the computer program includes computer program code, and the computer program code can be in the form of source code, executable file or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electrical signal and software distribution medium. It should be noted that the content contained in the computer-readable medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media do not include electrical carrier signals and telecommunication signals.
[0075] In the several embodiments provided by the present invention, it should be understood that the disclosed electronic devices and methods can be implemented in other ways. For example, the electronic device embodiments described above are merely illustrative. For example, the module division is merely a logical function division, and other division methods may be used in actual implementation.
[0076] In addition, the functional modules in various embodiments of the present invention may be integrated into the same processing module, each module may exist physically separately, or two or more modules may be integrated into the same module. The above-mentioned integrated modules may be implemented in the form of hardware or hardware plus software functional modules.
[0077] It is obvious to those skilled in the art that the present invention is not limited to the details of the exemplary embodiments described above, and that the present invention can be implemented in other specific forms without departing from the spirit or essential features of the invention. Therefore, from any point of view, the embodiments should be regarded as exemplary and non-restrictive, and the scope of the invention is defined by the appended claims rather than the above description, and it is intended that all changes that fall within the meaning and scope of the equivalent elements of the claims be included in the present invention. Any figure marks in the claims should not be regarded as limiting the claims involved. In addition, it is obvious that the word "comprising" does not exclude other modules or steps, and the singular does not exclude the plural. Multiple modules or electronic devices stated in the electronic device claim may also be implemented by the same module or electronic device through software or hardware. Words such as first and second are used to indicate names and do not indicate any particular order.
[0078] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not limiting. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solutions of the present invention may be modified or replaced by equivalents without departing from the spirit and scope of the technical solutions of the present invention.
Claims
1. A detection method based on a neural network, characterized in that: The neural network includes a primary hidden layer and a plurality of sequentially connected secondary hidden layers, and the detection method includes: (a) Obtaining the data to be tested; (b) inputting the test data into the primary hidden layer to generate a primary output vector; (c) determining whether an error of the data to be measured is greater than a preset threshold according to the primary output vector; (d) when the error of the measured data is greater than a preset threshold, returning to step (a); (e) when the error of the measured data is less than or equal to the preset threshold, outputting the primary output vector in sequence to the next secondary hidden layer to generate a corresponding secondary output vector; (f) Determine whether to output the detection result according to the secondary output vector.
2. The detection method according to claim 1, wherein The step of confirming whether to output a detection result according to the secondary output vector includes: Obtaining a corresponding probability value according to the secondary output vector; When the probability value is greater than or equal to a preset probability threshold, the detection result is output.
3. The detection method according to claim 2, wherein When the probability value is less than the preset probability threshold, the detection method further includes: Determining whether the number of the secondary hidden layers involved in the calculation reaches a preset number; When the number of the secondary hidden layers involved in the calculation is less than the preset number, outputting the secondary output vector to the next secondary hidden layer to generate another corresponding secondary output vector; determining whether an error of the data to be measured exceeds the preset threshold according to another of the secondary output vectors; When the error of another secondary output vector is greater than the preset threshold, returning to step (a); When the error of another secondary output vector is equal to or less than the preset threshold, return to step (f) until the number of the secondary hidden layers involved in the calculation reaches a preset number.
4. The detection method according to claim 3, wherein When the number of the secondary hidden layers involved in the calculation is greater than or equal to the preset number, return to step (a).
5. The detection method according to any one of claims 3 to 4, characterized in that The preset number is 3.
6. The detection method according to any one of claims 1 to 4, wherein The primary hidden layer includes at least one convolutional layer.
7. The detection method according to any one of claims 1 to 4, wherein Each of the secondary hidden layers includes a convolutional layer.
8. The detection method according to claim 2, wherein The neural network further includes an activation layer, a pooling layer, and a fully connected layer connected in sequence. Before outputting the detection result, the detection method further includes: The secondary output vector is output to the activation layer, and passes through the pooling layer and the fully connected layer to output the probability value.
9. An electronic device, characterized in that: The electronic device comprises: a memory storing at least one instruction; and A processor, configured to execute instructions stored in the memory to implement the detection method according to any one of claims 1 to 8.
10. A readable storage medium, characterized in that: The readable storage medium stores at least one instruction, and the at least one instruction is executed by a processor in the electronic device to implement the detection method according to any one of claims 1 to 8.