An acoustic leak detection model packaging reconstruction and hot switching method and system

By encapsulating the acoustic leakage detection model into a single package and implementing version management and model reconstruction, the problems of scattered model management and complex adaptation of heterogeneous models are solved, ensuring the continuity and stability of online services.

CN122489108APending Publication Date: 2026-07-31ANHUI AOTAIQI INTELLIGENT WATER TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610633789.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-05-09
Publication Date
2026-07-31

AI Technical Summary

Technical Problem

In the engineering deployment of acoustic leakage detection models, the decentralized model management, the complex adaptation of heterogeneous models, and the insufficient continuity of online services make the model update and version switching process complicated, which may affect the continuity and stability of online inference services.

Method used

The trained acoustic leakage detection model's main data, model type information, and feature processing components are packaged into a single model package. Algorithm identification information and version information are written into the package. Version registration and integrity verification are performed through the model repository. Model reconstruction and switching are carried out by atomic replacement to activate model pointers, ensuring the continuity of online services.

Benefits of technology

It achieves unified encapsulation and version management of model assets, improves the orderliness of model version management, reduces the complexity of heterogeneous model adaptation, ensures the continuous operation of online inference services, and reduces the risk of anomalies caused by model switching.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122489108A_ABST
    Figure CN122489108A_ABST
Patent Text Reader

Abstract

This application provides a method and system for encapsulating, reconstructing, and hot-switching an acoustic leakage detection model, belonging to the field of acoustic leakage detection technology. The method includes: encapsulating the main model data, model type information, and feature processing components corresponding to a trained acoustic leakage detection model to obtain a single model package containing algorithm identification information and version information; uploading the single model package to a model repository and registering its version; obtaining the single model package to be switched and verifying it; performing model reconstruction, pre-heating inference, and verification; switching the inference entry point after successful verification, otherwise maintaining the current service model; receiving acoustic samples and outputting inference results. The method provided in this application can achieve unified model encapsulation, heterogeneous model reconstruction, and continuous online service switching.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of acoustic leakage detection technology, and in particular to an acoustic leakage detection model encapsulation reconstruction and hot-switching method and system. Background Technology

[0002] With the continuous expansion of urban water supply networks and the increasing demand for refined operation and maintenance, acoustic signal-based leakage detection technology has gradually become an important technical means for monitoring the condition of water supply networks. Related systems typically acquire vibration and noise signals during network operation through listening devices, online monitoring equipment, or other acoustic acquisition terminals. These signals are then combined with data analysis models to identify signal characteristics and help determine the presence of leakage risks. With the development of artificial intelligence and data analysis technologies, the types of models used in acoustic leakage detection systems are becoming increasingly diverse, including deep learning models, traditional machine learning models, and their combined applications.

[0003] In related technologies, different types of models typically employ independent implementation methods during training, storage, deployment, and updating. Some models rely on parameter files and configuration files specific to a particular framework, while others require additional storage of feature processing components, label mapping information, or other auxiliary data, resulting in a decentralized management of model-related assets in engineering applications. Furthermore, different models often correspond to different loading methods, runtime environments, and inference call methods on the deployment side, making model deployment, version replacement, and operation and maintenance processes quite complex. Especially in business scenarios requiring long-term continuous operation, such as water supply network leakage monitoring, improper handling during model updates, version switching, or fault handling can also affect the continuity and stability of online inference services.

[0004] Therefore, in the engineering deployment of acoustic leakage detection models, the problems of decentralized model management, complex adaptation of heterogeneous models, and insufficient continuity of online services have become urgent issues to be addressed. Summary of the Invention

[0005] This application provides a method and system for encapsulating, reconstructing, and hot-switching an acoustic leakage detection model, aiming to solve the technical problems of dispersed model management, complex adaptation of heterogeneous models, and insufficient online service continuity in the engineering deployment of existing acoustic leakage detection models.

[0006] In a first aspect, this application provides a method for encapsulating, reconstructing, and hot-switching an acoustic leakage detection model, the method comprising: The trained acoustic leakage detection model is packaged into a single model package, which includes the main model data, model type information, and feature processing components. Algorithm identification information and version information are written into the single model package. Upload the single model package to the model repository and register its version. In response to a model switching command, the system retrieves the single model package to be switched from the model repository and performs integrity and availability checks on the single model package to be switched. The corresponding model reconstruction method is determined based on the model type information and algorithm identification information in the single model package to be switched, and the model reconstruction is performed in combination with the model main data and feature processing components in the single model package to be switched to obtain the reconstructed model. A warm-up inference was performed on the reconstructed model, and the inference results and the integrity of the model structure were verified based on test samples. After verification, while the current service model continues to provide services to the outside world, the inference entry point is switched from the current service model to the reconstructed model by atomically replacing the activation model pointer, and the reconstructed model is set as the activation model. When verification fails or the switching process fails, the current service model is retained as the active model to continue providing inference services. Acoustic samples are received through a unified inference interface, the activation model is invoked to perform inference, and the inference results are output.

[0007] In one possible design, the feature processing component includes scaler data, metadata information, input mode information, and output mode information; The single model package also includes verification information.

[0008] In one possible design, the metadata information includes input dimensions, category mapping relationships, feature processing methods, and training configuration information.

[0009] In one possible design, determining the corresponding model reconstruction method based on the model type information and algorithm identification information in the single model package to be switched, and performing model reconstruction in conjunction with the model main data and feature processing components in the single model package to be switched, to obtain the reconstructed model, includes: When the model type information represents a deep learning model, the network topology is restored according to the algorithm identification information and the model parameters are loaded to obtain the reconstructed model; When the model type information represents a traditional machine learning model, the model object is directly deserialized and reconstructed to obtain the reconstructed model.

[0010] In one possible design, the step of restoring the network topology based on the algorithm identification information and loading model parameters to obtain the reconstructed model includes: Match the corresponding network structure template based on the algorithm identification information; The model parameters in the single model package to be switched are loaded into the network structure template to obtain the reconstructed model.

[0011] In one possible design, after performing warm-up inference on the reconstructed model and verifying the inference results and model structural integrity based on test samples, the method further includes: Perform a health check on the reconstructed model; After the health check is passed, the inference entry point will be switched from the current service model to the reconstructed model.

[0012] In one possible design, switching the inference entry point from the current service model to the reconstructed model includes: Register multiple versions of a single model package in the model repository; Upon receiving the model switching instruction, the single model package to be switched is determined based on the model switching instruction; While the current service model is continuously responding to inference requests, parallel reconstruction and warm-up are performed on the single model package to be switched. After the parallel reconstruction and preheating are completed, the inference entry is switched to the reconstructed model by atomically replacing the activation model pointer, and the reconstructed model is set as the activation model.

[0013] In one possible design, if any step in the process of acquiring, verifying, rebuilding, warming up, validating, health checking, or switching the single model package to be switched fails, the activation of the rebuilt model is terminated, and the current service model is maintained as the activated model to continue providing inference services.

