Offline model application method, electronic equipment, storage medium and product
By deploying offline model libraries on mobile terminals and directly using local models for inference, the problem of low model application efficiency in environments with resource constrained and network instability is solved, and efficient model inference and improved user experience is achieved.
Patent Information
- Application Number
- CN202510503610.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-22
- Publication Date
- 2025-05-23
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
In an environment where resource constraints and network instability, the model application efficiency is low, resulting in a decrease in inference speed or inability to proceed.
Provide an offline model application method, by deploying offline model libraries on mobile terminals, directly using local models for inference, avoiding data transmission and network dependence. The method includes receiving a building defect detection request, determining business requirements, selecting a target model from the offline model library, identifying the detection data, and outputting defect recognition results.
It significantly reduces inference delay, improves inference speed, ensures that the model inference function is used normally in environments with poor networks, and reduces model startup or loading time, improving user experience.
Smart Images

Figure CN120032117A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of model application technology, and in particular to an offline model application method, system, electronic device, storage medium and computer program product. Background Art
[0002] Driven by the rapid development of artificial intelligence technology, more and more applications require AI reasoning on mobile terminals, such as image recognition, speech recognition, and natural language processing. Traditional cloud deployment methods rely on network connections for data transmission and reasoning, which results in a significant decrease in reasoning speed or even inability to perform reasoning in scenarios with limited network environments such as construction sites. Even if the AI model is deployed directly to the terminal device, the accuracy and real-time performance of defect identification will be reduced due to the limitations of terminal computing resources and memory space, thereby affecting the user experience. Therefore, how to improve the efficiency of model application in mobile terminals under resource-constrained and network-instable environments is an urgent problem to be solved. Summary of the invention
[0003] The main purpose of this application is to provide an offline model application method, system, electronic device, storage medium and computer program product, aiming to solve the technical problem of low model application efficiency in mobile terminals under resource-constrained and network-instable environments.
[0004] To achieve the above objectives, the present application proposes an offline model application method, which is applied to a mobile terminal, comprising: Receiving a building defect detection request and data to be detected, and determining a business requirement corresponding to the building defect detection request; A target model corresponding to the business requirement is selected from the offline model library of the mobile terminal, and the data to be detected is identified by the target model to obtain a defect identification result, and the defect identification result is output.
[0005] In one embodiment, after the step of determining the business requirement corresponding to the building defect detection request, the method further includes: Acquire an offline data packet corresponding to the business requirement from an offline data packet set, and parse the offline data packet to obtain a page resource and a model transmission interface corresponding to the business requirement; A target page for implementing the business requirement is rendered based on the page resources, and the target page includes the model transmission interface, and the model transmission interface is used to input the data to be detected into the target model and return the defect identification result generated by the target model.
[0006] In one embodiment, the data to be detected includes a construction site image, and the step of selecting a target model corresponding to the business requirement from an offline model library of the mobile terminal, and identifying the data to be detected by using the target model to obtain a defect identification result includes: Based on the construction scenario corresponding to the business demand, determining a model label in the offline model library that matches the construction scenario, wherein the offline model library stores a construction defect detection model applied to each construction scenario; Using the construction defect detection model associated with the model label as the target model; The construction site image is input into the target model to identify the type of building defects in the construction site image and obtain a defect identification result.
[0007] In one embodiment, the step of selecting a target model corresponding to the business requirement from the offline model library of the mobile terminal includes: Retrieving a target model corresponding to the business requirement from the offline model library; If the target model is not found, detecting whether the network connection between the mobile terminal and the preset server is normal; When the network connection is normal, a model that implements the business requirement is obtained from a preset server and stored in the offline model library as the target model.
[0008] In one embodiment, the offline model application method further includes: For any model in the offline model library, obtaining a model version corresponding to the model on a preset server side; In the case where the model version is inconsistent with the model corresponding version, determining the update type of the model; In the case where the update type is an incremental update, downloading an incremental update package of the model, and updating the model through the incremental update package; In case the update type is a complete update, a complete update package of the model is downloaded, and the model is updated using the complete update package.
[0009] In one embodiment, the offline model application method further includes: When the update package is complete, if the model before the update is being used to perform the reasoning task, the reasoning task is stopped, the model before the update is replaced with the updated model, and the reasoning task is re-executed using the updated model, wherein the update package includes the incremental update package and the complete update package; In the case that the update package is incomplete, the update package is deleted, and the updated model is rolled back to the model before the update.
[0010] In one embodiment, the offline model application method further includes: Determine a user preference model in the offline model library according to the user's usage habits; When the mobile terminal is in an idle state or the network connection between the mobile terminal and the preset server is normal, the user preference model is preloaded in the background of the mobile terminal.
[0011] In addition, to achieve the above purpose, the present application also proposes an offline model application system, which is applied to a mobile terminal and includes: A demand determination module is used to receive a building defect detection request and data to be detected, and determine the business demand corresponding to the building defect detection request; The model application module is used to select a target model corresponding to the business requirement from the offline model library of the mobile terminal, identify the data to be detected through the target model to obtain a defect identification result, and output the defect identification result.
[0012] In addition, to achieve the above-mentioned purpose, the present application also proposes an electronic device, which includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the offline model application method described above.
[0013] In addition, to achieve the above-mentioned purpose, the present application also proposes a storage medium, which is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by the processor, the steps of the offline model application method described above are implemented.
[0014] In addition, to achieve the above-mentioned purpose, the present application also provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, it implements the steps of the offline model application method described above.
[0015] The present application provides an offline model application method, which is applied to a mobile terminal, including: receiving a building defect detection request and data to be detected, and determining the business requirements corresponding to the building defect detection request; selecting a target model corresponding to the business requirements from an offline model library of the mobile terminal, and identifying the data to be detected through the target model to obtain a defect identification result, and outputting the defect identification result.
[0016] The present application receives a building defect detection request input by a user, determines the corresponding business demand, selects a target model that can handle the business demand from the offline model library built into the mobile terminal, and uses the target model to reason about the data to be detected, and finally outputs the defect recognition result. Since the offline model library is deployed on the mobile terminal, the local model can be directly used for reasoning, the computing resources of the terminal device are fully utilized, the data transmission between the terminal and the cloud is avoided, the reasoning delay is significantly reduced, and the reasoning speed is improved. In this way, the normal use of the model reasoning function can be guaranteed even in a poor network environment such as a construction site, and when the model is started for the first time or the model is loaded, the local model can be directly deployed and reasoned, thereby reducing the time for model startup or loading, and improving the user experience; by selecting the corresponding target model for reasoning according to the business demand, only the model that can meet the business demand needs needs to be called in the memory, without calling a large model containing complete functions, when the construction site needs to identify the type of building defects at the construction site, the corresponding defect recognition model can be called to meet the recognition task requirements, and at the same time, only the computing resources corresponding to the model need to be used during reasoning, which improves the efficiency of model reasoning, reduces resource occupation, and improves the user experience. Compared with related solutions that need to rely on cloud servers, resulting in higher inference delays, and the limited computing resources of terminal memory affect the defect identification results, this solution can improve the model application efficiency of mobile terminals in resource-constrained and network-instable environments through offline model deployment and on-demand use. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0018] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0019] Figure 1 A flowchart of the first embodiment of the offline model application method of the present application is provided; Figure 2 A model validation flow chart provided for the offline model application method of this application; Figure 3 A flow chart of the second embodiment of the offline model application method of the present application; Figure 4 A model update flow chart provided for the offline model application method of this application; Figure 5A model replacement flow chart provided for the offline model application method of this application; Figure 6 A schematic diagram of a scenario provided for the offline model application method of this application; Figure 7 The overall flow chart provided for the offline model application method of this application; Figure 8 This is a schematic diagram of the module structure of the offline model application system of the embodiment of the present application; Fig. 9 A schematic diagram of the device structure of the hardware operating environment involved in the offline model application method in the embodiment of the present application.
[0020] The purpose, features and advantages of this application will be further described in conjunction with the embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0021] It should be understood that the specific embodiments described herein are only used to explain the technical solutions of the present application and are not used to limit the present application.
[0022] In order to better understand the technical solution of the present application, a detailed description will be given below in conjunction with the accompanying drawings and specific implementation methods.
[0023] The embodiment of the present application is applied to a mobile terminal, and the main solution is: receiving a building defect detection request and data to be detected, determining the business requirements corresponding to the building defect detection request; selecting a target model corresponding to the business requirements from an offline model library of the mobile terminal, and identifying the data to be detected through the target model to obtain a defect identification result, and outputting the defect identification result.
[0024] In this embodiment, for the convenience of description, the following description is made with the mobile terminal as the execution subject.
[0025] Since existing technologies usually rely on cloud servers and transmit data through the network for inference, a stable network connection is required. In environments with poor network environments such as construction sites, the inference speed will be seriously affected or even unusable. In addition, both data transmission and inference calculations take time, resulting in high inference latency, which cannot meet application scenarios with high real-time requirements. At the same time, users' sensitive data needs to be uploaded to cloud servers for processing, which poses a risk of data leakage. If the AI model is deployed directly on the terminal device, large AI models will occupy a large amount of memory when in use, resulting in tight device resources. In addition, the traditional AI model update method requires reinstalling the entire application, which is a cumbersome and inefficient process. In addition, existing mobile AI applications generally take a long time to start or load models for the first time, affecting the user experience.
[0026] The present application provides a solution that directly uses the local model for reasoning, fully utilizes the computing resources of the terminal device, avoids the transmission of data between the terminal and the cloud, significantly reduces the reasoning delay, improves the reasoning speed, and selects the corresponding target model for local reasoning according to business needs. Not only does it only need to use the model that can meet the business needs, but there is no need to call a complete large model with multiple functions. It also protects data privacy and improves data security. At the same time, only the computing resources corresponding to the model need to be used during reasoning, which improves the efficiency of model reasoning and reduces resource usage. When the model is started for the first time or loaded, the local model can be directly deployed and reasoning can be performed, thereby reducing the time for model startup or loading and improving the user experience.
[0027] It should be noted that the execution subject of this embodiment can be a mobile terminal with data processing, network communication and program running functions, such as a tablet computer, a personal computer, a mobile phone, etc., or an electronic device capable of realizing the above functions, an offline model application system, etc. The following takes a mobile terminal as an example to illustrate this embodiment and the following embodiments.
[0028] Based on this, the present application embodiment provides an offline model application method, referring to Figure 1 , Figure 1 This is a flow chart of the first embodiment of the offline model application method of the present application.
[0029] In this embodiment, applied to a mobile terminal, the offline model application method includes steps S01-S02: Step S01, receiving a building defect detection request and data to be detected, and determining a business requirement corresponding to the building defect detection request; It should be noted that the mobile terminal may refer to a portable device with computing, storage and communication capabilities, such as a smart phone, a tablet computer, etc. The mobile terminal receives a building defect detection request input by a user through interface operation or voice command, etc. The building defect detection request includes a specific AI reasoning task that the user wants to perform, which may be to identify specific building defects at the construction site, such as cracks, holes, etc. At the same time, the user will also input the data to be detected, that is, the original data that needs to be AI reasoned, which may be an image of the construction site, such as photos taken of the ground, wall skin, etc. After receiving these inputs, the mobile terminal parses the building defect detection request, which carries the key information input by the user (such as the page clicked by the user and the page button clicked, etc.), matches the key information with the preset business requirements, determines the corresponding business requirements, and thus determines which model should be used for reasoning, wherein the business requirements refer to the detection and identification of the building defect types at the construction site that the user wants to achieve through AI reasoning, such as the identification of specific building defects, including the identification of cracks, holes, etc.
[0030] It is understandable that since the traditional solution relies on cloud servers for model reasoning, it has high latency, which affects the reasoning speed and may also lead to failure of request parsing due to unstable network environment. Therefore, step S01 is performed, and the mobile terminal can directly receive and parse the building defect detection request and data to be detected input by the user, and quickly determine the corresponding business needs. This localized processing reduces network dependence, avoids the impact of network delays and instability, improves the efficiency and accuracy of request parsing, and when the model is started for the first time or loaded, since the local model can be directly deployed and reasoned, the time for model startup or loading can be reduced, thereby improving the user experience.
[0031] Step S02: Select a target model corresponding to the business requirement from the offline model library of the mobile terminal, identify the data to be detected through the target model to obtain a defect identification result, and output the defect identification result.
[0032] It should be noted that after determining the business needs, the mobile terminal will search and select the target model that can achieve the business needs from its built-in offline model library. The offline model library is pre-deployed on the mobile terminal and contains a variety of models for different business needs, such as models for identifying cracks, models for identifying wall holes, etc. These models are quantized (converting the weights and activation values of the AI model from floating point numbers to integers to reduce the model size and computational complexity) and pruned (removing unimportant connections and neurons in the AI model to reduce the number of model parameters and computational complexity) to adapt to the memory and computing resource limitations of the mobile terminal while maintaining high inference accuracy and real-time performance. After selecting the target model, the mobile terminal will load it into the memory and input the data to be detected into the model. The model processes and analyzes the input data to be detected and finally outputs the defect recognition result, which includes the identification of the type of building defects at the construction site.
[0033] It is understandable that since the traditional solution directly loads the complete AI model into the terminal memory when performing reasoning tasks, it leads to insufficient model computing resources, thus affecting the accuracy and real-time performance of the defect identification results. Therefore, step S02 is performed, and the mobile terminal quickly selects and loads the target model that realizes the business needs from its built-in offline model library. These models are optimized and tailored to adapt to the memory and computing resource limitations of the mobile terminal. By reasoning the data to be inspected through the target model, the mobile terminal can output accurate and real-time defect identification results, which not only reduces the model's occupancy of terminal memory resources and improves the accuracy and real-time performance of reasoning, but also reduces the storage space occupied by optimizing and tailoring the model structure.
[0034] In a feasible implementation manner, in step S01, after the step of determining the business requirements corresponding to the building defect detection request, steps A01 to A02 are further included: Step A01, acquiring offline data packets corresponding to business requirements from offline data packets, and parsing the offline data packets to obtain page resources and model transmission interfaces corresponding to the business requirements; It should be noted that before determining to call the model, the mobile terminal searches for offline data packages that match the business requirements from its built-in offline data package set. The offline data package set is a collection that contains offline data packages corresponding to various business requirements. Each offline data package has been optimized to adapt to the storage and computing capabilities of the mobile terminal. These resources are packaged together for fast loading when needed. The offline data package corresponding to the business requirement is parsed, and the page resources and model transmission interface required to implement the business requirement are extracted from it. The page resources usually include files such as HTML, CSS, and JavaScript, which define the appearance and interaction logic of the user interface. The model transmission interface is a defined interface for transmitting data between the user interface and the target model.
[0035] In addition, it should be noted that if the offline data package corresponding to the service requirement is not found in the offline data package set, the mobile terminal will download the required page resources from the server and save them to the local offline data package set for subsequent use.
[0036] In addition, it should be noted that if an APP includes one service, then the APP corresponds to one offline data package. If an APP includes multiple services, then the APP corresponds to multiple offline data packages, that is, each service type corresponds to an offline data package, and the offline data package includes the page resources of the page corresponding to the service type. The page resources here include HTML pages, static resource files, page search files, activity page files, etc.
[0037] Step A02, rendering a target page that meets business requirements based on page resources, the target page includes a model transmission interface, the model transmission interface is used to input the data to be detected into the target model, and return the defect recognition result generated by the target model.
[0038] It should be noted that after obtaining the page resources in step A01, the target page of the business requirement is realized through the Hybrid App rendering in combination with the page resources, and the NS URL Protocol (URL loading system) and NS URLProtocolClient (URL loading system client) are used to realize the Hybrid App to load the target page stored in the local disk. This page is the interface for the user to interact with the system. Hybrid App is a mobile application that combines the characteristics of native applications (Native App) and Web applications (Web App). It can call the local functions and hardware of the device and can also run on multiple platforms, such as iOS, Android and Windows. After obtaining the page resources, the corresponding HTML, CSS and JavaScript files in the page resources are embedded in the Web View (Web View) of the Hybrid App to realize the loading of the page.
[0039] In addition, it should be noted that in the process of rendering the target page, a model transmission interface is embedded in the page. In this way, when the user interacts with the page (such as clicking the photo button), the page can send the data to be detected (such as the picture obtained by taking the photo) to the target model for reasoning through the model transmission interface. After the target model completes the reasoning, it will return the defect recognition result (such as the recognized face information) to the page through the model transmission interface. After receiving the defect recognition result, the page will display it to the user according to the preset logic (such as displaying the recognized face information on the page).
[0040] Additionally, it should be noted that the offline data packet also contains AI model-related resources, such as model files (e.g., the.pb file of TensorFlow, the.pth file of PyTorch), model configuration files, and code related to model loading and preprocessing. To enable the JavaScript code in the Hybrid App to call the native AI model inference function of the terminal device, an interface can be defined in the native code of the terminal device to receive the data to be detected passed by the JavaScript code, and call the local A1 model for inference. This interface is registered in the WebView so that it can be called by the JavaScript code. In the JavaScript code, the native interface can be called through the interface provided by the WebView, and the data to be detected is passed to it for inference. For example, on the Android platform, the WebView.addJavascriptinterface() method can be used to register the native interface in the WebView. On the iOS platform, the WKScriptMessageHandler protocol can be used to achieve communication between the JavaScript code and the native code.
[0041] Additionally, it should be noted that when loading the Web view for the inference task, it can be accelerated through WebGL / WASM, significantly improving the front-end inference speed, avoiding the performance bottleneck of pure CPU computing, and reducing the mobile inference time. Among them, WebGL is a JavaScript API for rendering high-performance 2D and 3D graphics in the browser, allowing developers to use shader programs written in the OpenGL ES shading language (GLSL), which are executed in parallel on the GPU, thus greatly accelerating the graphics processing speed. In front-end inference, if some computing tasks can be converted into graphics processing tasks and the GPU acceleration ability of WebGL is utilized, the inference speed can be significantly improved. WASM (WebAssembly) is a new low-level bytecode format that can compile other programming languages (such as C, C++, Rust) into binary code and run in the browser. Its running efficiency is close to native code, so it is suitable for handling those computationally intensive tasks that JavaScript cannot efficiently complete. In front-end inference, some complex computing logics can be written in languages such as C / C++ or Rust, and then compiled into the WASM format and run in the browser to improve the inference speed. Combining the graphics processing ability of WebGL and the efficient computing ability of WASM can jointly optimize the front-end inference process. For example, WebGL can be used for image preprocessing and rendering, while WASM can be used for complex computing tasks, thus greatly improving the inference speed.
[0042] In this implementation, for determined business needs, the corresponding offline data package is quickly determined, and the page resources in the offline data package are obtained, thereby realizing local loading of page resources, which effectively improves the problem of long page loading time in the prior art. It not only effectively improves the page loading efficiency, but also improves the accuracy of page loading. Through the model transmission interface in the target page, the data to be tested can be directly passed to the native AI model inference function of the terminal device, realizing the rapid transmission of the data to be tested and the rapid return of defect identification results, and reducing the delay in data transmission.
[0043] In a feasible implementation, in step S02, the data to be detected includes a construction site image, and a target model corresponding to the business requirement is selected from an offline model library of the mobile terminal, and the step of identifying the data to be detected by the target model to obtain a defect identification result includes steps A11 to A13: Step A11, based on the construction scenario corresponding to the business demand, determining a model label in the offline model library that matches the construction scenario, wherein the offline model library stores a construction defect detection model applied to each construction scenario; It should be noted that users will put forward corresponding business needs based on personal needs and actual construction scenarios. After receiving the business needs, the mobile terminal extracts the information therein and determines the construction scenarios corresponding to the business needs. The construction scenarios include but are not limited to infrastructure construction scenarios, main structure construction scenarios, and fine decoration scenarios. Among them, the infrastructure construction scenario mainly focuses on the construction quality of the foundation and foundation engineering. In this scenario, problems such as floor cracking, hollow tiles, and exposed steel bars may occur, affecting the strength and durability; the main structure construction scenario mainly focuses on the construction quality of the main structure. In this scenario, problems such as honeycomb, roughness, cracks in the concrete, incomplete mortar joints, transparent joints, and holes in the walls may occur; the fine decoration scenario mainly focuses on the construction quality of interior decoration. In this scenario, problems such as damaged doors and windows, and rusted hardware may occur.
[0044] In addition, it should be noted that the offline model library stores construction defect detection models for infrastructure construction scenarios, main structure construction scenarios, and fine decoration scenarios. Among them, the first construction defect detection model for the infrastructure construction scenario is used to detect cracks on the floor surface, hollowing inspection of floor tiles, and exposed steel bars; the second construction defect detection model for the main structure construction scenario is used to identify defects on the concrete surface, detect honeycombs, pitting and cracks on the concrete surface, and detect incomplete mortar joints, through joints and wall holes in masonry structures; the third construction defect detection model for the fine decoration scenario is used to detect surface damage to doors and windows and the degree of hardware corrosion. Each model combines image processing technology and adopts a lightweight model architecture design, which can accurately detect the types of building defects on the construction site.
[0045] Step A12, taking the construction defect detection model associated with the model label as the target model; It should be noted that once the model label is determined, the construction defect detection model corresponding to the label is searched and called in the offline model library as the target model. This model is specially designed for the current construction scenario and can accurately identify the types of construction defects that may occur at this stage.
[0046] Step A13, inputting the construction site image into the target model to identify the type of building defects in the construction site image and obtain a defect identification result.
[0047] It should be noted that when the data to be detected is input into the target model, the target model will analyze and process the construction site images and output the identified types of building defects. The types of building defects can help construction workers find and repair defects in a timely manner, thereby improving construction quality and safety.
[0048] Exemplarily, if the current construction scene is the infrastructure construction stage, the first construction defect detection model is called to detect whether there are floor cracks, floor hollows, and exposed steel bars in the construction site image; if the current construction scene is the main structure construction stage, the second construction defect detection model is called to detect whether there are concrete honeycombs, concrete roughness, concrete cracks, mortar joint defects, and wall holes in the construction site image; if the current construction scene is the fine decoration stage, the third construction defect detection model is called to detect whether there are broken doors and windows and rusted hardware in the construction site image.
[0049] In addition, it should be noted that when identifying the type of building defects in the construction site image, the type of building defects will be annotated by OBB. OBB is a rectangular box, but unlike the traditional axis-aligned bounding box (AABB), OBB can be rotated arbitrarily, so it can surround the target object more tightly. During the recognition, all the suspected building defects in the construction site image will be annotated first, and a corresponding confidence level will be given. The overlapping area and union area between each OBB rectangular box are calculated, and the IoU (i.e., the ratio of the overlapping area to the union area) is obtained based on the overlapping area and the union area. After obtaining the IoU between all OBB rectangular boxes, NMS (Non-Maximum Suppression, i.e., non-maximum suppression algorithm) traverses all OBB rectangular boxes. For each pair of boxes, if their IoU exceeds the set threshold (e.g., 0.3 or 0.5), the box with the lower score is deleted to ensure that only one optimal detection box is retained in the overlapping area, thereby significantly reducing the OBB rectangular boxes that need to be processed and reducing the computational overhead.
[0050] In this implementation, by selecting model labels based on construction scenarios, it is ensured that the selected model is highly relevant to the specific needs of the current construction scenario, thereby improving the accuracy and effectiveness of model application. At the same time, the use of model labels also simplifies the process of selecting suitable models from a large number of models, thereby improving work efficiency. The corresponding construction defect detection model is directly called through the model label, thereby avoiding the tedious model search and loading process, improving work efficiency, ensuring that the selected model can be used for reasoning immediately, and providing strong support for timely discovery and handling of construction defects. The data to be detected is immediately input into the target model for reasoning, thereby ensuring the real-time nature of construction defect detection. By selecting a construction defect detection model that matches the construction scenario, the accuracy of identifying the type of building defects from construction site images is improved, providing a strong guarantee for construction quality control.
[0051] In a feasible implementation, in step S02, the step of selecting a target model corresponding to the business requirement from the offline model library of the mobile terminal includes steps A21 to A23: Step A21, retrieving the target model corresponding to the business requirement from the offline model library; It should be noted that the target model matching the current business requirement is attempted to be retrieved from the locally stored offline model library. For example, assuming that the user currently needs to implement the face recognition function, the mobile terminal will attempt to retrieve a trained face recognition model from the offline model library.
[0052] Step A22, if the target model is not retrieved, detecting whether the network connection between the mobile terminal and the preset server is normal; It should be noted that if the target model that matches the business needs is not found in the offline model library, check the network connection status between the mobile terminal and the preset server. The preset server is a remote data center or cloud service platform that stores more AI model resources and can be dynamically allocated and updated according to demand. The purpose of detecting the network connection is to ensure that the mobile terminal can establish a stable communication link with the preset server when the model needs to be obtained remotely. If the network connection is abnormal, an error message such as "Network connection error" will be displayed. The mobile terminal can choose to wait for the network to recover, or prompt the user to check the network connection.
[0053] Additionally, it should be noted that, when the target model is retrieved, a step of reasoning the data to be detected through the target model is performed.
[0054] Step A23, when the network connection is normal, obtain the model that realizes the business requirements from the preset server and store it in the offline model library as the target model.
[0055] It should be noted that if the network connection is confirmed to be normal, the mobile terminal will obtain the target model that matches the business needs from the preset server, download it locally, and store it in the offline model library so that it can be quickly retrieved and used in the future under the same or similar business needs. This not only improves the reuse rate of the model, but also reduces the number of network requests and bandwidth usage. At the same time, the downloaded and unzipped model must be verified to ensure its integrity and availability. For example, if the model of the face recognition function does not exist in the offline model library, but there is an available model on the preset server, the system will download the model and store it in the offline model library for subsequent use.
[0056] For example, to help understand the technical concept or technical principle of this application, please refer to Figure 2 , Figure 2 A model confirmation flow chart is provided. When the mobile terminal receives a request for building defect detection, it will determine the business requirements based on the request, thereby finding the target model corresponding to the business requirements and judging whether the target model exists in the offline model library. If the target model exists, the data to be detected can be directly inferred through the target model. If the target model does not exist, it is necessary to judge whether the network connection is normal. If the network connection is normal, the model that realizes the business requirements is obtained from the preset server and stored as the target model in the offline model library, so that the loading of the target model can be completed. If the network connection is abnormal, an error prompt message will be displayed.
[0057] In this implementation, the target model is directly retrieved from a pre-built offline model library to determine whether the local offline model library contains the required target model. By detecting the network connection status, it is ensured that the model acquisition operation is performed when the network is available, thereby avoiding model acquisition failure due to network problems and improving the stability and reliability of the system. By downloading and storing the model from a preset server, dynamic updating and localized storage of the model are achieved, which not only meets current business needs, but also provides model resources for possible future business needs. At the same time, localized storage reduces the number of network requests and bandwidth usage, thereby improving system performance.
[0058] Based on the first embodiment of the present application, in the second embodiment of the present application, the same or similar contents as those in the above-mentioned embodiment 1 can be referred to the above introduction, and will not be repeated in the following. Figure 3 The offline model application method further includes steps S11 to S14: Step S11, for any model in the offline model library, obtain the model version corresponding to the model on the preset server side; It should be noted that when the user starts the application or checks for updates, the server will first detect whether there is a new version of the model. When the model version is updated, it will notify the mobile terminal to update the model. When the user is not connected to the network, the old version of the model will be used until the network is connected to update the model.
[0059] In addition, it should be noted that when the model needs to be updated, all models in the offline model library are traversed. For each model, the mobile terminal will communicate with the preset server through a preset communication protocol (such as HTTP, HTTPS, etc.) to query the model version of the model on the server. The model version refers to a specific snapshot of the AI model during the development or training process, representing the latest version of the model, including all necessary information such as the model's weights, structure, and configuration. Each version corresponds to the state of the model at a certain moment and is used to identify model updates and iterations.
[0060] Step S12, when the model version is inconsistent with the model corresponding version, determine the update type of the model; It should be noted that after obtaining the model version on the server side, it is compared with the corresponding version of the model in the offline model library. If the two are inconsistent, it means that the model needs to be updated. At this time, the update type is further determined, that is, whether an incremental update or a complete update is required.
[0061] Step S13, when the update type is incremental update, download the incremental update package of the model, and update the model through the incremental update package; It should be noted that incremental update means downloading and applying only the changed parts of the model (such as newly added weights or modified configurations). When it is determined that the model needs to be incrementally updated, the corresponding incremental update package is downloaded from the preset server. The incremental update package only contains the changed parts of the model. It only contains the parts that have changed compared with the previous version, so it is small in size and downloads quickly. For example, if the model only adds the recognition capabilities of some categories, then the incremental update package may only contain the weights and configuration information of these newly added categories. After the incremental update package is downloaded, these changes are applied to the model in the offline model library to complete the update.
[0062] Step S14: When the update type is a complete update, download the complete update package of the model, and update the model through the complete update package.
[0063] It should be noted that a complete update requires downloading the latest version of the entire model. When it is determined that the model needs to be completely updated, the complete model update package is downloaded from the preset server. This update package contains the latest version of the model and all necessary information. It represents the latest version of the model, so it is larger in size. For example, if the model is retrained or significantly adjusted in structure, the complete update package may contain the weights, structure, configuration and other information of the entire model. After the complete update package is downloaded, the new version of the model is parsed and the old version of the model in the offline model library is replaced with the new version of the model to complete the update.
[0064] For example, to help understand the technical concept or technical principle of this application, please refer to Figure 4 , Figure 4 A model update flow chart is provided. When a user starts an application or checks for updates, the preset server will first detect whether there is a new version of the model. If a new version of the model is detected, the mobile terminal will obtain the model version corresponding to the preset server and check the corresponding version of the model. If the two versions are inconsistent, it is determined whether the model needs an incremental update. If an incremental update is required, the incremental update package is downloaded and the model is updated through the incremental update package. If an incremental update is not required, the complete update package is downloaded and the model is updated through the complete update package. If the new version of the model is not detected on the preset server or the model version corresponding to the preset server is consistent with the corresponding version of the model, there is no need to update the model.
[0065] In this implementation, by real-time or periodic query of the latest version information of each model on the preset server side, the model version in the local offline model library is ensured to be synchronized with the server side, which provides a basis for subsequent update decisions and improves the timeliness of model application. By comparing the local and server-side model versions, the update type is intelligently determined and the update process is optimized, so that the mobile terminal can select the most appropriate update method according to actual needs, reducing unnecessary data transmission and improving update efficiency. Through incremental updates, the efficiency and flexibility of model updates are significantly improved, so that the mobile terminal can quickly adapt to changes in the model without sacrificing performance. Through complete updates, it is ensured that the mobile terminal can smoothly transition to the new version when the model undergoes major changes, thereby maintaining the continuity and stability of the model application.
[0066] In a feasible implementation manner, the offline model application method further includes steps B01-B02: Step B01, when the update package is complete, if the model before the update is being used to perform the reasoning task, the reasoning task is stopped, the model before the update is replaced with the updated model, and the reasoning task is re-executed using the updated model, wherein the update package includes an incremental update package and a complete update package; It should be noted that the integrity of the downloaded update package (including incremental update packages and complete update packages) is verified, which usually involves comparison of checksums or hash values to ensure that the update package is not damaged during transmission. When the update package is complete, all running processes or services are queried to check whether there are any inference tasks currently using the pre-update model. The inference task refers to the process of using the model to predict or analyze data. If it is detected that there are inference tasks using the pre-update model, the mobile terminal will send a signal or command to suspend these tasks to ensure that no data inconsistency or erroneous results occur during the model replacement process. After the inference task is suspended, the pre-update model is uninstalled and the updated model is loaded. After the loading is complete, the previously suspended inference task is restarted, but this time the updated model is used to ensure that the task can continue with the latest model.
[0067] Step B02: If the update package is incomplete, delete the update package and roll back the updated model to the model before the update.
[0068] It should be noted that when an incomplete update package is detected, the mobile terminal will immediately delete the update package to prevent any potential damaged data from further affecting the system, and restore the old version of the model-related files from the backup to roll back to the model before the update, replace the currently running model with the model before the update, and finally, verify whether the task continues to run normally, ensuring that all inference tasks or services that depend on the currently running model have been restored to the state before the update.
[0069] For example, to help understand the technical concept or technical principle of this application, please refer to Figure 5 , Figure 5 A model replacement flowchart is provided. After the update package is downloaded, it is necessary to verify whether the update package is complete. If the update package is complete, stop the current reasoning task and replace the model before the update with the updated model. After the update is completed, use the updated model to re-execute the reasoning task. If the update package is incomplete, delete the downloaded update package and display an update failure prompt. At this time, it is necessary to determine whether the model before the update exists. If the model before the update exists, roll back to the model before the update. If the model before the update does not exist, output a prompt that the model is unavailable.
[0070] In this embodiment, by pausing the inference task using the old model and re-executing it after the model is updated, the continuity of the task and the consistency of the data are ensured, seamless replacement of the old model with the new model is achieved, system service interruption caused by model update is avoided, thereby improving the application efficiency of the model and the user experience. Through integrity check, incomplete update packages are promptly identified and deleted, preventing system errors or performance degradation caused by using the wrong model version. When the update fails, it is possible to quickly roll back to the model version before the update, improving the stability and reliability of model application.
[0071] In a feasible embodiment, the offline model application method further includes steps B11 to B12: Step B11, determine the user-preferred model in the offline model library according to the user's usage habits. It should be noted that collecting and analyzing the user's usage habits on the mobile terminal includes, but is not limited to, the types of pages frequently accessed by the user, the types of operations performed on the pages (such as clicking, swiping, inputting, etc.), and the business requirements associated with these operations (such as AI model inference, information query, etc.). Based on the collected usage habit data, machine learning or statistical methods will be used to identify the user's preferences. For example, if the user often accesses a certain type of page and frequently performs AI model inference operations (such as face recognition, speech recognition, etc.), it can be determined that the user has a high preference for this type of AI model. According to the identified user preferences, the corresponding user-preferred model is searched for and determined in the offline model library to prepare for subsequent model loading operations.
[0072] Step B12, when the mobile terminal is in an idle state or the network connection between the mobile terminal and the preset server is normal, preload the user-preferred model in the background of the mobile terminal.
[0073] It should be noted that the status of the mobile terminal is monitored, including whether it is in an idle state (such as the screen is off and no operations are being performed) and the network connection status with the preset server. When it is detected that the mobile terminal is in an idle state or the network connection is normal, the mobile terminal will use the local idle resources or network connection to preload the user-preferred model in the background. Preloading means loading the model file and related resources from the storage medium (such as hard disk, flash memory, etc.) into the memory so that inference operations can be quickly performed when needed. Once the user-preferred model is successfully preloaded, the mobile terminal will maintain its status in the background until the user needs to use it or a new idle resource or network connection change is detected.
[0074] In addition, it should be noted that when the application is started for the first time, the mobile terminal will load the core AI model locally, which is suitable for scenarios with extremely high requirements for response speed. The core AI model refers to the model required to meet basic functions, such as face recognition, data analysis, etc. The corresponding AI model is loaded when the user needs to use a certain AI function. It is suitable for scenarios with limited resources, such as only loading the corresponding model when the user enters a specific page.
[0075] In addition, it should be noted that when applying AI models, they need to be formatted to ensure support for multiple AI model formats, adapt to different hardware platforms and inference engines, and ensure their normal use, including cloud conversion and local conversion. Cloud conversion refers to converting the AI model in the cloud into a format suitable for terminal device operation, such as converting the TensorFlow model to the TensorFlow Lite model (.tflite). Local conversion refers to converting the AI model format locally, such as PyTorch model->ONNX format->TensorFlow.js.
[0076] In this implementation, by intelligently screening out user preference models from a rich offline model library based on user usage habits, it is possible to more accurately understand user needs, thereby providing users with more personalized and accurate AI services. By selecting the idle state of the mobile terminal or the time when the network connection is normal, the user preference model is preloaded in the background, thereby solving the problems of slow model loading speed and low resource utilization efficiency. The preloading mechanism can ensure that the model can respond quickly and give results when the user needs it, thereby significantly improving the user experience. At the same time, since the model is loaded and run locally, it also reduces dependence on network connection and reduces the risk of data leakage.
[0077] For example, to help understand the technical concept or technical principle of this application, please refer to Figure 6 and Figure 7 , Figure 6 A scenario diagram of the offline model application method is provided. Figure 7 The overall flow chart of the offline model application method is provided. Figure 6In the example, the server side includes a cloud AI model library, which stores a large number of models, such as Model 1, Model 2, etc. When the mobile terminal needs to update the model, it will download the corresponding model from the server side. The mobile terminal uses the Hybrid App to display the target page. The Web view contains page resources extracted from the offline data package, such as HTML files, CSS files, and JS files. These page resources can form the target page. At the same time, a model calling interface is embedded, such as the bridge.so file. The model calling interface can realize model reasoning for business needs by calling the target model loaded into the memory, and the defect identification result will be output to the target page through the model calling interface. The target model is selected from the offline model library and loaded into the memory. The offline model library also includes a large number of models, such as Model 3, Model 4, etc.
[0078] exist Figure 7 In the process, after receiving the building defect detection request, the business requirements are determined according to the building defect detection request, and the target model and page resources are searched locally according to the business requirements. If the target model and page resources are found locally, they are directly loaded. If the target model and page resources are not found locally, the target model and page resources are downloaded from the server. After obtaining the target model and page resources, the target page is rendered with the page resources, and the target model is called. The data to be detected is transmitted through the model transmission interface. The target model returns the defect recognition result after reasoning, and the defect recognition result is output on the target page.
[0079] It should be noted that the above examples are only used to understand the present application and do not constitute a limitation on the offline model application method of the present application. More simple transformations based on this technical concept are all within the scope of protection of the present application.
[0080] This application also provides an offline model application system, which is applied to mobile terminals. Please refer to Figure 8 , the offline model application system includes: The demand determination module 10 is used to receive a building defect detection request and data to be detected, and determine the business demand corresponding to the building defect detection request; The model application module 20 is used to select a target model corresponding to the business requirement from the offline model library of the mobile terminal, identify the data to be detected through the target model to obtain a defect identification result, and output the defect identification result.
[0081] Optionally, the demand determination module 10 is further used for: Acquire offline data packages corresponding to business requirements from offline data packages, and parse the offline data packages to obtain page resources and model transmission interfaces corresponding to business requirements; The target page that realizes business requirements is rendered based on page resources. The target page contains a model transmission interface, which is used to input the data to be detected into the target model and return the defect identification results generated by the target model.
[0082] Optionally, the model application module 20 is further used for: Based on the construction scenarios corresponding to the business needs, determine the model labels in the offline model library that match the construction scenarios, wherein the offline model library stores construction defect detection models applied to various construction scenarios; The construction defect detection model associated with the model label is used as the target model; The construction site image is input into the target model to identify the type of building defects in the construction site image and obtain the defect recognition result.
[0083] Optionally, the model application module 20 is further used for: Retrieve the target model corresponding to the business requirements from the offline model library; If the target model is not retrieved, detecting whether the network connection between the mobile terminal and the preset server is normal; When the network connection is normal, the model that implements the business needs is obtained from the preset server and stored in the offline model library as the target model.
[0084] Optionally, the offline model application system further includes a model updating module 30, and the model updating module 30 is further used for: For any model in the offline model library, obtain the model version corresponding to the model on the preset server side; When the model version is inconsistent with the corresponding model version, determine the update type of the model; When the update type is incremental update, the incremental update package of the model is downloaded, and the model is updated through the incremental update package; If the update type is a complete update, download the complete update package of the model and use it to update the model.
[0085] Optionally, the offline model application system further includes a model replacement module 40, and the model replacement module 40 is further used for: When the update package is complete, if the model before the update is being used for reasoning tasks, the reasoning tasks are stopped, the model before the update is replaced with the updated model, and the reasoning tasks are re-executed using the updated model, wherein the update package includes an incremental update package and a complete update package; If the update package is incomplete, delete the update package and roll back the updated model to the model before the update.
[0086] Optionally, the offline model application system further includes a model preloading module 50, and the model preloading module 50 is further used for: Determine the user preference model in the offline model library according to the user's usage habits; When the mobile terminal is in an idle state or the network connection between the mobile terminal and the preset server is normal, the user preference model is preloaded in the background of the mobile terminal.
[0087] The offline model application device provided by the present application adopts the offline model application method in the above embodiment, which can solve the technical problem of low model application efficiency in a mobile terminal under a resource-constrained and network-instable environment. Compared with the prior art, the beneficial effects of the offline model application device provided by the present application are the same as the beneficial effects of the offline model application method provided by the above embodiment, and other technical features in the offline model application device are the same as the features disclosed in the above embodiment method, which will not be repeated here.
[0088] The present application provides an electronic device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the offline model application method in the above-mentioned embodiment 1.
[0089] Reference below Fig. 9 , which shows a schematic diagram of the structure of an electronic device suitable for implementing an embodiment of the present application. The electronic device in the embodiment of the present application may include but is not limited to mobile terminals such as mobile phones, laptop computers, PADs (Portable Application Description: tablet computers), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Fig. 9 The electronic device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0090] like Fig. 9As shown, the electronic device may include a processing device 1001 (e.g., a central processing unit, a graphics processor, etc.), which may perform various appropriate actions and processes according to a program stored in a read-only memory 1002 or a program loaded from a storage device 1003 to a random access memory 1004. In the random access memory 1004, various programs and data required for the operation of the electronic device are also stored. The processing device 1001, the read-only memory 1002, and the random access memory 1004 are connected to each other via a bus 1005. An input / output interface 1006 is also connected to the bus. Generally, the following systems may be connected to the input / output interface 1006: an input device 1007 including, for example, a touch screen, a touch pad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc.; an output device 1008 including, for example, a liquid crystal display (LCD: Liquid Crystal Display), a speaker, a vibrator, etc.; a storage device 1003 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 1009. The communication device 1009 may allow the electronic device to communicate with other devices wirelessly or by wire to exchange data. Although the electronic device with various systems is shown in the figure, it should be understood that it is not required to implement or have all the systems shown. More or fewer systems can be implemented or have instead.
[0091] In particular, according to the embodiments disclosed in the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device, or installed from a storage device 1003, or installed from a read-only memory 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiment disclosed in the present application are executed.
[0092] The electronic device provided by the present application adopts the offline model application method in the above embodiment, which can solve the technical problem of low model application efficiency in mobile terminals under resource-constrained and network-instable environments. Compared with the prior art, the beneficial effects of the electronic device provided by the present application are the same as the beneficial effects of the offline model application method provided by the above embodiment, and other technical features in the electronic device are the same as the features disclosed in the method of the previous embodiment, which will not be repeated here.
[0093] It should be understood that the various parts disclosed in this application can be implemented by hardware, software, firmware or a combination thereof. In the description of the above embodiments, specific features, structures, materials or characteristics can be combined in any one or more embodiments or examples in a suitable manner.
[0094] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
[0095] The present application provides a computer-readable storage medium having computer-readable program instructions (ie, computer programs) stored thereon, and the computer-readable program instructions are used to execute the offline model application method in the above-mentioned embodiment.
[0096] The computer-readable storage medium provided in the present application may be, for example, a USB flash drive, but is not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems or devices, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM: Random Access Memory), a read-only memory (ROM: Read Only Memory), an erasable programmable read-only memory (EPROM: Erasable Programmable Read Only Memory or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM: CD-Read Only Memory), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system or device. The program code contained on the computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (Radio Frequency: Radio Frequency), etc., or any suitable combination of the above.
[0097] The computer-readable storage medium may be included in the electronic device, or may exist independently without being installed in the electronic device.
[0098] The computer-readable storage medium carries one or more programs. When the one or more programs are executed by an electronic device, the offline model application device is applied to a mobile terminal, and is capable of receiving a building defect detection request and data to be detected, and determining the business requirements corresponding to the building defect detection request; selecting a target model corresponding to the business requirements from an offline model library of the mobile terminal, and identifying the data to be detected through the target model to obtain a defect identification result, and outputting the defect identification result.
[0099] Computer program code for performing the operations of the present application may be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0100] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0101] The modules involved in the embodiments described in this application may be implemented by software or hardware, wherein the name of the module does not constitute a limitation on the unit itself in some cases.
[0102] The readable storage medium provided in the present application is a computer-readable storage medium, which stores computer-readable program instructions (i.e., computer programs) for executing the above-mentioned offline model application method, and can solve the technical problem of low model application efficiency in mobile terminals under resource-constrained and network-instable environments. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided in the present application are the same as the beneficial effects of the offline model application method provided in the above-mentioned embodiment, and will not be elaborated here.
[0103] The present application also provides a computer program product, including a computer program, which implements the steps of the above-mentioned offline model application method when executed by a processor.
[0104] The computer program product provided by the present application can solve the technical problem of low model application efficiency in mobile terminals under resource-constrained and network-instable environments. Compared with the prior art, the beneficial effects of the computer program product provided by the present application are the same as the beneficial effects of the offline model application method provided by the above embodiment, and will not be elaborated here.
[0105] The above descriptions are only some embodiments of the present application, and are not intended to limit the patent scope of the present application. All equivalent structural changes made using the contents of the present application specification and drawings under the technical concept of the present application, or direct / indirect applications in other related technical fields are included in the patent protection scope of the present application.
Claims
1. An offline model application method, applied to a mobile terminal, characterized in that: include: Receiving a building defect detection request and data to be detected, and determining a business requirement corresponding to the building defect detection request; A target model corresponding to the business requirement is selected from the offline model library of the mobile terminal, and the data to be detected is identified by the target model to obtain a defect identification result, and the defect identification result is output.
2. The offline model application method according to claim 1, characterized in that: After the step of determining the business requirements corresponding to the building defect detection request, the method further includes: Acquire an offline data packet corresponding to the business requirement from an offline data packet set, and parse the offline data packet to obtain a page resource and a model transmission interface corresponding to the business requirement; A target page for implementing the business requirement is rendered based on the page resources, and the target page includes the model transmission interface, and the model transmission interface is used to input the data to be detected into the target model and return the defect identification result generated by the target model.
3. The offline model application method according to claim 1, characterized in that: The data to be detected includes a construction site image, and the step of selecting a target model corresponding to the business requirement from an offline model library of the mobile terminal, and identifying the data to be detected by using the target model to obtain a defect identification result includes: Based on the construction scenario corresponding to the business demand, determining a model label in the offline model library that matches the construction scenario, wherein the offline model library stores a construction defect detection model applied to each construction scenario; Using the construction defect detection model associated with the model label as the target model; The construction site image is input into the target model to identify the type of building defects in the construction site image and obtain a defect identification result.
4. The offline model application method according to claim 1, characterized in that: The step of selecting a target model corresponding to the business requirement from the offline model library of the mobile terminal includes: Retrieving a target model corresponding to the business requirement from the offline model library; If the target model is not retrieved, detecting whether the network connection between the mobile terminal and the preset server is normal; When the network connection is normal, a model that realizes the business requirement is obtained from a preset server and stored in the offline model library as the target model.
5. The offline model application method according to claim 1, characterized in that: The offline model application method further includes: For any model in the offline model library, obtaining a model version corresponding to the model on a preset server side; In the case where the model version is inconsistent with the model corresponding version, determining the update type of the model; In the case where the update type is an incremental update, downloading an incremental update package of the model, and updating the model through the incremental update package; In case the update type is a complete update, a complete update package of the model is downloaded, and the model is updated using the complete update package.
6. The offline model application method according to claim 5, characterized in that: The offline model application method further includes: When the update package is complete, if the model before the update is being used to perform the reasoning task, the reasoning task is stopped, the model before the update is replaced with the updated model, and the reasoning task is re-executed using the updated model, wherein the update package includes the incremental update package and the complete update package; In the case that the update package is incomplete, the update package is deleted, and the updated model is rolled back to the model before the update.
7. The offline model application method according to claim 1, characterized in that: The offline model application method further includes: Determine a user preference model in the offline model library according to the user's usage habits; When the mobile terminal is in an idle state or the network connection between the mobile terminal and the preset server is normal, the user preference model is preloaded in the background of the mobile terminal.
8. An electronic device, characterized in that: The device comprises: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the offline model application method according to any one of claims 1 to 7.
9. A storage medium, characterized in that: The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the offline model application method according to any one of claims 1 to 7 are implemented.
10. A computer program product, characterized in that The computer program product comprises a computer program, and when the computer program is executed by a processor, the steps of the offline model application method according to any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Model optimization method, device and system, and equipment
CN112799949A
Edge end, cloud end and data collaborative management system
CN117097743A
Building outer wall crack detection method and system, medium and program product
CN119006454A
Service request processing method and device based on artificial intelligence, equipment and medium
CN119323481A
Cited By
Front-end page dynamic recommendation method and device, storage medium and computer equipment
CN121092774A