Gas detection method and system based on TinyML
By using TinyML technology on the edge device to establish and compress the gas predictive model, it solves the problem of high -precision gas detection on low -power equipment in existing technologies, and achieves high -efficiency and safe gas detection effects.
Patent Information
- Application Number
- CN202411244738.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-06
- Publication Date
- 2025-01-28
AI Technical Summary
The prior art is difficult to achieve high-precision gas detection on low-power, low-bandwidth edge devices, and there are data transmission security problems.
Adopting the Tinyml -based gas detection method, by obtaining the historical parameter data of the gaseous decomposition in the transformer oil, the gas predictive model is established, and the model compress the model according to the storage space and calculation amount of the edge equipment to ensure that the model is running on the edge equipment.
Achieve efficient and accurate gas testing on low -power edge equipment, reducing dependence on complex devices and large amounts of data transmission, and improving the real -time and safety of detection.
Smart Images

Figure CN119380848A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of transformer oil gas detection, and in particular to a gas detection method and system based on TinyML. Background Art
[0002] As the requirements for electricity safety increase, early fault detection of transformers becomes increasingly important. Under the action of thermal and electrical stress, oil and oil-impregnated electrical insulation materials decompose, producing gaseous decomposition products dissolved in the transformer oil. The nature and quantity of the individual component gases extracted from the oil can indicate the type and degree of abnormality. These gas products include hydrogen, methane, ethane, hydrogen sulfide, etc. Out of consideration for the safety of people's lives and property, there is an urgent need for a method that can achieve low power consumption, run on low-bandwidth edge devices, and detect gas information, so as to safely manage and handle transformer fault phenomena in advance.
[0003] In recent years, with the rapid development of artificial intelligence and deep learning, the use of intelligent models to predict gas concentration has become a research hotspot. Existing gas prediction models include convolutional neural networks (CNN), long short-term memory networks (LSTM), and attention mechanisms (Attention) methods. Generally, these models can achieve high-precision detection when performing gas detection, but due to their huge amount of calculation, long time consumption, and many adjustable parameters, they are difficult to apply in edge devices. Summary of the invention
[0004] The purpose of this section is to summarize some aspects of embodiments of the present invention and briefly introduce some preferred embodiments. Some simplifications or omissions may be made in this section and the specification abstract and the invention title of this application to avoid blurring the purpose of this section, the specification abstract and the invention title, and such simplifications or omissions cannot be used to limit the scope of the present invention.
[0005] In view of the above existing problems, the present invention is proposed.
[0006] Therefore, the present invention provides a gas detection method and system based on TinyML, which can solve the problems mentioned in the background technology.
[0007] In order to solve the above technical problems, the present invention provides the following technical solutions:
[0008] In a first aspect, the present invention provides a gas detection method based on TinyML, comprising:
[0009] Obtain historical parameter data of gaseous decomposition products dissolved in transformer oil in transformers of the same type as the target transformer, and establish a first gas prediction model in combination with TinyML, wherein the historical parameter data at least includes the type and concentration of the gaseous decomposition products;
[0010] Establishing a first compression constraint condition according to the storage space of the target edge device, the maximum computing capacity of the target edge device, and the prediction accuracy requirement of the target gaseous decomposition product;
[0011] According to the first compression constraint condition, a compression operation is performed on the first gas prediction model to obtain a second gas prediction model, wherein the compression operation includes a first compression operation and a second compression operation;
[0012] A target edge device with a built-in second gas prediction model after compression operation is configured near the target transformer for gas detection.
[0013] As a preferred solution of the gas detection method based on TinyML described in the present invention, wherein: the establishment of the first gas prediction model includes:
[0014] The input of the first gas prediction model includes at least the concentration of historical gaseous decomposition products;
[0015] The output of the first gas prediction model includes at least the types of historical gaseous decomposition products;
[0016] The accuracy of the first gas prediction model established in combination with TinyML is greater than the first accuracy requirement. The first accuracy requirement is a constraint for the model to be established. If and only if the prediction accuracy of the first gas prediction model is greater than the first accuracy requirement, the first gas prediction model is established and the first gas prediction model is output to the target storage location.
[0017] As a preferred solution of the gas detection method based on TinyML described in the present invention, wherein: the first compression constraint condition is established according to the storage space of the target edge device, the maximum computing capacity of the target edge device, and the prediction accuracy requirement of the target gaseous decomposition product, including:
[0018] The target edge device is a location where the final second gas prediction model is stored;
[0019] The storage space of the target edge device is determined by the selected target edge device, and the target edge device is selected from the edge device library;
[0020] The edge device library is established before the first gas prediction model. The edge device library includes at least one edge device. The edge devices in the edge device library have different storage spaces or the same storage spaces. The edge devices in the edge device library have different maximum computing power.
[0021] As a preferred solution of the gas detection method based on TinyML described in the present invention, wherein: the first compression constraint condition is established according to the storage space of the target edge device, the maximum computing capacity of the target edge device and the prediction accuracy requirement of the target gaseous decomposition product, and further includes:
[0022] The target gaseous decomposition product prediction accuracy requirement is recorded as R aim , the first accuracy is recorded as R1;
[0023] The storage space of the selected target edge device is denoted as C max , the maximum computing capacity of the selected target edge device is recorded as J max ;
[0024] The first compression constraint is expressed as follows:
[0025] (R yasuo ≥R aim ≥R1)&(C yasuo ≤C max )&(J yasuo ≤J max )
[0026] Among them, R yasuo represents the accuracy of the second gas prediction model after compression operation, C yasuo represents the storage space occupied by the second gas prediction model after the compression operation, J yasuo Indicates the maximum amount of computation required by the second gas prediction model after the compression operation is placed.
[0027] As a preferred solution of the gas detection method based on TinyML described in the present invention, wherein: according to the first compression constraint condition, the first gas prediction model is compressed to obtain a second gas prediction model, and the compression operation includes a first compression operation and a second compression operation includes:
[0028] If the prediction accuracy requirement for the target gaseous decomposition product corresponding to the target edge device selected from the edge device library is not less than R1, and there is no storage space and computational demand for the first gas prediction model configured near the transformer, then no compression operation is performed at this time. At this time, the first gas prediction model is used as the second gas prediction model, and the gas prediction model is configured as a floating point TFLite;
[0029] If the prediction accuracy requirement for the target gaseous decomposition product corresponding to the target edge device selected from the edge device library is not less than R1, and the storage space of the target edge device is smaller than the memory space occupied by the first gas prediction model, and there is no demand for the computational amount of the first gas prediction model, a first compression operation is performed on the first gas prediction model, and the first compression operation includes:
[0030] Convert the first gas prediction model to a 16-bit floating point precision type;
[0031] When the storage space occupied by the first gas prediction model after the 16-bit floating point precision type conversion is still larger than the storage space of the target edge device, the first gas prediction model is converted to a 16-bit integer type;
[0032] When the storage space occupied by the first gas prediction model after the 16-bit integer conversion is still larger than the storage space of the target edge device, the first gas prediction model is converted into an 8-bit integer.
[0033] As a preferred solution of the gas detection method based on TinyML described in the present invention, wherein: according to the first compression constraint condition, the first gas prediction model is compressed to obtain a second gas prediction model, and the compression operation includes a first compression operation and a second compression operation further includes:
[0034] If the prediction accuracy requirement for the target gaseous decomposition product corresponding to the target edge device selected from the edge device library is not less than R1, and the storage space of the target edge device is larger than the memory space occupied by the first gas prediction model, and the computing demand of the first gas prediction model is larger than the maximum computing demand of the selected target edge device, then a second compression operation is performed on the first gas prediction model.
[0035] As a preferred solution of the gas detection method based on TinyML of the present invention, the second compression operation includes:
[0036] The number of neurons of the first gas prediction model is reduced one by one according to the first preset order. If the amplitude of the reduction in the amount of computation required by the first gas prediction model is less than the first preset amplitude or greater than the second amplitude when the number of neurons of the first gas prediction model is reduced one by one according to the first preset order, then the number of neurons is stopped from being reduced, and the number of synapses in the first gas prediction model is reduced one by one according to the second preset order until the amount of computation required by the first gas prediction model is less than the maximum amount of computation required by the selected target edge device;
[0037] At this time, it is determined whether the prediction accuracy of the first gas prediction model after the second compression operation is not lower than R1. If so, the model is output as the second gas prediction model. If not, the historical parameter data is used and the first gas prediction model after the second compression operation is retrained in combination with TinyML until the prediction accuracy is not lower than R1.
[0038] In a second aspect, the present invention provides a gas detection system based on TinyML, comprising:
[0039] A first model building module is used to obtain historical parameter data of gaseous decomposition products dissolved in transformer oil in transformers of the same type as the target transformer, and to establish a first gas prediction model in combination with TinyML, wherein the historical parameter data at least includes the type and concentration of the gaseous decomposition products;
[0040] A first constraint establishing module, used to establish a first compression constraint condition according to a storage space of a target edge device, a maximum computing capacity of the target edge device, and a prediction accuracy requirement of a target gaseous decomposition product;
[0041] A compression operation module, configured to perform a compression operation on the first gas prediction model according to the first compression constraint condition to obtain a second gas prediction model, wherein the compression operation includes a first compression operation and a second compression operation;
[0042] The detection module is used to configure the target edge device with the second gas prediction model after the built-in compression operation near the target transformer to perform gas detection.
[0043] In a third aspect, the present invention provides a computer device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the above-mentioned method when executing the computer program.
[0044] In a fourth aspect, the present invention provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program implements the steps of the method described above when executed by a processor.
[0045] Compared with the prior art, the invention has the following beneficial effects: the invention proposes a gas detection method and system based on TinyML, obtains historical parameter data of gaseous decomposition products dissolved in transformer oil in a transformer of the same type as the target transformer, and establishes a first gas prediction model in combination with TinyML, wherein the historical parameter data at least includes the type and concentration of the gaseous decomposition products; establishes a first compression constraint condition according to the storage space of the target edge device, the maximum computing capacity of the target edge device, and the prediction accuracy requirement of the target gaseous decomposition products; according to the first compression constraint condition, performs a compression operation on the first gas prediction model to obtain a second gas prediction model, wherein the compression operation includes a first compression operation and a second compression operation; configures the target edge device with the second gas prediction model after the built-in compression operation at the near end of the target transformer to perform gas detection. The method performs gas detection model adaptation operation according to the type of transformer near-end edge device actually selected, greatly reduces the loss of repeated training models, adapts to the requirements of computing power, and ensures the accuracy of gas detection. In addition, the method uses local edge devices to process data, which can prevent gas data leakage and ensure data security. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for describing the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative labor. Among them:
[0047] Figure 1 A method flow chart of a gas detection method and system based on TinyML provided in one embodiment of the present invention;
[0048] Figure 2 An internal structure diagram of a computer device of a gas detection method and system based on TinyML provided in one embodiment of the present invention. DETAILED DESCRIPTION
[0049] In order to make the above-mentioned purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are described in detail below in conjunction with the drawings of the specification. Obviously, the described embodiments are part of the embodiments of the present invention, but not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary persons in the art without creative work should fall within the scope of protection of the present invention.
[0050] Example 1
[0051] Reference Figure 1-Figure 2 , which is the first embodiment of the present invention, and provides a gas detection method and system based on TinyML, including:
[0052] Before describing the embodiments of the present application in detail, some related concepts are first explained for the sake of clarity.
[0053] Transformer oil: In the power industry, transformer oil is mainly used in power transformers as an insulating medium and coolant. It can help maintain electrical isolation between the internal components of the transformer and remove the heat generated during operation through circulation, thereby maintaining the normal operating temperature of the transformer. In addition, transformer oil can also play a certain arc extinguishing role to prevent the generation of arcs.
[0054] TinyML: TinyML (Tiny Machine Learning) refers to the technical field of performing machine learning tasks on small, resource-constrained devices. These devices usually have very limited computing power, storage space, and power supply. TinyML enables machine learning algorithms to run locally on Internet of Things (IoT) devices or other edge devices without relying on cloud services for processing, which can improve response speed and reduce privacy risks.
[0055] Edge devices: Edge devices refer to hardware devices running at the edge of the network. They are usually located near the data source and can directly interact with physical devices such as sensors and actuators. Edge computing emphasizes processing data close to where the data is generated, rather than sending the data to a remote data center or cloud platform. This architecture can reduce latency, save bandwidth, and enhance data security.
[0056] Maximum computing capacity: Here, it refers to the maximum computing task that the edge device can handle, usually measured in the number of operations performed per second (such as FLOPS, Floating Point Operations Per Second). This is an indicator of the device's hardware performance and determines how many tasks it can handle simultaneously or the complexity of the tasks.
[0057] Storage space: refers to the storage capacity available on edge devices, which is used to store operating systems, application code, and data. The size of the storage space directly affects the amount of information that the device can store and the scale of applications that can be deployed. For TinyML applications, the size of the model needs to fit the storage limitations of the device.
[0058] There are some challenges in related technologies. For example, the detection of gaseous decomposition products dissolved in transformer oil usually requires complex equipment and a large amount of data transmission, which not only increases costs but may also leak sensitive information due to security issues during data transmission. In addition, traditional gas detection methods often rely on cloud platforms for data processing, which results in a long response time and cannot meet scenarios with high real-time requirements.
[0059] This application provides an effective solution to the above-mentioned problems. Next, we will explain in detail how to implement the gas detection method based on TinyML in combination with multiple embodiments;
[0060] Figure 1 A method flow chart of a gas detection method and system based on TinyML is shown, including:
[0061] S101, obtaining historical parameter data of gaseous decomposition products dissolved in transformer oil in transformers of the same type as the target transformer, and establishing a first gas prediction model in combination with TinyML, wherein the historical parameter data at least includes the type and concentration of the gaseous decomposition products;
[0062] In an embodiment of the present application, establishing the first gas prediction model includes:
[0063] The input of the first gas prediction model includes at least the concentration of historical gaseous decomposition products;
[0064] The output of the first gas prediction model includes at least the types of historical gaseous decomposition products;
[0065] It should be noted that the accuracy of the first gas prediction model established in combination with TinyML is greater than the first accuracy requirement. The first accuracy requirement is a constraint for the model to be established. If and only if the prediction accuracy of the first gas prediction model is greater than the first accuracy requirement, the first gas prediction model is established and output to the target storage location.
[0066] For example, if the preset first accuracy requirement is set to 90%, then only when the first gas prediction model can reach or exceed 90% prediction accuracy after training and verification, the model is considered qualified and can be output to the designated storage location for use by the edge device. However, in the process of training the model in this application, because the model is applied to the edge device near the transformer, there is a lower limit on the accuracy requirement. Therefore, when training the model, no matter how much accuracy the user or technician requires, we require the first accuracy to be no less than 85%.
[0067] If the accuracy of the model fails to meet this preset requirement, it is necessary to adjust the model parameters, add more training data, or change the model structure and retrain until the accuracy requirement is met. This step is very important because it ensures that the model deployed on the edge device can reliably perform its intended function, that is, to detect gaseous decomposition products in transformer oil, thereby helping maintenance personnel to detect potential faults or abnormal conditions in a timely manner.
[0068] It should be noted that the first accuracy requirement can be adjusted according to the actual application scenario and needs. For example, in some occasions with extremely high real-time requirements, higher accuracy may be required to ensure the reliability of the test results. In some cost-sensitive scenarios, it may be necessary to balance accuracy and cost to achieve the best cost-effectiveness. It can also be designed by the user or technician, for example, set to a specific value of 90%, 95%, etc., and can also be obtained according to preset tests, which will not be elaborated here.
[0069] It should also be noted that, because the purpose of the designed first gas prediction model is to detect the final gas type based on the historical parameter data of the gas, the output of the first gas prediction model must include the types of historical gaseous decomposition products. Because the concentration of gaseous decomposition products has a greater importance in the detection process, the input of the first gas prediction model must include the concentration of historical gaseous decomposition products.
[0070] In an embodiment of the present application, when designing the first gas prediction model, because the design location is a laboratory, the target storage location is the equipment in the laboratory, which can be a mobile device or a fixed device. If other users or other technicians perform gas detection model training according to the method of the present application in other locations or scenarios, no matter where it is stored, it should be within the scope of protection of the present application.
[0071] In an optional embodiment, the input of the first gas prediction model may also include the temperature and pressure parameters of the transformer oil. These parameters have an important influence on the generation and dissolution process of gaseous decomposition products, so incorporating them into the model input can further improve the accuracy of the prediction. By monitoring the temperature and pressure of the transformer oil in real time, the type and concentration of gaseous decomposition products can be more accurately predicted, thereby providing maintenance personnel with more comprehensive information; the output of the first gas prediction model may also include the generation rate of dissolved gaseous decomposition products in the transformer oil. Understanding the generation rate of these decomposition products is of great significance for predicting the health status and potential failures of the equipment. By monitoring and analyzing these rates in real time, maintenance personnel can detect abnormal conditions earlier and take preventive measures to avoid equipment failures.
[0072] It should be noted that by using historical data and TinyML technology to build an efficient and accurate gas prediction model, fast and real-time gas detection can be achieved on edge devices. This not only reduces the reliance on complex equipment and large amounts of data transmission, but also improves the real-time and security of detection. By processing data on local devices, security threats that may be suffered by data during transmission are avoided, while reducing reliance on cloud platforms, thereby shortening response time and meeting scenarios with high real-time requirements.
[0073] It should be noted that by establishing a model that meets specific accuracy requirements, the reliability of the test results is ensured. In actual applications, maintenance personnel can timely discover potential faults or abnormal conditions based on the accurate information provided by the model, and take corresponding maintenance measures to avoid equipment failures. In addition, by training and validating the model in the laboratory, it can be ensured that the model has been fully tested and optimized before actual deployment, thereby improving the stability and reliability of the model.
[0074] In actual applications, it can also be adjusted according to different application scenarios and needs. For example, in some occasions with extremely high real-time requirements, the accuracy requirements can be appropriately increased to ensure the reliability of the detection results. In some cost-sensitive scenarios, a trade-off can be made between accuracy and cost to achieve the best cost-effectiveness. By flexibly adjusting the accuracy requirements, the needs of different users and technicians can be better met, thereby improving the applicability and promotion of the model.
[0075] In summary, by combining historical data and TinyML technology, an efficient and accurate gas prediction model was established, which not only improved the real-time and safety of detection, but also ensured the reliability and stability of the model in practical applications. By flexibly adjusting the accuracy requirements, different application scenarios and user needs can be better met, thereby improving the applicability and promotion of the model.
[0076] S102, establishing a first compression constraint condition according to the storage space of the target edge device, the maximum computing capacity of the target edge device, and the prediction accuracy requirement of the target gaseous decomposition product;
[0077] In an embodiment of the present application, based on the storage space of the target edge device, the maximum computing power of the target edge device, and the prediction accuracy requirement of the target gaseous decomposition product, a first compression constraint condition is established, including: the target edge device is the location for storing the final second gas prediction model; the storage space of the target edge device is determined by the selected target edge device, and the target edge device is selected from an edge device library; the edge device library is established before the first gas prediction model, the edge device library includes at least one edge device, the edge devices in the edge device library have different storage spaces or the same storage spaces, and the edge devices in the edge device library all have different maximum computing powers.
[0078] In the embodiment of the present application, the target edge device is a device including a detection function and placed near the target transformer.
[0079] In the embodiment of the present application, the edge device library includes different types of edge devices, including edge devices of different types or the same type but with different computing power. The edge device here can be a microprocessor. Of course, if other technicians use the method of the present application for simulation detection design, this edge device can be a tablet, computer, server, workstation and other devices with computing power. The establishment of the edge device library is intended to provide a variety of choices for different application scenarios to meet different accuracy and performance requirements.
[0080] Exemplarily, the edge device library is represented as E={e1,e2,e3,...,en}, where ei represents the i-th edge device in the edge device library, and each edge device ei has the following attributes: storage space size, maximum computing power, and prediction accuracy requirements.
[0081] It should be noted that when users select target edge devices, they need to comprehensively consider these attributes to meet the needs of specific application scenarios. For example, if the application scenario has extremely high real-time requirements, edge devices with higher computing power may be preferred, even if they have smaller storage space. On the contrary, if the application scenario is cost-sensitive, edge devices with larger storage space but lower computing power may be selected to reduce overall costs.
[0082] However, not all edge devices after selection can match the designed first gas prediction model, so the first gas prediction model needs to be compressed.
[0083] In the embodiment of the present application, according to the storage space of the target edge device, the maximum computing capacity of the target edge device, and the prediction accuracy requirement of the target gaseous decomposition product, establishing the first compression constraint condition further includes:
[0084] The target gaseous decomposition product prediction accuracy requirement is recorded as R aim , the first accuracy is recorded as R1;
[0085] The storage space of the selected target edge device is denoted as C max , the maximum computing capacity of the selected target edge device is recorded as J max ;
[0086] The first compression constraint is expressed as follows:
[0087] (R yasuo ≥R aim ≥R1)&(C yasuo ≤C max )&(J yasuo ≤J max )
[0088] Among them, R yasuo represents the accuracy of the second gas prediction model after compression operation, C yasuo represents the storage space occupied by the second gas prediction model after the compression operation, J yasuo Indicates the maximum amount of computation required by the second gas prediction model after the compression operation is placed.
[0089] It should be noted that the first compression constraint indicates that the accuracy of the second gas prediction model after the compression operation must not be less than the target gaseous decomposition prediction accuracy requirement preset by the user or technician, and must not be less than the preset first accuracy. At the same time, the storage space of the selected target edge device must be able to accommodate the storage space occupied by the second gas prediction model after the compression operation, so as to ensure that the target edge device can place the second gas prediction model, and at the same time, it is also necessary to ensure that the maximum amount of computing required for the second gas prediction model after the compression operation is lower than the maximum amount of computing required by the selected target edge device, so that the second gas prediction model stored in the target edge device can be accurately implemented.
[0090] It should be noted that by establishing compression constraints, it is possible to ensure that the model meets the accuracy requirements while adapting to the storage and computing power limitations of the target edge device. This optimization method not only improves the practicality and creativity of the model, but also reduces the dependence on hardware resources, allowing the model to be deployed on a variety of devices with different performance, thereby expanding its application range.
[0091] S103, performing a compression operation on the first gas prediction model according to the first compression constraint condition to obtain a second gas prediction model, where the compression operation includes a first compression operation and a second compression operation;
[0092] In an embodiment of the present application, according to the first compression constraint condition, a compression operation is performed on the first gas prediction model to obtain a second gas prediction model, and the compression operation includes a first compression operation and a second compression operation including: if the prediction accuracy requirement for the target gaseous decomposition product corresponding to the target edge device selected from the edge device library is not less than R1, and there is no storage space and computational demand for the first gas prediction model configured at the proximal end of the transformer, then no compression operation is performed at this time, and the first gas prediction model is used as the second gas prediction model, and the gas prediction model is configured as a floating point type TFLite at this time;
[0093] It should be noted that the benefit of being configured as a floating-point TFLite is that it can provide higher prediction accuracy while maintaining good computing efficiency. The floating-point TFLite model has advantages in processing floating-point operations and can better adapt to the prediction needs in various complex scenarios. However, the floating-point TFLite model may be relatively large in terms of storage space and computing power, so it is only deployed on certain edge devices where resources are not limited.
[0094] Furthermore, if the prediction accuracy requirement of the target gaseous decomposition product corresponding to the target edge device selected from the edge device library is not less than R1, and the storage space of the target edge device is smaller than the memory space occupied by the first gas prediction model, and there is no demand for the computational amount of the first gas prediction model, a first compression operation is performed on the first gas prediction model, and the first compression operation includes:
[0095] Convert the first gas prediction model to a 16-bit floating point precision type;
[0096] When the storage space occupied by the first gas prediction model after the 16-bit floating point precision type conversion is still larger than the storage space of the target edge device, the first gas prediction model is converted to a 16-bit integer type;
[0097] When the storage space occupied by the first gas prediction model after the 16-bit integer conversion is still larger than the storage space of the target edge device, the first gas prediction model is converted into an 8-bit integer.
[0098] It should be noted that the benefit of performing the above-mentioned first compression operation is to reduce the storage requirements of the model by reducing the data precision. First, converting the model from a floating point type to a 16-bit floating point precision type can significantly reduce the storage space of the model while maintaining a high prediction accuracy. If the storage space is still insufficient, further converting the model to a 16-bit integer type can further reduce the storage requirements, although this may slightly reduce the prediction accuracy of the model. If the storage space is still insufficient, the last step of converting the model to an 8-bit integer type can further compress the model to ensure that it can adapt to the storage space limitations of the target edge device. However, this extreme compression may lead to a further decrease in model accuracy, so it is necessary to find a balance between compressed accuracy and storage requirements.
[0099] Therefore, in an optional embodiment, it is determined whether the prediction accuracy of the first gas prediction model after the first compression operation is not lower than R1. If so, the model is output as the first gas prediction model. If not, the historical parameter data is used and the first gas prediction model after the first compression operation is retrained in combination with TinyML until the prediction accuracy is not lower than R1.
[0100] In an embodiment of the present application, according to the first compression constraint condition, a compression operation is performed on the first gas prediction model to obtain a second gas prediction model, and the compression operation includes a first compression operation and a second compression operation further includes:
[0101] If the prediction accuracy requirement for the target gaseous decomposition product corresponding to the target edge device selected from the edge device library is not less than R1, and the storage space of the target edge device is larger than the memory space occupied by the first gas prediction model, and the computing demand of the first gas prediction model is larger than the maximum computing demand of the selected target edge device, then a second compression operation is performed on the first gas prediction model.
[0102] In an embodiment of the present application, the second compression operation includes: reducing the number of neurons of the first gas prediction model one by one according to a first preset order, if when reducing the number of neurons of the first gas prediction model one by one according to the first preset order, the reduction amplitude of the computational demand of the first gas prediction model is less than the first preset amplitude or greater than the second amplitude, then stopping reducing the number of neurons at this time, and reducing the number of synapses in the first gas prediction model one by one according to the second preset order until the computational demand of the first gas prediction model is less than the maximum computational demand of the selected target edge device;
[0103] At this time, it is determined whether the prediction accuracy of the first gas prediction model after the second compression operation is not lower than R1. If so, the model is output as the second gas prediction model. If not, the historical parameter data is used and the first gas prediction model after the second compression operation is retrained in combination with TinyML until the prediction accuracy is not lower than R1.
[0104] In the embodiment of the present application, the first preset order can be to sort the neurons in the first gas prediction model according to their importance, wherein neurons with higher importance are arranged in front and neurons with lower importance are arranged in the back. This ensures that in the process of reducing neurons, the parts that have a greater impact on the prediction accuracy of the model are retained as much as possible. Therefore, when reducing, the neurons can be reduced from low to high according to their importance.
[0105] The second preset order can be sorted according to the weight of the synaptic connection, with the synapses with larger weights in front and the synapses with smaller weights in the back. In this way, the synaptic connections that have less impact on the prediction accuracy of the model can be reduced first, thereby reducing the amount of calculation of the model as much as possible while ensuring accuracy. Therefore, when reducing, it can be reduced from small to large according to the weight size.
[0106] It should be noted that the benefit of step S103 is that it can provide a more sophisticated compression strategy, so that the prediction accuracy of the model can be maintained as much as possible while meeting the computational load and storage space constraints of the target edge device. By reducing the strategy of neurons and synapses one by one, the complexity of the model can be adjusted more flexibly, so as to find the best balance point in different application scenarios.
[0107] S104, configuring a target edge device having a second gas prediction model after a built-in compression operation near the target transformer to perform gas detection.
[0108] Near the target transformer, the second gas prediction model can monitor and analyze gas composition in real time, providing timely warnings and maintenance recommendations. Because the model has been finely compressed, its operating efficiency on edge devices has been significantly improved while maintaining high prediction accuracy. This enables equipment maintenance personnel to quickly respond to potential gas leaks or other abnormal situations, thereby ensuring the safe and stable operation of the transformer.
[0109] In summary, the present invention proposes a gas detection method and system based on TinyML, which obtains historical parameter data of gaseous decomposition products dissolved in transformer oil in transformers of the same type as the target transformer, and establishes a first gas prediction model in combination with TinyML, wherein the historical parameter data at least includes the type and concentration of gaseous decomposition products; a first compression constraint condition is established according to the storage space of the target edge device, the maximum computing capacity of the target edge device, and the prediction accuracy requirement of the target gaseous decomposition product; according to the first compression constraint condition, the first gas prediction model is compressed to obtain a second gas prediction model, wherein the compression operation includes a first compression operation and a second compression operation; the target edge device with the second gas prediction model after the built-in compression operation is configured at the near end of the target transformer for gas detection. The method performs gas detection model adaptation operation according to the type of transformer near-end edge device actually selected, which greatly reduces the loss of repeated training models, adapts to the requirements of computing power, and ensures the accuracy of gas detection. In addition, the method uses local edge devices to process data, which can prevent gas data leakage and ensure data security.
[0110] This embodiment also provides a gas detection system based on TinyML, including:
[0111] The first model building module is used to obtain historical parameter data of gaseous decomposition products dissolved in transformer oil in transformers of the same type as the target transformer, and to establish a first gas prediction model in combination with TinyML, wherein the historical parameter data at least includes the type and concentration of the gaseous decomposition products;
[0112] A first constraint establishing module, used to establish a first compression constraint condition according to a storage space of a target edge device, a maximum computing capacity of the target edge device, and a prediction accuracy requirement of a target gaseous decomposition product;
[0113] A compression operation module, used to perform a compression operation on the first gas prediction model according to a first compression constraint condition to obtain a second gas prediction model, wherein the compression operation includes a first compression operation and a second compression operation;
[0114] The detection module is used to configure the target edge device with the second gas prediction model after the built-in compression operation near the target transformer to perform gas detection.
[0115] The above-mentioned unit modules may be embedded in or independent of a processor in a computer device in the form of hardware, or may be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to the above-mentioned modules.
[0116] This embodiment also provides a computer device, which may be a terminal, and its internal structure diagram may be as shown in FIG. Figure 2 As shown. The computer device includes a processor, a memory, a communication interface, a display screen and an input device connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be achieved through WIFI, an operator network, NFC (near field communication) or other technologies. When the computer program is executed by the processor, a gas detection method based on TinyML is implemented. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covered on the display screen, or a key, trackball or touchpad set on the computer device housing, or an external keyboard, touchpad or mouse, etc.
[0117] This embodiment further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the following steps are implemented:
[0118] Obtain historical parameter data of gaseous decomposition products dissolved in transformer oil in transformers of the same type as the target transformer, and establish a first gas prediction model in combination with TinyML, wherein the historical parameter data at least includes the type and concentration of the gaseous decomposition products;
[0119] Establishing a first compression constraint condition according to the storage space of the target edge device, the maximum computing capacity of the target edge device, and the prediction accuracy requirement of the target gaseous decomposition product;
[0120] According to the first compression constraint condition, a compression operation is performed on the first gas prediction model to obtain a second gas prediction model, where the compression operation includes a first compression operation and a second compression operation;
[0121] A target edge device with a built-in second gas prediction model after compression operation is configured near the target transformer for gas detection.
[0122] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention rather than to limit it. 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, which should all be included in the scope of the claims of the present invention.
[0123] Those skilled in the art will appreciate that the embodiments of the present application can be provided as methods, systems, or computer program products. Therefore, the present application can adopt the form of complete hardware embodiments, complete software embodiments, or embodiments in combination with software and hardware. Moreover, the present application can adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code. The scheme in the embodiments of the present application can be implemented in various computer languages, for example, object-oriented programming language Java and literal scripting language JavaScript, etc.
[0124] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0125] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0126] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process in the computer or other programmable device. Figure 1 A process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0127] Although the preferred embodiments of the present application have been described, those skilled in the art may make other changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications falling within the scope of the present application.
[0128] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.
Claims
1. A gas detection method based on TinyML, characterized in that: include: Obtain historical parameter data of gaseous decomposition products dissolved in transformer oil in transformers of the same type as the target transformer, and establish a first gas prediction model in combination with TinyML, wherein the historical parameter data at least includes the type and concentration of the gaseous decomposition products; Establishing a first compression constraint condition according to the storage space of the target edge device, the maximum computing capacity of the target edge device, and the prediction accuracy requirement of the target gaseous decomposition product; According to the first compression constraint condition, a compression operation is performed on the first gas prediction model to obtain a second gas prediction model, wherein the compression operation includes a first compression operation and a second compression operation; A target edge device with a built-in second gas prediction model after compression operation is configured near the target transformer for gas detection.
2. The gas detection method based on TinyML according to claim 1, characterized in that: The establishing of the first gas prediction model comprises: The input of the first gas prediction model includes at least the concentration of historical gaseous decomposition products; The output of the first gas prediction model includes at least the types of historical gaseous decomposition products; The accuracy of the first gas prediction model established in combination with TinyML is greater than the first accuracy requirement. The first accuracy requirement is a constraint for the model to be established. If and only if the prediction accuracy of the first gas prediction model is greater than the first accuracy requirement, the first gas prediction model is established and the first gas prediction model is output to the target storage location.
3. The gas detection method based on TinyML as claimed in claim 2, characterized in that: The establishing of the first compression constraint condition according to the storage space of the target edge device, the maximum computing capacity of the target edge device, and the prediction accuracy requirement of the target gaseous decomposition product includes: The target edge device is a location where the final second gas prediction model is stored; The storage space of the target edge device is determined by the selected target edge device, and the target edge device is selected from the edge device library; The edge device library is established before the first gas prediction model. The edge device library includes at least one edge device. The edge devices in the edge device library have different storage spaces or the same storage spaces. The edge devices in the edge device library have different maximum computing power.
4. The gas detection method based on TinyML as claimed in claim 3, characterized in that: The establishing of the first compression constraint condition according to the storage space of the target edge device, the maximum computing capacity of the target edge device, and the prediction accuracy requirement of the target gaseous decomposition product further includes: The target gaseous decomposition product prediction accuracy requirement is recorded as R aim , the first accuracy is recorded as R1; The storage space of the selected target edge device is denoted as C max , the maximum computing capacity of the selected target edge device is recorded as J max ; The first compression constraint is expressed as follows: (R yasuo ≥R aim ≥R1)&(C yasuo ≤C max )&(J yasuo ≤J max ) Among them, R yasuo represents the accuracy of the second gas prediction model after compression operation, C yasuo represents the storage space occupied by the second gas prediction model after the compression operation, J yasuo Indicates the maximum amount of computation required by the second gas prediction model after the compression operation is placed.
5. The gas detection method based on TinyML as claimed in claim 4, characterized in that: The first gas prediction model is compressed according to the first compression constraint condition to obtain a second gas prediction model, wherein the compression operation includes a first compression operation and a second compression operation includes: If the prediction accuracy requirement for the target gaseous decomposition product corresponding to the target edge device selected from the edge device library is not less than R1, and there is no storage space and computational demand for the first gas prediction model configured near the transformer, then no compression operation is performed at this time. At this time, the first gas prediction model is used as the second gas prediction model, and the gas prediction model is configured as a floating point TFLite; If the prediction accuracy requirement for the target gaseous decomposition product corresponding to the target edge device selected from the edge device library is not less than R1, and the storage space of the target edge device is smaller than the memory space occupied by the first gas prediction model, and there is no demand for the computational amount of the first gas prediction model, a first compression operation is performed on the first gas prediction model, and the first compression operation includes: Convert the first gas prediction model to a 16-bit floating point precision type; When the storage space occupied by the first gas prediction model after the 16-bit floating point precision type conversion is still larger than the storage space of the target edge device, the first gas prediction model is converted to a 16-bit integer type; When the storage space occupied by the first gas prediction model after the 16-bit integer conversion is still larger than the storage space of the target edge device, the first gas prediction model is converted into an 8-bit integer.
6. The gas detection method based on TinyML as claimed in claim 5, characterized in that: The first gas prediction model is compressed according to the first compression constraint condition to obtain a second gas prediction model, wherein the compression operation includes a first compression operation and a second compression operation and further includes: If the prediction accuracy requirement for the target gaseous decomposition product corresponding to the target edge device selected from the edge device library is not less than R1, and the storage space of the target edge device is larger than the memory space occupied by the first gas prediction model, and the computing demand of the first gas prediction model is larger than the maximum computing demand of the selected target edge device, then a second compression operation is performed on the first gas prediction model.
7. The gas detection method based on TinyML as claimed in claim 6, characterized in that: The second compression operation includes: The number of neurons of the first gas prediction model is reduced one by one according to the first preset order. If the amplitude of the reduction in the amount of computation required by the first gas prediction model is less than the first preset amplitude or greater than the second amplitude when the number of neurons of the first gas prediction model is reduced one by one according to the first preset order, then the number of neurons is stopped from being reduced, and the number of synapses in the first gas prediction model is reduced one by one according to the second preset order until the amount of computation required by the first gas prediction model is less than the maximum amount of computation required by the selected target edge device; At this time, it is determined whether the prediction accuracy of the first gas prediction model after the second compression operation is not lower than R1. If so, the model is output as the second gas prediction model. If not, the historical parameter data is used and the first gas prediction model after the second compression operation is retrained in combination with TinyML until the prediction accuracy is not lower than R1.
8. A gas detection system based on TinyML, characterized in that: include: A first model building module is used to obtain historical parameter data of gaseous decomposition products dissolved in transformer oil in transformers of the same type as the target transformer, and to establish a first gas prediction model in combination with TinyML, wherein the historical parameter data at least includes the type and concentration of the gaseous decomposition products; A first constraint establishing module, used to establish a first compression constraint condition according to a storage space of a target edge device, a maximum computing capacity of the target edge device, and a prediction accuracy requirement of a target gaseous decomposition product; A compression operation module, configured to perform a compression operation on the first gas prediction model according to the first compression constraint condition to obtain a second gas prediction model, wherein the compression operation includes a first compression operation and a second compression operation; The detection module is used to configure the target edge device with the second gas prediction model after the built-in compression operation near the target transformer to perform gas detection.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.