[0014] In one possible design, receiving acoustic samples through a unified inference interface, invoking the activation model to perform inference, and outputting the inference result includes: Receive leak detection instrument samples or monitoring instrument samples through the unified inference interface; Based on the input pattern information, the leak detector sample or the monitoring instrument sample is input into the activation model for inference; The reasoning result is output based on the output pattern information.

[0015] Secondly, this application provides an acoustic leakage detection model encapsulation reconstruction and hot-switching system, the system comprising: The unified model encapsulation module is used to encapsulate the main model data, model type information and feature processing components corresponding to the trained acoustic leakage detection model into a single model package, and write algorithm identification information and version information into the single model package; A model repository is used to store the single model package and register its version. The activation management module is used to respond to model switching commands, retrieve the single model package to be switched from the model repository, and perform integrity and availability checks on the single model package to be switched. The model reconstruction module is used to determine the corresponding model reconstruction method based on the model type information and algorithm identification information in the single model package to be switched, and to perform model reconstruction in combination with the model main data and feature processing components in the single model package to be switched to obtain a reconstructed model; and to perform pre-warm-up inference on the reconstructed model, and to verify the inference results and model structural integrity based on test samples. The hot-switching control module is used to switch the inference entry point from the current service model to the reconstructed model by atomically replacing the activation model pointer after successful verification, while the current service model continues to provide services externally; and to set the reconstructed model as the activation model when verification fails or the switching process fails. A unified inference interface is used to receive acoustic samples, call the activation model to perform inference, and output the inference results.

[0016] Thirdly, embodiments of this application provide a computer-readable storage medium storing computer-executable instructions, which, when executed, implement the method described in the first aspect or various possible designs of the first aspect.

[0017] Fourthly, this application provides a computer program product, which includes computer program code that, when run on a computer, causes the computer to implement the method described in the first aspect or various possible designs of the first aspect.

[0018] This application provides a method and system for encapsulating, reconstructing, and hot-switching an acoustic leakage detection model. The method encapsulates the main model data, model type information, and feature processing components of a trained acoustic leakage detection model into a single model package. Algorithm identification information and version information are written into this single model package, unifying the previously scattered model-related content for unified organization and management, thus avoiding the management fragmentation issues caused by maintaining different model assets separately. By uploading the single model package to a model repository and registering its version, and then responding to a model switching command, the method retrieves the single model package to be switched from the model repository. This allows models to be deployed and switched based on the registered versions in the repository, thereby improving the orderliness of model version management. The method performs integrity and availability checks on the single model package to be switched, and determines the model type and algorithm identification information based on the single model package. The method determines the corresponding model reconstruction method based on information, and then performs model reconstruction by combining the model's main data and feature processing components to obtain a reconstructed model. This allows different types of models to be reconstructed according to a unified process, thereby alleviating the complexity of heterogeneous model adaptation. Furthermore, by performing pre-warm-up inference on the reconstructed model and verifying the inference results and model structural integrity based on test samples, the availability of the model to be switched is confirmed before the formal switch, thus reducing the risk of anomalies caused by direct model switching. After successful verification, while the current service model continues to provide services, the inference entry point is switched from the current service model to the reconstructed model by atomically replacing the activation model pointer. Even if verification fails or the switching process fails, the current service model remains the active model to continue providing inference services, ensuring that there is always an active model available for service during the model switching process, thus guaranteeing the continuity of online inference services. Therefore, the method provided in this application can achieve unified encapsulation and versioning management of model assets, unified reconstruction and switching control of heterogeneous models, and continuous operation of online inference services, thereby solving the technical problems of decentralized model management, complex heterogeneous model adaptation, and insufficient online service continuity in related technologies. Attached Figure Description

[0019] Figure 1 A schematic flowchart illustrating an acoustic leakage detection model encapsulation, reconstruction, and hot-switching method provided in an embodiment of this application; Figure 2 A schematic diagram of the structure of an acoustic leakage detection model encapsulation reconstruction and hot-switching system provided in this application embodiment; Figure 3 A schematic flowchart illustrating another acoustic leakage detection model encapsulation, reconstruction, and hot-switching method provided in this application embodiment; Figure 4 A schematic flowchart illustrating another method for encapsulating, reconstructing, and hot-switching an acoustic leakage detection model provided in this application embodiment; Figure 5 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation

[0020] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0021] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application pertains; the terminology used herein in the specification of the application is for the purpose of describing particular embodiments only and is not intended to limit the application; the terms “comprising” and “having”, and any variations thereof, in the specification, claims and drawings of this application are intended to cover non-exclusive inclusion.

[0022] The term "embodiment" as used herein means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of the phrase "embodiment" in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.

[0023] In this article, the term "and / or" simply describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can mean: A exists, A and B can exist simultaneously, and B exists. Additionally, the character " / " in this article generally indicates that the preceding and following related objects have an "or" relationship.

[0024] Furthermore, the terms "first," "second," etc., in the specification and claims of this application or in the aforementioned drawings are used to distinguish different objects rather than to describe a specific order, and may explicitly or implicitly include one or more of the features.

[0025] In the description of this application, unless otherwise stated, "multiple" and "at least two" mean two or more (including two), and similarly, "multiple groups" and "at least two groups" mean two or more (including two groups).

[0026] In the description of this application, it should be noted that, unless otherwise explicitly specified and limited, the terms "connected" and "linked" should be interpreted broadly. For example, "connected" or "linked" can refer not only to a physical connection, but also to an electrical connection or a signal connection. For instance, it can be a direct connection, i.e., a physical connection, or an indirect connection through at least one intermediate component, as long as the circuit is connected. It can also refer to the internal connection between two components. A signal connection can refer not only to a signal connection through a circuit, but also to a signal connection through a medium, such as radio waves. Those skilled in the art can understand the specific meaning of the above terms in this application based on the specific circumstances.

[0027] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. It should be noted that, unless otherwise specified, different technical features in this application can be combined with each other.

[0028] Figure 1 This is a schematic flowchart illustrating an acoustic leakage detection model encapsulation, reconstruction, and hot-switching method provided in an embodiment of this application. Figure 1 As shown, the method provided in this application embodiment specifically includes S101 to S108, and S101 to S108 will be described in detail below.

[0029] It should be noted that the acoustic leakage detection model encapsulation, reconstruction, and hot-switching method provided in this application embodiment can be executed by an acoustic leakage detection model encapsulation, reconstruction, and hot-switching system, which includes a unified model encapsulation module, a model storage, an activation management module, a model reconstruction module, a hot-switching control module, and a unified inference interface, or can be executed by an electronic device with the above-mentioned module functions. This application does not limit this.

[0030] Figure 2 This is a schematic diagram of the structure of an acoustic leakage detection model encapsulation reconstruction and hot-switching system provided in an embodiment of this application. Figure 2 As shown in the embodiments of this application, the acoustic leakage detection model encapsulation, reconstruction, and hot-switching system includes a training platform, a unified model encapsulation module, a model repository, an activation management module, a model reconstruction module, a unified inference interface, a hot-switching control module, and a monitoring log module.

[0031] The system comprises the following components: a training platform for training the acoustic leakage detection model and outputting the trained model data; a unified model encapsulation module for encapsulating the trained acoustic leakage detection model's main data, model type information, and feature processing components into a single model package, and writing algorithm identification and version information into the single model package; a model repository for storing single model packages and registering their versions; an activation management module for responding to model switching commands and performing integrity and availability checks on the single model package to be switched; a model reconstruction module for determining the corresponding model reconstruction method based on the model type information and algorithm identification information in the single model package to be switched, and performing model reconstruction in conjunction with the main model data and feature processing components to obtain the reconstructed model; a unified inference interface for receiving acoustic samples and calling the activated model to perform inference; a hot-switching control module for switching the inference entry point after successful verification, and maintaining the current service model as the activated model to provide inference services when verification fails or the switching process fails; and a monitoring log module for recording the running log information during model encapsulation, version registration, verification, reconstruction, warm-up, verification, switching, and rollback processes.

[0032] S101. Encapsulate the main model data, model type information, and feature processing components corresponding to the trained acoustic leakage detection model into a single model package, and write algorithm identification information and version information into the single model package.

[0033] The method steps shown in S101 can be executed by the unified model encapsulation module.

[0034] After the acoustic leakage detection model is trained, the model body data, model type information and feature processing components corresponding to the acoustic leakage detection model are obtained, and the model body data, model type information and feature processing components are uniformly organized and encapsulated to generate a single model package.

[0035] The model body data is used to represent the content of the model ontology; for deep learning models, the model body data may include model parameters; for traditional machine learning models, the model body data may include deserializable model object data.

[0036] Model type information is used to characterize the model category to which the acoustic leakage detection model belongs, so that the corresponding model reconstruction method can be selected according to different model categories. For example, model type information can be used to characterize whether the acoustic leakage detection model is a deep learning model or a traditional machine learning model.

[0037] The feature processing component is used to characterize the feature processing-related content that is associated with the acoustic leakage detection model, so that the input acoustic samples can be processed accordingly during the subsequent model reconstruction and inference process.

[0038] In one alternative implementation, a single model package may be a uniformly organized file package, a compressed package, a serialized package body, or other encapsulated, transmittable, and loadable package, and this application does not limit this.

[0039] Unified organization and encapsulation of model main data, model type information and feature processing components may include: writing model main data, model type information and feature processing components into the same encapsulation body according to preset encapsulation rules, and reserving fields or storage areas in the encapsulation body for recording algorithm identification information and version information.

[0040] The algorithm identification information is used to identify the algorithm type or algorithm name corresponding to the acoustic leakage detection model, so that the corresponding model reconstruction method can be determined based on the algorithm identification information.

[0041] Version information is used to identify the model version corresponding to the current single model package, so as to facilitate subsequent model repository registration, version management and model switching control.

[0042] In this embodiment, multiple components originally related to the acoustic leakage detection model can be encapsulated into a unified single model package, providing a unified data foundation for subsequent model storage registration, model reconstruction, and hot switching.

[0043] In one possible embodiment, the model type information in a single model package may correspond to the `model_type` field, the algorithm identifier information may correspond to the `algorithm` field, the model body data may correspond to the `model_state` field, the scaler data may correspond to the `scaler` field, the metadata information may correspond to the `metadata` field, the version information may correspond to the `version` field, the verification information may correspond to the `checksum` field, the input schema information may correspond to the `input_schema` field, and the output schema information may correspond to the `output_schema` field. This application does not limit the names of the above fields, as long as they can be used to represent the corresponding information and support the encapsulation, storage, verification, reconstruction, and inference invocation of a single model package.

[0044] S102. Upload the single model package to the model repository and register the version.

[0045] The method steps shown in S102 can be executed by the model repository or a management module that interacts with the model repository.

[0046] The model repository can be a storage space or management platform for storing multiple model packages and their corresponding version information. This application does not limit the specific implementation form of the model repository.

[0047] Specifically, a single model package is transferred to the corresponding storage location in the model repository, and the single model package is associated with the corresponding algorithm identification information and version information.

[0048] In this embodiment, version registration is used to record the version information corresponding to the currently uploaded single model package, so as to perform model selection, model switching and historical version management based on different versions of the single model package.

[0049] Specifically, after a single model package is uploaded, a version registration record corresponding to that single model package can be generated in the model repository. The version registration record can include version information and the single model package identifier corresponding to that version information.

[0050] In this embodiment, a single model package is uniformly stored in a versioned manner, providing a basis for retrieving the single model package to be switched from the model repository when responding to a model switching command.

[0051] S103. Respond to the model switching command, retrieve the single model package to be switched from the model repository, and perform integrity and availability checks on the single model package to be switched.

[0052] The method steps shown in S103 can be executed by the activation management module.

[0053] When the system receives a model switching instruction, it determines the single model package to be switched based on the instruction and reads the corresponding single model package to be switched from the model repository.

[0054] The model switching command can be a model switching request issued by the operation and maintenance side, the management side, or the internal control logic of the system. This application does not limit the specific triggering method.

[0055] After obtaining the single model package to be switched, perform integrity and availability checks on the single model package to be switched.

[0056] Among them, integrity verification is used to confirm whether the single model package to be switched remains intact during storage, transmission or retrieval; availability verification is used to confirm whether the single model package to be switched meets the basic requirements for subsequent model reconstruction and inference calls.

[0057] In one alternative implementation, integrity verification can be performed based on verification information recorded in a single model package; availability verification can be used to check whether the single model package to be switched contains the main model data, model type information, algorithm identification information, and feature processing components required for subsequent model reconstruction.

[0058] In this embodiment, a pre-check is performed on the single model package to be switched before model reconstruction, thereby providing usable input objects for subsequent model reconstruction.

[0059] S104. Determine the corresponding model reconstruction method based on the model type information and algorithm identification information in the single model package to be switched, and perform model reconstruction by combining the model main data and feature processing components in the single model package to be switched, so as to obtain the reconstructed model.

[0060] The method steps shown in S104 can be executed by the model reconstruction module.

[0061] After completing the integrity and availability checks of the single model package to be switched, the model type information and algorithm identification information in the single model package to be switched are read, and the corresponding model reconstruction method is determined accordingly.

[0062] Among them, the model type information is used to distinguish the model category to which the model to be switched belongs, and the algorithm identification information is used to identify the specific algorithm type or algorithm name, so that the system can adopt the corresponding reconstruction processing method for models of different categories and different algorithms.

[0063] The feature processing component is used to support feature processing of subsequent input samples after model reconstruction.

[0064] In this embodiment, by converting the single model package to be switched in the model repository into a reconstructed model that can be actually invoked, a model object to be activated is provided for subsequent warm-up inference and online switching.

[0065] S105. Perform pre-warm-up inference on the reconstructed model and verify the inference results and the integrity of the model structure based on test samples.

[0066] The method steps shown in S105 can be executed by the model reconstruction module or the verification module.

[0067] After obtaining the reconstructed model, pre-warm-up inference is performed on the reconstructed model. Pre-warm-up inference is used to ensure that the reconstructed model completes one or more inference calls before formally receiving online inference requests, so as to trigger the inference-related model loading, parameter access, or runtime preparation processes in advance.

[0068] After completing the pre-warm-up inference, the inference results and structural integrity of the reconstructed model are verified based on test samples. The test samples can be pre-prepared sample data. Verification of the inference results confirms that the reconstructed model can output inference results in the expected form; verification of the structural integrity confirms whether the reconstructed model retains its complete structure after reconstruction.

[0069] In this embodiment, by confirming that the reconstruction model has callability and basic availability before the formal switchover, a verification basis is provided for subsequent hot switchover.

[0070] S106. After verification, while the current service model continues to provide services to the outside world, the inference entry point is switched from the current service model to the reconstructed model by atomically replacing the activation model pointer, and the reconstructed model is set as the activation model.

[0071] The method steps shown in S106 can be executed by the hot-switching control module. When the verification result of the reconstructed model shows that the verification is successful, the model switch is performed while the current service model continues to provide services.

[0072] The current service model refers to the model that is currently called by the inference entry point and provides inference services to the outside world before the switching action occurs; the activated model refers to the model that is currently pointed to by the inference entry point and actually performs inference.

[0073] In this embodiment, the switching is accomplished by atomically replacing the activation model pointer.

[0074] Specifically, the inference entry point, which originally pointed to the current service model, is atomically replaced to point to the reconstructed model, and the reconstructed model is set as the active model after the switch is complete. Since the switch is performed while the current service model continues to provide services, the current service model can continue to process external inference requests before the switch is complete; after the switch is complete, subsequent inference requests entering the inference entry point will be handled by the reconstructed model.

[0075] In this embodiment, model switching can be completed without interrupting the current service model's continuous external service.

[0076] S107. When verification fails or the switching process fails, the current service model is kept as the active model to continue providing inference services.

[0077] The method steps shown in S107 can be executed by the hot-switching control module. When the verification result of the reconstructed model fails, or when a switching failure occurs during the switching process in S106, the reconstructed model is not set as the active model. Instead, the current service model continues to serve as the active model to provide inference services.

[0078] It should be noted that a failed switchover process means that the inference entry point has not been successfully switched from the current service model to the reconstructed model.

[0079] In this embodiment, by executing the method steps shown in S107, the activation process for the reconstructed model can be terminated, and the inference entry point can continue to point to the current service model. Since the current service model is already in an external service state before the switch, subsequent inference requests can still be processed even if the verification fails or the switch fails, so that the existing inference service remains available when the model to be switched does not meet the online conditions or the switch fails.

[0080] S108. Receive acoustic samples through the unified inference interface, call the activation model to perform inference, and output the inference results.

[0081] The method steps shown in S108 can be executed by the unified inference interface. The unified inference interface is used to receive externally input acoustic samples and forward the acoustic samples to the activation model to perform inference.

[0082] It should be noted that acoustic samples can be input samples used for acoustic leakage detection. After receiving the acoustic samples, the unified inference interface calls the activation model to perform inference processing and outputs the corresponding inference results. Since the unified inference interface always calls the activation model to perform inference, the external caller can obtain the inference results through the unified inference interface regardless of whether the system is in the pre-switch state, the state after a successful switch, or the hold-on state after a failed switch.

[0083] This application provides a method for encapsulating, reconstructing, and hot-switching an acoustic leakage detection model. This method encapsulates the main model data, model type information, and feature processing components of a trained acoustic leakage detection model into a single model package. Algorithm identification information and version information are written into this single model package, unifying the previously scattered model-related content for unified organization and management, thus avoiding the management fragmentation issues caused by maintaining different model assets separately. By uploading the single model package to a model repository and registering its version, and then responding to a model switching command, the method retrieves the single model package to be switched from the model repository. This allows models to be deployed and switched based on the registered versions in the repository, thereby improving the orderliness of model version management. The method performs integrity and availability checks on the single model package to be switched, and uses the model type information and algorithm identification information within the single model package to determine its suitability. The corresponding model reconstruction method is determined, and then the model reconstruction is performed in combination with the main model data and feature processing components to obtain the reconstructed model. This allows different types of models to be reconstructed according to a unified process, thereby alleviating the problem of complex adaptation of heterogeneous models. Furthermore, by performing pre-warm-up inference on the reconstructed model and verifying the inference results and model structural integrity based on test samples, the availability of the model to be switched is confirmed before the formal switch, thereby reducing the anomaly risk brought about by direct model switching. Then, after the verification is passed, during the process of continuously providing services to the outside world with the current service model, the inference entry point is switched from the current service model to the reconstructed model by atomically replacing the activation model pointer. If the verification fails or the switching process fails, the current service model is kept as the activation model to continue to provide inference services. This ensures that there is always an activation model that can provide services to the outside world during the model switching process, thereby ensuring the continuity of online inference services.

[0084] Figure 3 This is a schematic flowchart illustrating another method for encapsulating, reconstructing, and hot-switching acoustic leakage detection models provided in this application embodiment. Figure 3As shown, this method first encapsulates the model body data, model type information, and feature processing components corresponding to the trained acoustic leakage detection model to generate a single model package, and writes algorithm identification information and version information into the single model package; then, the single model package is uploaded to the model repository and version is registered; upon receiving a model switching instruction, the single model package to be switched is retrieved from the model repository, and its integrity and availability are verified; after the verification passes, the corresponding model reconstruction method is determined according to the model type information and algorithm identification information in the single model package to be switched, and model reconstruction is performed in combination with the model body data and feature processing components to obtain the reconstructed model; subsequently, preheating inference is performed on the reconstructed model, and the inference results and model structure integrity are verified based on test samples; when the verification passes, during the continuous external service of the current service model, the inference entry is switched from the current service model to the reconstructed model by atomically replacing the activation model pointer, and the reconstructed model is set as the active model; when the verification fails or the switching process fails, the current service model is kept as the active model to continue providing inference services; finally, acoustic samples are received through a unified inference interface, the active model is called to perform inference, and the inference results are output.

[0085] In one possible embodiment, the feature processing component includes scaler data, metadata information, input mode information, and output mode information.

[0086] The feature processing component is used to characterize the feature processing related content that is compatible with the acoustic leakage detection model, so that in the subsequent model reconstruction and inference process, the input acoustic samples can be processed in a way that is compatible with the acoustic leakage detection model.

[0087] Specifically, scaler data is used to characterize the data related to scaling the input features, metadata information is used to characterize the descriptive information related to model reconstruction and feature processing, input pattern information is used to characterize the data organization form or input requirements corresponding to the input acoustic samples, and output pattern information is used to characterize the output organization form or output requirements corresponding to the model inference results.

[0088] In this embodiment, by encapsulating scaler data, metadata information, input mode information, and output mode information as feature processing components into a single model package, the single model package to be switched can not only carry the main model data and model type information, but also carry feature processing related content that matches the model inference process. This enables the feature processing and input / output adaptation corresponding to the model to be switched to be completed based on the feature processing components during subsequent model reconstruction and unified inference interface calls.

[0089] Furthermore, in the embodiments of this application, the single model package also includes verification information.

[0090] The verification information is used to perform an integrity check on the single model package to be switched after retrieving it from the model repository.

[0091] Specifically, based on the verification information, it can be determined whether the single model package to be switched is missing, damaged, or has inconsistent content during storage, transmission, or retrieval.

[0092] This application does not limit the specific implementation form of the verification information, as long as it can be used to support the integrity verification of the single model package to be switched.

[0093] In one possible embodiment, the metadata information includes input dimensions, category mapping relationships, feature processing methods, and training configuration information.

[0094] Metadata information is used to record descriptive information related to the acoustic leakage detection model, so as to provide a basis for model loading, input processing and result interpretation during subsequent model reconstruction, warm-up inference and unified inference interface calls.

[0095] Specifically, the input dimension is used to characterize the dimensional information of the input data required by the acoustic leakage detection model; the category mapping relationship is used to characterize the correspondence between the model output category and the actual category identifier; the feature processing method is used to characterize the processing method used when performing feature processing on the input acoustic samples; and the training configuration information is used to characterize the configuration information related to the model training process.

[0096] It should be noted that by recording the input dimension in the metadata information, the system can confirm whether the input data meets the model call requirements before performing inference on the acoustic samples; by recording the category mapping relationship in the metadata information, the system can interpret the result category after the model outputs the inference result; by recording the feature processing method in the metadata information, the system can call the feature processing logic that matches the model to be switched during the model reconstruction and inference process; and by recording the training configuration information in the metadata information, the system can provide the configuration basis corresponding to the training stage for the model reconstruction and model use process.

[0097] In this embodiment, metadata information is encapsulated as part of the feature processing component within a single model package, enabling descriptive information related to model reconstruction and inference to be stored, transmitted, and retrieved along with the single model package. When retrieving the single model package to be switched from the model repository and performing model reconstruction, the input processing, output interpretation, and related configuration content adapted to the current model can be directly determined based on the metadata information, thereby supporting subsequent inference calls of the reconstructed model.

[0098] In one possible embodiment, the method steps shown in S104 can be implemented by S1041 or S1042, and S1041 and S1042 are described in detail below.

[0099] S1041. When the model type information represents the deep learning model, the network topology is restored according to the algorithm identification information and the model parameters are loaded to obtain the reconstructed model.

[0100] When the model type information read from the single model package to be switched indicates that the model to be switched is a deep learning model, the model to be switched is reconstructed using a reconstruction method suitable for deep learning models.

[0101] Specifically, the corresponding network structure template is matched according to the algorithm identification information, and then the model parameters in the single model package to be switched are loaded into the network structure template to obtain the reconstructed model.

[0102] The algorithm identification information is used to characterize the specific algorithm type or network type used in the current deep learning model, so that the model reconstruction module can select the corresponding network structure description method or network structure template according to the algorithm identification information.

[0103] After determining the network structure template corresponding to the algorithm identification information, the network topology of the deep learning model is restored. Restoring the network topology refers to establishing the network structure consisting of each network layer, each computational unit, and the connections between layers, based on the network structure form indicated by the algorithm identification information. In other words, the process of restoring the network topology involves first building the structural framework of the deep learning model so that subsequent model parameters can be loaded into a compatible network structure.

[0104] After restoring the network topology, the corresponding model parameters are further read from the single model package to be switched and loaded into the restored network topology. These model parameters can be parameter data obtained after the deep learning model has been trained, such as parameter data used to characterize network weights, biases, or other internal model parameters; this application does not further limit this. By loading the model parameters into the restored network topology, the network topology can be transformed from a model framework with only structural form into a model object with actual inference capabilities, thereby obtaining the reconstructed model.

[0105] In this embodiment of the application, the single model package to be switched also encapsulates a feature processing component. Therefore, while obtaining the reconstructed model by restoring the network topology and loading the model parameters, the reconstructed model can also be associated with the corresponding feature processing component so that during subsequent warm-up inference and online inference, the input acoustic samples can be processed in a way that is compatible with the current deep learning model based on the feature processing component.

[0106] In this embodiment, when the model to be switched to is a deep learning model, a reconstruction process for the deep learning model is completed based on the model type information and algorithm identification information, thereby obtaining a reconstructed model that can enter the subsequent warm-up inference and verification process.

[0107] S1042. When the model type information represents a traditional machine learning model, the model object is directly deserialized and reconstructed to obtain the reconstructed model.

[0108] When the model type information read from the single model package to be switched indicates that the model to be switched is a traditional machine learning model, a reconstruction method suitable for traditional machine learning models is used to reconstruct the model in the single model package to be switched. Unlike deep learning models, which typically require restoring the network topology before loading model parameters, in traditional machine learning model scenarios, the model objects in the single model package to be switched can be directly deserialized to recover the callable model entities.

[0109] Specifically, model object data corresponding to traditional machine learning models is read from the single model package to be switched, and deserialization processing is performed on the model object data.

[0110] Deserialization is used to restore model object data from its stored state to a runtime, callable model object. In other words, deserialization can restore the contents of a traditional machine learning model stored in a single model package to be switched into a model object that can directly perform inference operations, thereby obtaining a reconstructed model.

[0111] In the embodiments of this application, the traditional machine learning model can be a model constructed using a non-deep learning approach, and this application does not limit its specific algorithm type. Since the single model package to be switched also encapsulates a feature processing component, after performing deserialization reconstruction on the model object to obtain the reconstructed model, the reconstructed model can also be associated with the corresponding feature processing component, so that in the subsequent warm-up inference and unified inference interface call process, feature processing matching the current traditional machine learning model can be performed on the input acoustic sample.

[0112] In this embodiment, when the model to be switched to is a traditional machine learning model, the model reconstruction is completed by direct deserialization, thereby obtaining a reconstructed model that can enter the subsequent warm-up inference and verification process.

[0113] In this embodiment, S1041 and S1042 correspond to two types of model reconstruction paths indicated by different model type information. That is, when the model type information in the single model package to be switched represents a deep learning model, reconstruction is performed using the method shown in S1041, which restores the network topology and loads model parameters; when the model type information in the single model package to be switched represents a traditional machine learning model, reconstruction is performed using the method shown in S1042, which directly deserializes and reconstructs the model object. Through these two types of model reconstruction paths, the system can adopt a reconstruction method adapted to different types of acoustic leakage detection models, thereby obtaining the corresponding reconstructed model, providing a foundation for subsequent pre-heating inference, verification, and hot switching.

[0114] After performing warm-up inference on the reconstructed model and validating the inference results and model structural integrity based on test samples, the method further includes: Perform a health check on the reconstructed model; After the health check is passed, the inference entry point will be switched from the current service model to the reconstruction model.

[0115] In one possible embodiment, after the method step shown in S105, the method further includes Sa1 and Sa2, which are described in detail below.

[0116] Sa1. Perform a health check on the reconstructed model.

[0117] The method steps shown in Sa1 can be executed by the model reconstruction module, the activation management module, or the functional module used to perform model state detection.

[0118] After completing the warm-up inference of the reconstruction model and verifying the inference results and the integrity of the model structure based on test samples, a health check is further performed on the reconstruction model.

[0119] Among them, the health check is used to further confirm whether the current running status of the reconstruction model meets the online requirements before the reconstruction model enters the actual switchover process.

[0120] In this embodiment of the application, the health check can be performed after the reconstruction model has completed preheating inference and verification, and the object of the check is the callable state of the reconstruction model in the current running environment.

[0121] Specifically, health checks can be used to confirm whether the reconstructed model can maintain a normal loading state in the current operating environment, whether it can respond to subsequent inference calls, and whether it meets the basic conditions for entering the hot-switching phase. This application does not limit the specific implementation of the health check, as long as it can be used to determine whether the reconstructed model is suitable for entering the subsequent inference entry switching phase.

[0122] Furthermore, in this embodiment, the health check can form a continuous pre-deployment check process with the aforementioned warm-up inference and verification. The warm-up inference and verification are mainly used to confirm the inference results and structural integrity of the reconstructed model, while the health check is further used to confirm the serviceability of the reconstructed model in the current operating environment. In other words, the health check further confirms whether the reconstructed model is suitable as a subsequent activation model, assuming it already possesses basic inference capabilities.

[0123] In this embodiment, by performing a pre-launch status check on the reconstructed model before switching the model, a basis for judgment is provided for subsequently switching the inference entry point to the reconstructed model.

[0124] Sa2. After the health check is passed, the inference entry point will be switched from the current service model to the reconstruction model.

[0125] The method steps shown in Sa2 can be executed by the hot-switching control module.

[0126] The inference entry point refers to the call entry point used to receive inference calls forwarded by the unified inference interface and point to the specific model object that performs the inference.

[0127] When the health check result of the reconstructed model is passed, the inference entry switching operation is performed, switching the inference entry from the current service model to the reconstructed model. Subsequent inference requests received through the unified inference interface will no longer be processed by the original current service model, but by the reconstructed model that has been reconstructed through S104, verified by S105, and passed the Sa1 health check.

[0128] If the health check result of the reconstructed model indicates that the health check has failed, the inference entry switching operation is not performed, and the method steps shown in S107 are executed.

[0129] In one possible embodiment, the method steps shown in Sa2 can be implemented by Sa21 to Sa24, which are described in detail below.

[0130] Sa21. Register multiple versions of a single model package in the model repository.

[0131] The method steps shown in Sa21 can be executed by the model repository or a management module that interacts with the model repository. To support subsequent model switching based on different model versions, multiple versions of a single model package are pre-registered in the model repository. Specifically, for single model packages generated at different training stages, different algorithm iteration stages, or different release times, corresponding version registration records are established in the model repository, enabling multiple single model packages to be stored and managed in a distinguishable manner within the same model repository.

[0132] In this embodiment, multiple versions of a single model package correspond to different version information and are associated with their respective algorithm identifiers, model type information, or storage locations. By registering multiple versions of the single model package, the model repository not only stores the single model package itself but also the version identifier used to distinguish different single model packages. This facilitates the identification of the single model package to be switched from multiple versions when a model switching instruction is received.

[0133] Sa22. Upon receiving the model switching instruction, determine the single model package to be switched based on the model switching instruction.

[0134] The steps shown in Sa22 can be executed by the activation management module or the hot-swap control module. When the system receives a model switching instruction, it does not switch any single model package in the model repository, but instead determines the single model package to be switched from among the multiple registered versions of single model packages based on the model switching instruction.

[0135] Specifically, the model switching instruction can carry indication information to indicate the target switching object. The system can retrieve and locate the corresponding single model package in the model repository based on the indication information, and determine the single model package to be switched.

[0136] In this embodiment, when multiple versions of the model coexist, the model switching process can be explicitly directed to a specific target single model package, thereby giving the subsequent switching process a clear target.

[0137] Sa23. While the current service model is continuously responding to inference requests, perform parallel reconstruction and warm-up on the single model package to be switched.

[0138] The method steps shown in Sa23 can be executed collaboratively by the model reconstruction module and the hot-swap control module. Unlike the approach of stopping the current service model before loading the new model, in this embodiment, the current service model continuously responds to external inference requests throughout the preparation process of the model to be switched, while the single model package to be switched performs model reconstruction and warm-up in a processing path parallel to the current service path. In other words, the current service model continues to undertake online inference tasks, while the single model package to be switched completes its pre-launch preparation in the background, thus forming a parallel processing relationship.

[0139] In this embodiment, parallel reconstruction and warm-up include: performing model reconstruction on the single model package to be switched to obtain a reconstructed model; and performing warm-up inference on the reconstructed model so that the reconstructed model is ready to run before officially taking over the inference entry point. Since the current service model continuously responds to inference requests during this process, the external caller does not need to wait for the model to be switched to complete its preparation to continue to obtain inference services during this stage.

[0140] In this embodiment, the preparation process of the model to be switched can be carried out in parallel with the online service process of the current service model, thereby separating the model preparation process from the online service process.

[0141] Furthermore, before parallel reconstruction and warm-up are completed, the inference entry point remains directed to the current service model, and the reconstructed model corresponding to the single model package to be switched does not directly provide inference services. That is, in the Sa23 phase, the model to be switched is in a ready state rather than an active state; its role is to provide a prepared candidate model for subsequent inference entry switching. This approach allows the model to be switched to complete pre-deployment preparation without affecting existing online inference.

[0142] Sa24. After parallel reconstruction and preheating are completed, the inference entry point is switched to the reconstruction model by atomic replacement of the activation model pointer, and the reconstruction model is set as the activation model.

[0143] The steps shown in Sa24 can be executed by the hot-switching control module. After the parallel reconstruction and warm-up of the single model package to be switched are completed, the inference entry switching operation is performed. Specifically, atomic replacement of the activation model pointer refers to switching the activation model pointer used to identify the current actual inference execution object from pointing to the current service model to pointing to the reconstructed model in a single switching action. This method ensures that the object pointed to by the inference entry is updated at the time of switching.

[0144] In this embodiment, after the inference entry point is switched to the reconstructed model, subsequent inference requests entering through the unified inference interface will be handled by the reconstructed model, instead of the original current service model. Simultaneously, after replacing the active model pointer, the reconstructed model is set as the active model, thus making the reconstructed model the actual inference object for subsequent unified inference interface calls.

[0145] Figure 4 This is a schematic flowchart illustrating another method for encapsulating, reconstructing, and hot-switching an acoustic leakage detection model, provided in an embodiment of this application. Figure 4As shown, the hot-switching and automatic rollback process in this embodiment includes: receiving a model switching instruction; pulling the single model package to be switched; performing parallel reconstruction and preheating on the single model package to be switched; after the parallel reconstruction and preheating are completed, switching the inference entry to the reconstructed model by atomically replacing the activation model pointer; before the reconstructed model is switched, the current service model continues to respond to inference requests; when any step in the parallel reconstruction, preheating, verification, health check, or switching process fails, the activation of the reconstructed model is terminated, and the current service model continues to provide inference services as the activated model, thereby forming a time sequence process in which a successful hot-switching path and a failed rollback path coexist.

[0146] In one possible embodiment, if any step in the process of acquiring, verifying, rebuilding, warming up, validating, health checking, or switching the single model package to be switched fails, the activation of the rebuilt model is terminated, and the current service model is kept as the activated model to continue providing inference services.

[0147] Specifically, during the process of acquiring, verifying integrity, verifying availability, rebuilding the model, performing warm-up inference, verifying the integrity of inference results and model structure, conducting health checks, and switching the inference entry point for the single model package to be switched, if any of the processing steps fails to meet the preset requirements, the model to be switched is determined to not meet the conditions for entering the activation state. In this case, the process of launching the model to be switched will not continue, and a failure handling procedure will be executed instead.

[0148] In this embodiment, failure at any stage can be understood as: failing to correctly obtain the target model package during the acquisition of the single model package to be switched; determining that the single model package to be switched does not meet the requirements for subsequent processing during integrity verification and availability verification; or encountering situations during model reconstruction, pre-warm-up inference, verification, health check, and inference entry switching that prevent the reconstructed model from entering a normal service state. This application does not further limit the specific conditions for determining failure; any failure that would cause the model to be switched to fail to meet the online conditions can trigger the failure handling mechanism of this embodiment.

[0149] In this embodiment, if any step fails, the subsequent processing of setting the reconstructed model as the activated model is stopped, or the activation process that has started but not yet been completed is canceled, so that the reconstructed model does not enter the state of actually providing inference services. In other words, even if some model preparation processing has been completed in the aforementioned steps, if any necessary step before final launch fails, the reconstructed model will not be put into use as a new service model.

[0150] While terminating the activation of the reconstructed model, the current service model remains the active model, continuing to provide inference services. In other words, if the model to be switched fails to meet the deployment requirements, the system does not change the actual service object corresponding to the current inference entry point; the inference entry point continues to be handled by the current service model, which is already in service. Since the current service model was already capable of processing external inference requests before this switchover process began, maintaining the current service model as the active model ensures that the unified inference interface can continue to output inference results based on this current service model, even if the model to be switched fails.

[0151] Furthermore, the failure handling mechanism in this embodiment can work in conjunction with the aforementioned warm-up inference, verification, health check, and hot-swap processes. That is, the aforementioned steps are used to confirm whether the model to be switched meets the conditions for entering the service state, while the failure handling mechanism in this embodiment is used to prevent the rebuilt model from entering the active state and maintain the current service model to continue undertaking online inference tasks when the confirmation result does not meet the requirements. Through this processing method, the preparation process of the model to be switched is clearly separated from the existing online service process in terms of control: the current service model is responsible for continuously providing external services, and the model to be switched only enters the active state after all online conditions are met; otherwise, it never replaces the current service model.

[0152] In this embodiment, by setting the aforementioned failure handling mechanism, the model switching process can have a fallback control path for failure. Specifically, when the model to be switched does not meet the online conditions, there is no actual service switch where the rebuilt model takes over from the current service model. Instead, the existing active model remains unchanged, so that the acoustic samples received by the unified inference interface are still processed by the current service model. This isolates the failure of the model to be switched from the interruption of the online inference service, meaning that the failure of the model to be switched will not directly lead to the loss of inference service objects.

[0153] In one possible embodiment, the method steps shown in S108 can be implemented by Sc1 to Sc3, which are described in detail below.

[0154] Sc1 receives samples from the leak detector or the monitoring device through the unified inference interface.

[0155] The method steps shown in Sc1 can be executed by a unified inference interface. Unlike the approach of setting independent inference entry points for samples from different device sources, the unified inference interface in this embodiment serves as a unified access channel for acoustic samples to enter the model inference process.

[0156] Specifically, the unified inference interface can receive samples from both the listening device and the monitoring device, allowing acoustic samples from different sources to enter the subsequent processing flow through the same inference entry point.

[0157] In this embodiment, the leak detector sample and the monitoring instrument sample can be understood as two types of acoustic samples from different source devices. Since the two types of samples may differ in data organization, data length, feature arrangement, or other input attributes, the unified inference interface can first identify whether the currently received acoustic sample belongs to the leak detector sample or the monitoring instrument sample when receiving samples, so as to perform input adaptation processing corresponding to the sample in combination with the input mode information.

[0158] Sc2: Input the leak detector sample or monitoring instrument sample into the activation model for inference based on the input pattern information.

[0159] The method steps shown in Sc2 can be executed collaboratively by a unified inference interface and an activation model. After the unified inference interface receives a sample from a listening leak detector or a monitoring device, it does not directly and indiscriminately send the raw received data into the activation model. Instead, it first determines the input organization method that is compatible with the current acoustic sample based on the input pattern information, and then inputs the adapted sample into the activation model for inference.

[0160] In this embodiment, input pattern information is used to characterize the requirements of the activation model on the form of input data during inference. Specifically, input pattern information can be used to indicate the input organization, input structure, or input constraint that acoustic samples should satisfy before being input into the activation model. This application does not limit the specific expression of the input pattern information, as long as it can be used to instruct the unified inference interface how to organize the currently received listening device samples or monitoring device samples into an input form that is compatible with the activation model.

[0161] Furthermore, in this embodiment, when the currently received acoustic sample is a leak detector sample, the unified inference interface can organize the leak detector sample into an input format that is compatible with the activation model based on the input mode information and then input it into the activation model; when the currently received acoustic sample is a monitoring instrument sample, the unified inference interface can organize the monitoring instrument sample into an input format that is compatible with the activation model based on the input mode information and then input it into the activation model.

[0162] In this embodiment, the unified inference interface can still convert acoustic samples from different sources into an input format that the current activation model can process, thereby supporting the activation model to perform inference on samples from different sources.

[0163] Sc3: Output inference results based on output pattern information.

[0164] The steps shown in Sc3 can be executed by the unified inference interface. After the activation model completes the inference for the leak detector sample or the monitoring instrument sample, the corresponding inference result is obtained. At this time, the unified inference interface does not directly output the original output content generated by the activation model, but performs output-related organizational processing on the inference result based on the output pattern information before outputting it.

[0165] In this embodiment, output pattern information is used to characterize the output organization form or output requirements of the inference results. Specifically, output pattern information can be used to indicate how to organize, transform, or encapsulate the inference results obtained from the activated model, so that the output results meet the output form adopted by the unified inference interface when providing results externally. This application does not limit the specific expression form of the output pattern information, as long as it can be used to guide the unified inference interface to organize and output the inference results output by the activated model.

[0166] Furthermore, in this embodiment, for inference results from samples from the listening device, the unified inference interface can organize them into a preset output format based on the output mode information before outputting them; for inference results from samples from the monitoring device, the unified inference interface can also organize them into a preset output format based on the output mode information before outputting them. Thus, despite differences in the sources of input samples, the unified inference interface can still perform unified output processing on the inference results generated by the activated model based on the output mode information.

[0167] In this embodiment, the inference results output by the unified inference interface can have a consistent output organization, so that the external caller can obtain the inference results through the unified interface without having to adapt different output formats for samples from different sources.

[0168] In the above embodiments, the model repository can be implemented using object storage, a file system, or a model registry; when the hot switching control module performs model switching, it can adopt a double-buffered switching strategy, a blue-green switching strategy, or a canary switching strategy; integrity verification and availability verification can include at least one of hash verification, structure verification, and sample regression verification; the acoustic leakage detection model can include deep learning models and traditional machine learning models, and can also be extended to adapt to model frameworks such as XGBoost and LightGBM, which is not limited in this application.

[0169] Figure 5 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Figure 5 As shown, the electronic device 500 provided in this embodiment includes a memory 501 and a processor 502.

[0170] The memory 501 can be a separate physical unit, connected to the processor 502 via a bus 503. Alternatively, the memory 501 and processor 502 can be integrated and implemented in hardware. The memory 501 stores program instructions, which the processor 502 calls to execute the operations performed by the acoustic leakage detection model encapsulation reconstruction and hot-switching system in any of the above method embodiments.

[0171] Optionally, when some or all of the methods in the above embodiments are implemented by software, the electronic device 500 may also include only the processor 502. A memory 501 for storing programs is located outside the electronic device 500, and the processor 502 is connected to the memory via circuits / wires to read and execute the programs stored in the memory. The processor 502 may be a central processing unit (CPU), a network processor (NP), or a combination of a CPU and an NP. The processor 502 may further include a hardware chip. The hardware chip may be an application-specific integrated circuit (ASIC), a programmable logic device (PLD), or a combination thereof. The PLD may be a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL), or any combination thereof.

[0172] The memory 501 may include volatile memory, such as random-access memory (RAM); the memory may also include non-volatile memory, such as flash memory, hard disk drive (HDD) or solid-state drive (SSD); the memory may also include a combination of the above types of memory.

[0173] For example, this application provides a chip including: an interface circuit and a logic circuit. The interface circuit is used to receive signals from other chips outside the chip and transmit them to the logic circuit, or to send signals from the logic circuit to other chips outside the chip. The logic circuit is used to perform the operations performed by the acoustic leakage detection model packaging reconstruction and hot switching system in the above method embodiments.

[0174] For example, this application provides a computer-readable storage medium storing computer program instructions thereon, which are executed by the processor of an electronic device to cause the electronic device to perform the operations performed by the acoustic leakage detection model encapsulation reconstruction and hot-switching system in the above method embodiments.

[0175] For example, this application provides a computer program product that, when run on an electronic device, causes the electronic device to perform the operations performed by the acoustic leakage detection model encapsulation reconstruction and hot-switching system in the above method embodiments.

[0176] The above description is merely a specific embodiment of this application, enabling those skilled in the art to understand or implement this application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this application. Therefore, this application is not to be limited to the embodiments described herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A method for encapsulating, reconstructing, and hot-switching an acoustic leakage detection model, characterized in that, The method includes: The trained acoustic leakage detection model is packaged into a single model package, which includes the main model data, model type information, and feature processing components. Algorithm identification information and version information are written into the single model package. Upload the single model package to the model repository and register its version. In response to a model switching command, the system retrieves the single model package to be switched from the model repository and performs integrity and availability checks on the single model package to be switched. The corresponding model reconstruction method is determined based on the model type information and algorithm identification information in the single model package to be switched, and the model reconstruction is performed in combination with the model main data and feature processing components in the single model package to be switched to obtain the reconstructed model. A warm-up inference was performed on the reconstructed model, and the inference results and the integrity of the model structure were verified based on test samples. After verification, while the current service model continues to provide services to the outside world, the inference entry point is switched from the current service model to the reconstructed model by atomically replacing the activation model pointer, and the reconstructed model is set as the activation model. When verification fails or the switching process fails, the current service model is retained as the active model to continue providing inference services. Acoustic samples are received through a unified inference interface, the activation model is invoked to perform inference, and the inference results are output.

2. The method according to claim 1, characterized in that, The feature processing component includes scaler data, metadata information, input mode information, and output mode information; The single model package also includes verification information.

3. The method according to claim 2, characterized in that, The metadata information includes input dimensions, category mapping relationships, feature processing methods, and training configuration information.

4. The method according to claim 1, characterized in that, The step of determining the corresponding model reconstruction method based on the model type information and algorithm identification information in the single model package to be switched, and performing model reconstruction in combination with the model main data and feature processing components in the single model package to be switched, to obtain the reconstructed model, includes: When the model type information represents a deep learning model, the network topology is restored according to the algorithm identification information and the model parameters are loaded to obtain the reconstructed model; When the model type information represents a traditional machine learning model, the model object is directly deserialized and reconstructed to obtain the reconstructed model.

5. The method according to claim 4, characterized in that, The step of restoring the network topology based on the algorithm identifier information and loading model parameters to obtain the reconstructed model includes: Match the corresponding network structure template based on the algorithm identification information; The model parameters in the single model package to be switched are loaded into the network structure template to obtain the reconstructed model.

6. The method according to claim 1, characterized in that, After performing warm-up inference on the reconstructed model and verifying the inference results and model structural integrity based on test samples, the method further includes: Perform a health check on the reconstructed model; After the health check is passed, the inference entry point will be switched from the current service model to the reconstructed model.

7. The method according to claim 6, characterized in that, Switching the inference entry point from the current service model to the reconstructed model includes: Register multiple versions of a single model package in the model repository; Upon receiving the model switching instruction, the single model package to be switched is determined based on the model switching instruction; While the current service model is continuously responding to inference requests, parallel reconstruction and warm-up are performed on the single model package to be switched. After the parallel reconstruction and preheating are completed, the inference entry is switched to the reconstructed model by atomically replacing the activation model pointer, and the reconstructed model is set as the activation model.

8. The method according to claim 7, characterized in that, If any step in the process of acquiring, verifying, rebuilding, warming up, validating, health checking or switching the single model package to be switched fails, the activation of the rebuilt model is terminated, and the current service model is kept as the activated model to continue providing inference services.

9. The method according to claim 2, characterized in that, The process of receiving acoustic samples through a unified inference interface, calling the activation model to perform inference, and outputting the inference result includes: Receive leak detection instrument samples or monitoring instrument samples through the unified inference interface; Based on the input pattern information, the leak detector sample or the monitoring instrument sample is input into the activation model for inference; The reasoning result is output based on the output pattern information.

10. An acoustic leakage detection model encapsulation, reconstruction, and hot-switching system, characterized in that, The system includes: The unified model encapsulation module is used to encapsulate the main model data, model type information and feature processing components corresponding to the trained acoustic leakage detection model into a single model package, and write algorithm identification information and version information into the single model package; A model repository is used to store the single model package and register its version. The activation management module is used to respond to model switching commands, retrieve the single model package to be switched from the model repository, and perform integrity and availability checks on the single model package to be switched. The model reconstruction module is used to determine the corresponding model reconstruction method based on the model type information and algorithm identification information in the single model package to be switched, and to perform model reconstruction in combination with the model main data and feature processing components in the single model package to be switched to obtain a reconstructed model; and to perform pre-warm-up inference on the reconstructed model, and to verify the inference results and model structural integrity based on test samples. The hot-switching control module is used to switch the inference entry point from the current service model to the reconstructed model by atomically replacing the activation model pointer after successful verification, while the current service model continues to provide services externally; and to set the reconstructed model as the activation model when verification fails or the switching process fails. A unified inference interface is used to receive acoustic samples, call the activation model to perform inference, and output the inference results.