Model loading method, device and equipment and readable storage medium

By setting up model queues of different model sizes in ultrasonic devices and judging whether they can be accommodated based on the size of the target model, the problem of low business execution efficiency caused by frequent loading and unloading of AI models is solved, and more efficient model management and business execution are achieved.

CN120179346APending Publication Date: 2025-06-20SONOSCAPE MEDICAL (WUHAN) CORP
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311751608.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-12-19
Publication Date
2025-06-20

AI Technical Summary

Technical Problem

In the prior art, frequent loading and unloading of AI models leads to low service execution efficiency, and traditional configuration files are loading faster and AI models take longer to load.

Method used

By setting up model queues of different model sizes in the ultrasonic device, determine the target model to be loaded and determine whether the corresponding queue is acceptable. If it is not acceptable, unload other models from the queue to make room, load the target model and add its handle to the queue.

Benefits of technology

It effectively reduces the number of repeated loading and unloading of AI models, improves business execution efficiency, and avoids the time-consuming process of unloading a large number of small models and loading them again due to loading large models.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120179346A_ABST
    Figure CN120179346A_ABST
Patent Text Reader

Abstract

The invention discloses a model loading method, device and equipment and a readable storage medium. The method comprises the steps that a to-be-loaded target model is determined; determining a target model queue matched with the target model from the model queues of different model scales; judging whether the target model queue can accommodate the target model or not; if not, determining a to-be-unloaded model from the target model queue, and after the to-be-unloaded model is unloaded, loading the target model and adding a handle of the target model into the target model queue; and if yes, loading the target model and adding a handle of the target model into a target model queue. The method has the technical effects that the loading and unloading frequency of the small model can be effectively reduced, the time consumption of repeated loading and unloading of the small model due to mixed management of models with different scales and sizes can be reduced, and the business execution efficiency can be effectively improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the technical field of document processing, and in particular, to a model loading method, apparatus, device, and readable storage medium. Background Art

[0002] Ultrasonic device terminals will integrate various AI (Artificial Intelligence) functions. Generally, the model file of AI can be equivalent to the configuration file of a traditional executable program. The differences between the model file and the configuration file include:

[0003] 1. Generally, the configuration file takes up relatively little space, but some large AI models take up a very large space. Of course, there are also very small AI models.

[0004] 2. When using AI, the entire model needs to be loaded into memory or video memory, otherwise it cannot work properly. However, the configuration of the configuration file of a traditional executable program can be partially loaded while the program is in use.

[0005] 3. The loading of the model is very time-consuming, while the reading of traditional configuration files is often very fast.

[0006] In practical applications, the time-consuming caused by repeatedly loading and unloading the AI model often leads to too low business execution efficiency.

[0007] In summary, how to effectively solve the problem of AI model management and loading is a technical problem that those skilled in the art need to solve urgently at present. Summary of the Invention

[0008] The purpose of this application is to provide a model loading method, apparatus, device, and readable storage medium, which can scientifically manage the AI model, reduce the repeated loading and unloading of the model, and further effectively improve the business execution efficiency.

[0009] To solve the above technical problems, this application provides the following technical solutions:

[0010] A model loading method, applied to an ultrasonic device, includes:

[0011] Determine a target model to be loaded;

[0012] Determine a target model queue that matches the target model from model queues of different model scales;

[0013] Judge whether the target model queue can accommodate the target model;

[0014] If not, determine the model to be unloaded from the target model queue, and after unloading the model to be unloaded, load the target model and add the handle of the target model to the target model queue;

[0015] If so, load the target model and add the handle of the target model to the target model queue.

[0016] Preferably, determining whether the target model queue can accommodate the target model includes:

[0017] Obtain the current size and the size upper limit of the target model queue;

[0018] Add the size of the target model to the current size to obtain an estimated size;

[0019] If the estimated size exceeds the size upper limit, determine that the target model queue cannot accommodate the target model;

[0020] If the estimated size does not exceed the size upper limit, determine that the target model queue can accommodate the target model.

[0021] Preferably, the method further includes:

[0022] Obtain an authorization file, and use the authorization file to determine the proportion of different services; wherein, the authorization file is used to enable various functional services of the ultrasonic device;

[0023] According to the correspondence between services and models, use the service proportion to determine the capacity proportion between model queues of different model scales;

[0024] Based on the capacity quota of the models in the ultrasonic device and the capacity proportion, determine the capacity upper limit of each model queue;

[0025] Correspondingly, obtaining the size upper limit of the target model queue includes:

[0026] Based on the capacity upper limit of the target model queue, determine the size upper limit of the target model queue.

[0027] Preferably, obtaining the current size of the target model queue includes:

[0028] If the target model queue is a small model queue, obtain the number of handles in the target model queue;

[0029] Determine the number as the current size;

[0030] Correspondingly, adding the size of the target model to the current size to obtain an estimated size includes:

[0031] Add 1 to the said quantity to obtain the said estimated size.

[0032] Preferably, obtaining the current size of the said target model queue includes:

[0033] If the said target model queue is a large model queue, obtain the total model size corresponding to all handles in the said target model queue;

[0034] Determine the said total model size as the said current size;

[0035] Correspondingly, adding the size of the said target model to the said current size to obtain the estimated size includes:

[0036] Add the size of the said target model to the said current size to obtain the said estimated size.

[0037] Preferably, determining the model to be unloaded from the said target model queue includes:

[0038] Take out the handle of the head of the said target model queue, and determine the loaded model to which the taken handle belongs as the said model to be unloaded;

[0039] Correspondingly, after unloading the said model to be unloaded, load the said target model and add the handle of the said target model to the said target model queue, including:

[0040] In the said target model queue, move all the handles after the handle of the said model to be unloaded one position forward, and then add the handle of the said target model to the tail of the said target model queue.

[0041] Preferably, after determining the said target model queue that matches the said target model from the model queues of different model scales, the method further includes:

[0042] Judge whether the handle of the said target model already exists in the said target model queue;

[0043] If it already exists, take out the handle of the said target model from the said target model queue, move all the handles after the handle of the said target model one position forward, and then add the handle of the said target model to the tail of the said target model queue;

[0044] If it does not exist, execute the step of judging whether the said target model queue can accommodate the said target model.

[0045] Preferably, determining the target model to be loaded includes:

[0046] Start the target service, determine the model required to execute the said target service, and obtain the said target model;

[0047] Accordingly, after loading the target model and adding the handle of the target model to the target model queue, the following steps are further included:

[0048] Execute the target service by using the target model.

[0049] A model loading device, applied to an ultrasonic device, includes:

[0050] A model determination module, configured to determine a target model to be loaded;

[0051] A queue determination module, configured to determine a target model queue that matches the target model from model queues of different model scales;

[0052] An accommodation judgment module, configured to judge whether the target model queue can accommodate the target model;

[0053] A first loading module, configured to, when the target model queue cannot accommodate the target model, determine a model to be unloaded from the target model queue, and after unloading the model to be unloaded, load the target model and add the handle of the target model to the target model queue;

[0054] A second loading module, configured to, when the target model queue can accommodate the target model, load the target model and add the handle of the target model to the target model queue.

[0055] An electronic device includes:

[0056] A memory, configured to store a computer program;

[0057] A processor, configured to implement the steps of the model loading method as described above when executing the computer program.

[0058] A readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the model loading method as described above are implemented.

[0059] Apply the method provided in the embodiments of the present application to determine a target model to be loaded; determine a target model queue that matches the target model from model queues of different model scales; judge whether the target model queue can accommodate the target model; if not, determine a model to be unloaded from the target model queue, and after unloading the model to be unloaded, load the target model and add the handle of the target model to the target model queue; if so, load the target model and add the handle of the target model to the target model queue.

[0060] In this application, after determining the target model to be loaded, first determine a target model queue that matches the target model from model queues of different model scales. Then, when the target model queue cannot accommodate the target model, perform model unloading based on the target model queue so that the target model queue can accommodate the target model, and then load the target model. When the target model queue can accommodate the target model, the target model can be loaded and the handle of the target model can be added to the target model queue to manage the target model based on the target model queue.

[0061] It can be seen that since different model queues are set for different model scales, when loading a model, loading and unloading management of the model based on a single model queue can effectively avoid the situation where a large number of small models are unloaded due to the need to load a relatively large model, resulting in the need to reload the small models when they are used again. Most of the executions of the ultrasound device business use small models, and this application can effectively reduce the loading and unloading frequencies of small models, reduce the time-consuming of repeated loading and unloading of small models caused by mixed management of models of different scales, and can effectively improve the business execution efficiency.

[0062] Correspondingly, the embodiments of this application also provide a model loading device, a device, and a readable storage medium corresponding to the above model loading method, which have the above technical effects and will not be elaborated here. Description of the Drawings

[0063] To more clearly illustrate the technical solutions in the embodiments of this application or related technologies, the following will briefly introduce the drawings required for use in the description of the embodiments or related technologies. Obviously, the drawings in the following description are only some embodiments of this application. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.

[0064] Figure 1 It is the flowchart of the implementation of a model loading method in the embodiments of this application;

[0065] Figure 2 It is the schematic structural diagram of a model loading device in the embodiments of this application;

[0066] Figure 3 It is the schematic structural diagram of an electronic device in the embodiments of this application;

[0067] Figure 4 It is the specific structural diagram of an electronic device in the embodiments of this application. Detailed Embodiments

[0068] To enable those skilled in the art to better understand the solution of this application, the following further details this application in conjunction with the accompanying drawings and specific embodiments. Obviously, the described embodiments are only a part of the embodiments of this application, rather than all of them. All other embodiments obtained by those of ordinary skill in the art based on the embodiments in this application without creative efforts belong to the scope of protection of this application.

[0069] Please refer to Figure 1 , Figure 1 , which is a flowchart of a model loading method in an embodiment of this application and can be applied to electronic devices such as ultrasonic devices. The following takes an ultrasonic device as an example for description. The method includes the following steps:

[0070] S101. Determine the target model to be loaded.

[0071] In this application, for the sake of distinction, the model to be loaded is called the target model, and the target model can be any model that needs to be loaded into the ultrasonic device.

[0072] In this embodiment, loading a model means loading the corresponding model file into the ultrasonic device so as to execute relevant services based on the model file. Exemplarily, the model is loaded into system resources such as the disk, memory, and video memory of the ultrasonic device to execute corresponding services. Therefore, loading a model in the embodiments of this application can include loading the model file into the system resources of the ultrasonic device, and unloading the model can include unloading the model file from the system resources of the ultrasonic device. The model has a handle. Adding the handle of the model to the model queue can realize management operations such as loading and unloading of the model based on the handle itself and the position of the handle. Therefore, for whether to load / unload a model, whether it can be loaded / unloaded, etc., it can be judged based on the model queue.

[0073] S102. Determine the target model queue that matches the target model from model queues of different model scales.

[0074] That is, in the embodiments of this application, different model queues can be set in advance for models of different scales so as to manage models of the same scale when managing models, to avoid repeated loading and unloading of models. Among them, the model queue can be a system resource represented from another dimension, and it has a corresponding relationship with the system resource. Unloading the model file from system resources such as the disk, correspondingly, the model is also unloaded from the model queue; unloading the model file from the model queue, correspondingly, the model is also unloaded from system resources such as the disk; loading the model file into system resources such as the disk, correspondingly, the model is also loaded into the model queue; loading the model file into the model queue, correspondingly, the model is also loaded into system resources such as the disk.

[0075] Most of the models used in ultrasonic devices are AI (Artificial Intelligence) models, and an AI model is a configuration file of an AI program. Compared with conventional software configuration files, such a configuration file occupies much more system resources such as disk, memory, and video memory. At the same time, the memory occupancy and video memory occupancy of the model can be roughly estimated based on the system resource occupancy of the model. Therefore, the model type can be classified according to the system resource occupancy of the model. For example, the model can be classified by its disk occupancy size, and the category division is controlled through a configuration file. In the configuration file, it can be defined that [0M, 50M) is a small model and [50M, +∞) is a large model. According to the specified model disk occupancy size in the configuration, the model can be classified. It should be noted that in actual applications, the model scale can also be divided into more levels (such as large models, medium models, and small models, and even extra-large models can be distinguished), and the numerical values of the division intervals for each type of model can be adjusted according to the system resources.

[0076] According to different model sizes, different model queues can be set. For the convenience of explanation, in this article, two categories of large models and small models are used for illustration. In actual applications, more queues can be set for three or more model classifications.

[0077] That is, the small model queue is used to store the handles of small models and manage the small models; the large model queue is used to store the handles of large models and manage the large models. The management here refers to operations such as loading and unloading. The management rules used for management in different model queues can be different.

[0078] The size of the target model can be determined, and then based on its model scale, it can be determined which model queue the target model corresponds to. In this embodiment, for the convenience of distinction, the model queue corresponding to the target model is determined as the target model. For example, if the size of the target model is 32M, which belongs to the category of small models [0M, 50M), then the small model queue is determined as the target model queue.

[0079] S103. Determine whether the target model queue can accommodate the target model.

[0080] After determining the target model queue, it is necessary to determine whether the target model queue can accommodate the target model. That is to say, since the storage resources of the ultrasonic device are limited, the storage resources allocated to the model queue are also limited. Therefore, it is necessary to first determine whether the target model queue can accommodate the target model, and different processing operations are adopted based on different judgment results in order to successfully load the target model.

[0081] In this embodiment, a queue upper limit can be set for different model queues, so that it can be determined whether the target model queue can accommodate the target model based on the queue upper limit.

[0082] After obtaining the judgment result, different loading measures are taken according to different execution results. Specifically, if the target model can be accommodated, step S004 is executed; if the target model cannot be accommodated, step S105 is executed.

[0083] S104. Determine the model to be unloaded from the target model queue, and after unloading the model to be unloaded, load the target model and add the handle of the target model to the target model queue.

[0084] In the case where it is clear that the target model queue cannot accommodate the target model queue, the model to be unloaded can be directly determined from the target model queue and the model to be unloaded is unloaded, so as to free up accommodation space to accommodate the target model.

[0085] Among them, the model to be unloaded can be one or more, and the specific situation needs to be determined according to the target model queue and the relevant dimensions of the target model.

[0086] When it is necessary to determine the model to be unloaded, only selecting from the target model queue can effectively avoid the following two situations:

[0087] When the target model is a large model, many models need to be unloaded to meet the requirement of accommodating the target model, resulting in many small models being unloaded and then being repeatedly loaded when needed;

[0088] When the target model is a small model, in order to free up space, a large model is unloaded, resulting in a long loading time when the large model is needed.

[0089] That is to say, in this application, when the target model is a large model and the target model queue cannot accommodate the target model, space can be freed up by unloading the loaded large model; when the target model is a small model and the target model queue cannot accommodate the target model, only individual small models can be unloaded to free up space. It can be seen that whether the target model is a large model or a small model, excessive model unloading and subsequent model loading time can be effectively avoided.

[0090] In a specific implementation manner of this application, determining the model to be unloaded from the target model queue includes:

[0091] Take out the handle of the head of the target model queue, and determine the loaded model to which the taken handle belongs as the model to be unloaded;

[0092] Accordingly, after unloading the model to be unloaded, load the target model and add the handle of the target model to the target model queue, including:

[0093] In the target model queue, after shifting all the handles after the handle of the model to be unloaded one position forward, add the handle of the target model to the end of the target model queue.

[0094] That is to say, when determining the model to be unloaded, the handle at the head of the target model queue can be taken out first, and the loaded model corresponding to this handle is determined as the model to be unloaded. Then, after unloading the model to be unloaded, the handle of the target model can be loaded into the target model queue. Since the most recently loaded model has the highest recent usage frequency and the earliest loaded model may have the lowest recent usage frequency, when unloading the model, take out the handle corresponding to the head of the target model queue and unload the model corresponding to this handle, while for the newly loaded model, add the handle of the corresponding model to the end of the target model queue, which can achieve that the earliest loaded model is unloaded first, thereby reducing the repeated loading and unloading of models.

[0095] For example: when the target model is a large model, when it is necessary to unload a loaded large model, a handle can be taken out from the head of the large model queue, and the large model A to which this handle belongs is determined as the large model to be unloaded. After unloading large model A, move the other handles after the handle of large model A one position forward, and after loading the target model, add the handle of the target model to this large model queue.

[0096] S105. Load the target model and add the handle of the target model to the target model queue.

[0097] In the case where the target model queue can accommodate the target model, the target model can be directly loaded, and the handle of the target model is added to the target model queue for the management of the target model.

[0098] Applying the method provided by the embodiments of the present application, determine the target model to be loaded; determine the target model queue matching the target model from the model queues of different model scales; judge whether the target model queue can accommodate the target model; if not, determine the model to be unloaded from the target model queue, and after unloading the model to be unloaded, load the target model and add the handle of the target model to the target model queue; if so, load the target model and add the handle of the target model to the target model queue.

[0099] In this application, after determining the target model to be loaded, first determine a target model queue that matches the target model from model queues of different model scales. Then, in the case where the target model queue cannot accommodate the target model, perform model unloading based on the target model queue so that the target model queue can accommodate the target model, and then load the target model. In the case where the target model queue can accommodate the target model, the target model can be loaded and the handle of the target model can be added to the target model queue to manage the target model based on the target model queue.

[0100] It can be seen that since different model queues are set for different model scales, when a model needs to be loaded, loading and unloading management of the model based on a single model queue can effectively avoid the situation where a large number of small models are unloaded due to the need to load a relatively large model, resulting in the need to reload the small models when they are used again. Most of the executions of the ultrasound device business use small models, and this application can effectively reduce the loading and unloading frequencies of small models, reduce the time-consuming of repeated loading and unloading of small models caused by mixed management of models of different scales, and effectively improve the business execution efficiency.

[0101] It should be noted that based on the above embodiments, the embodiments of this application also provide corresponding improvement solutions. In the preferred / improved embodiments, the same steps or corresponding steps involved in the above embodiments can be referred to each other, and the corresponding beneficial effects can also be referred to each other, and will not be elaborated one by one in the preferred / improved embodiments of this article.

[0102] In a specific implementation manner of this application, determining the target model to be loaded includes:

[0103] Start the target business, determine the model required to execute the target business, and obtain the target model;

[0104] Correspondingly, after loading the target model and adding the handle of the target model to the target model queue, it further includes:

[0105] Execute the target business using the target model.

[0106] When the ultrasound device needs to start a certain business, if the model corresponding to processing the business is not loaded, the model corresponding to the business is determined as the target model.

[0107] In this embodiment, system resources need to divide the operations that the model needs to perform according to the business scenario. Taking the ultrasound system as an example: The AI models of the ultrasound system mainly involve three types of operations: recognition, segmentation, and calculation. Among them, the operations corresponding to recognition and segmentation are mainly to assist doctors in finding tissue lesions through ultrasound images, and the proportion of such operations is relatively large. These operations mainly use small models. The remaining calculations are mainly to measure the ultrasound image tissues to obtain their case characteristic parameters, and these operations mainly use large models.

[0108] Specifically, in actual applications, a mapping relationship can be established between different types of operations and the corresponding processing models. When a target operation is received, the target model for executing the target operation can be determined based on this mapping relationship. For example, when the target operation is a recognition operation, based on the mapping relationship, it can be determined that the target model for executing this target operation can be a recognition model.

[0109] Regardless of whether the target model is currently loaded or was previously loaded, the target model can be used to execute the target operation. There are many handles in the model. When executing the target operation, it can be executed sequentially according to the order of the handles. That is to say, when the handle of the target model is read or accessed, the model data of the corresponding target model is obtained based on this handle and the target operation is executed using the target model. Specifically, for how to execute the target operation on the model data in the target model, the specific implementation solution of the AI model can be specifically referred to, and will not be elaborated here one by one.

[0110] In a specific implementation manner of the present application, after determining the target model queue that matches the target model from the model queues of different model scales, the method further includes:

[0111] Judge whether the handle of the target model already exists in the target model queue;

[0112] If it already exists, take out the handle of the target model from the target model queue, move all the handles originally after the handle of the target model forward by one position, and then add the handle of the target model to the end of the target model queue;

[0113] If it does not exist, execute the step of judging whether the target model queue can accommodate the target model.

[0114] For ease of description, the above several steps will be combined and described below.

[0115] Considering that the operations performed by the ultrasound device will change and the types of operations performed are also diverse, in order to avoid loading the target model too frequently, some models can be loaded in the device and retained after the corresponding operations are completed for direct use the next time, thus saving the time-consuming of unloading and reloading.

[0116] Therefore, after the target model to be loaded is determined, it can be first determined whether the target model has been loaded. If it has been loaded, the loading step can be skipped, and its position in the target model queue can be adjusted to avoid being wrongly unloaded. If it has not been loaded, it is determined that the target model needs to be loaded.

[0117] It should be noted that for the case where the handle already exists in the target model queue, after shifting all the handles originally behind the handle of the target model one position forward, the step of determining whether the target model queue can accommodate the target model can also be executed. If it is determined that the target model queue can accommodate the target model, the handle of the target model is directly added to the end of the target model queue. If it is determined that the target model queue cannot accommodate the target model, the model to be unloaded is determined in the target model queue after the handle movement, and after unloading the model to be unloaded, the target model is loaded and the handle of the target model is added to the end of the target model queue.

[0118] In a specific implementation manner of the present application, determining the model to be unloaded from the target model queue includes:

[0119] Taking out the handle at the head of the target model queue, and determining the loaded model to which the taken handle belongs as the model to be unloaded;

[0120] Correspondingly, adding the handle of the target model to the target model queue includes:

[0121] Adding the handle of the target model to the end of the target model queue.

[0122] That is, when loading a model, its handle is placed at the end of the queue, and when unloading a model, the model corresponding to the handle at the head of the queue is preferred. In this way, the model loaded first can be unloaded first, avoiding the situation that the models that are not used for a long time occupy resources after being loaded and retained for a long time.

[0123] Among them, determining whether the target model has been loaded includes:

[0124] Judging whether the handle of the target model already exists in the target model queue;

[0125] If not, it is determined that the target model has not been loaded;

[0126] If so, it is determined that the target model has been loaded;

[0127] Correspondingly, if the target model has been loaded, the handle of the target model is taken out from the target model queue;

[0128] After shifting all the handles originally behind the handle of the target model one position forward, the handle of the target model is added to the end of the target model queue.

[0129] That is, if the handle of the target model is already in the model queue, it indicates that it has been loaded; otherwise, it has not been loaded.

[0130] In the case where it is clear that the target model has been loaded, the loading step can be omitted, and the target model can be directly used to process the target service. At the same time, to avoid frequently used models from being unloaded, when it is clear that the target model has been loaded, its corresponding handle can be readjusted to the end of the target model queue, so as to prevent the model at the head of the queue from being wrongly unloaded when a new model is loaded next time, that is, the handle of the most frequently used model is farther away from the head of the model queue.

[0131] In a specific implementation manner of the present application, determining whether the target model queue can accommodate the target model includes:

[0132] Obtain the current size and size upper limit of the target model queue;

[0133] Add the size of the target model to the current size to obtain an estimated size;

[0134] If the estimated size exceeds the size upper limit, it is determined that the target model queue cannot accommodate the target model;

[0135] If the estimated size does not exceed the size upper limit, it is determined that the target model queue can accommodate the target model.

[0136] For ease of description, the above steps will be combined and described below.

[0137] In this embodiment, different size upper limits can be set in advance for model queues of different scales. The size upper limit can be stored in a configuration file and can be obtained by reading. The current size of the model queue can be determined by reading the handles in the current model queue.

[0138] After obtaining the current size, the size of the target model can be added to it to obtain an estimated size.

[0139] If the estimated size does not exceed the size upper limit, it indicates that even if the target model is loaded, it will not exceed the upper limit of the model queue. Therefore, it is determined that the target model queue can accommodate the target model; otherwise, it is determined that the target model queue cannot accommodate the target model.

[0140] It should be noted that considering the different management requirements for models of different scales, different upper limit units can be used when setting the size upper limit. That is to say, the size upper limit can refer to the number of elements in the entire model queue or the cumulative upper limit of the model sizes in the entire model queue.

[0141] In a specific implementation manner of the present application, the method further includes:

[0142] Obtain the authorization file and use the authorization file to determine the proportion of different services; among them, the authorization file is used to enable the various functional services of the ultrasonic device.

[0143] According to the corresponding relationship between the service and the model, use the service proportion to determine the capacity proportion among the model queues of different model scales.

[0144] Based on the capacity quota and capacity proportion of the models in the ultrasonic device, determine the upper limit of the capacity of each model queue.

[0145] Correspondingly, obtain the upper limit of the size of the target model queue, including:

[0146] Based on the upper limit of the capacity of the target model queue, determine the upper limit of the size of the target model queue.

[0147] Specifically, if the target model queue is a small model queue, obtain the number of handles in the target model queue; determine the number as the current size; correspondingly, add the size of the target model to the current size to obtain the estimated size, including: adding 1 to the number to obtain the estimated size.

[0148] Specifically, if the target model queue is a large model queue, obtain the total size of the models corresponding to all the handles in the target model queue; determine the total size of the models as the current size; correspondingly, add the size of the target model to the current size to obtain the estimated size, including: adding the size of the target model to the current size to obtain the estimated size.

[0149] Optionally, due to different settings of the size upper limit, the obtained current size may also be different, specifically including but not limited to the following methods:

[0150] Method 1, when the target model queue is a small model queue, since the size of the small model has an upper limit, the size of the small model queue can be replaced by the number of elements (i.e., the number of handles) in it. That is, the number of small models managed by the current small model queue.

[0151] Add 1 to the current number of handles in the small model queue. That is, in the case where the small model is not unloaded, after loading the target model, the latest value of the size of the small model queue does not exceed the size upper limit, which indicates that the small model queue can accommodate the target model.

[0152] For example, if the size upper limit of the small model queue is 8 and the current size is 5, after adding the target model, the latest storage is 6, and 6 is less than 8, which indicates that the small model queue can accommodate the target model; if the size upper limit of the small model queue is 8 and the current size is 8, after adding the target model, the latest storage is 9, and 9 is greater than 8, which indicates that the current small model queue cannot accommodate the target model.

[0153] Method 2: When the target model queue is a large model queue, considering the large size range of large models, they cannot be directly managed by the number of models. Instead, management can be based on the size of the models.

[0154] Specifically, for the large model queue, the total size of the models corresponding to all handles in the large model queue can be obtained. For example, if there is only one large model A in the large model queue, the current size is the size of this large model A, which is 800M. If there are two large models A and B in the large model queue, the current size is the sum of the size of large model A, which is 800M, and the size of large model B, which is 500M, resulting in 1300M.

[0155] After obtaining the current size of the large model queue, the size of the target model can be added on top of it to obtain the estimated size. For example, if the current size is 500M and the size of the target model is 300M, the estimated size is 800M.

[0156] Considering that in actual applications, there may be large models that exceed the size limit of the large model queue. Therefore, when a large model needs to be loaded, it can first be determined whether the size of the large model exceeds the queue capacity limit. If it does, an error can be directly reported. If it does not, the estimated size can be calculated, and based on the estimated size, it can be determined whether the large model queue can accommodate the large model.

[0157] In a specific implementation manner of the present application, the size limit can also be dynamically adjusted to meet the requirements of different business scenario changes. Specifically, obtaining the size limit of the target model queue includes:

[0158] Obtaining an authorization file and using the authorization file to determine different business ratios;

[0159] According to the correspondence between the business and the model, using the business ratio to determine the capacity ratio between the model queues of different model scales;

[0160] Based on the capacity of the ultrasonic device and the capacity ratio, determining the capacity limit of each model queue;

[0161] Based on the capacity limit of the target model queue, determining the size limit of the target model queue.

[0162] For ease of description, the above several steps will be combined and described below.

[0163] Among them, the capacity limit refers to the size of the storage resources allocated to the target model queue, which can also be called the storage quota. The size limit is set based on different model queues and is used to manage the size limit of the models accommodated in the queue.

[0164] Since the functions of the ultrasound system in the ultrasound device are enabled by an authorization file, it is also possible to obtain which are small model services and which are large model services through the authorization file. In this way, when the ultrasound system is in use, the proportion of the small model and large model queues can be controlled through the authorization file to control the upper limit of the queue capacity, thus enabling adjustment of the upper limit of the model queue size according to the requirements of the business scenario, including but not limited to the following situations:

[0165] Situation 1: When it is found that there is no large model service in the authorization file, the small model queue can account for all system resources. If the system resources are 2G, then 2G can be fully allocated to the small model queue for use. If the small model is set to 50M, then the upper limit of the size can be calculated as 40 elements / model.

[0166] Situation 2: When it is found that there is no small model service in the authorization file, the large model queue can account for all system resources. If the system resources are 2G, then 2G can be fully allocated to the large model queue for use, that is, the upper limit of the size is 2G.

[0167] Situation 3: When it is found that there are both large models and small models, the maximum model resource requirement can be calculated, and then the large model queue can be set to the size of this maximum model, and the remaining resources are allocated to the small model queue. In this way, the large model can be used normally, and at the same time, the loading and unloading management of the small model can also be maximized in efficiency. For example, if the total system resources are 2G and the size of the largest model is 1500M, then the upper limit of the size of the large model queue can be set to 1500M, and the upper limit of the size of the small model queue can be set to 10 elements / model.

[0168] As can be seen from the above, the method provided by the embodiment of the present application can divide the system resources in a ratio of 1:3. For example, if the system resources have 2G of memory, then the small model can occupy 500M and the large model can occupy 1500M. In this way, 10 small models can be loaded (500M / 50M), and several large models can be loaded (the size of the large model is designed according to business needs. Generally speaking, the larger the size, the higher the calculation accuracy. For example, the single size of the liver measurement model can reach 1200M, and the single size of the thyroid measurement model can reach 1400M).

[0169] The method provided by the embodiment of the present application can effectively reduce the loading time of the small model. The following is a comparison and explanation in combination with the business scenario.

[0170] Without using the solution provided by the embodiments of the present application, if 10 small models (500M) are loaded, then the liver measurement model (1200M) and the thyroid measurement model (1400M) need to be loaded in sequence. When the thyroid measurement model needs to be loaded, limited by the size of the system resource of 2G, the 10 small models and the liver measurement model ultimately need to be unloaded, and only the thyroid measurement model can be retained in the system resource. When the small model service is initiated again, it is necessary to wait until the large model, i.e., the thyroid measurement model, is unloaded before loading.

[0171] When using the solution provided by the embodiments of the present application, after loading 10 small models (500M), the liver measurement model (1200M) and the thyroid measurement model (1400M) need to be loaded in sequence. It can be seen that only the large model, i.e., the liver measurement model, needs to be unloaded, and ultimately the 10 small models (500M) and the thyroid measurement model (1400M) still remain in the system resource. When the small model service is initiated again, there is no need to wait. According to the business characteristics, the quantity ratio of small models to large models is approximately: 70% for small models and 30% for large models. That is to say, the method provided by the embodiments of the present application can significantly reduce the number of model loading and unloading times and can effectively improve the business processing efficiency.

[0172] Corresponding to the above method embodiments, the embodiments of the present application further provide a model loading device, and the model loading device described below can be correspondingly referred to the model loading method described above.

[0173] See Figure 2 As shown, this device is applied to an ultrasonic device and specifically includes the following modules:

[0174] A model determination module 101, configured to determine a target model to be loaded;

[0175] A queue determination module 102, configured to determine a target model queue that matches the target model from model queues of different model scales;

[0176] An accommodation judgment module 103, configured to judge whether the target model queue can accommodate the target model;

[0177] A first loading module 104, configured to, when the target model queue cannot accommodate the target model, determine a model to be unloaded from the target model queue, and after unloading the model to be unloaded, load the target model and add the handle of the target model to the target model queue;

[0178] A second loading module 105, configured to, when the target model queue can accommodate the target model, load the target model and add the handle of the target model to the target model queue.

[0179] Apply the device provided by the embodiments of the present application to determine the target model to be loaded; determine the target model queue that matches the target model from the model queues of different model scales; determine whether the target model queue can accommodate the target model; if not, determine the model to be unloaded from the target model queue, and after unloading the model to be unloaded, load the target model and add the handle of the target model to the target model queue; if so, load the target model and add the handle of the target model to the target model queue.

[0180] In the present application, after determining the target model to be loaded, first determine a target model queue that matches the target model from the model queues of different model scales. Then, in the case where the target model queue cannot accommodate the target model, perform model unloading based on the target model queue so that the target model queue can accommodate the target model, and then load the target model. In the case where the target model queue can accommodate the target model, the target model can be loaded and the handle of the target model can be added to the target model queue for managing the target model based on the target model queue.

[0181] It can be seen that since different model queues are set for different model scales, when a model needs to be loaded, loading and unloading management of the model based on a single model queue can effectively avoid the situation where a large number of small models are unloaded due to the need to load a relatively large model, resulting in the need to reload the small models again when they are used again. Since most of the executions of the ultrasound device business use small models, the present application can effectively reduce the loading and unloading frequencies of small models, reduce the time-consuming of repeated loading and unloading of small models caused by mixed management of models of different scales, and effectively improve the business execution efficiency.

[0182] In a specific embodiment of the present application, the accommodation judgment module 103 includes:

[0183] A queue size acquisition unit for acquiring the current size and the size upper limit of the target model queue;

[0184] An estimated size calculation unit for adding the size of the target model to the current size to obtain an estimated size;

[0185] A non-accommodation determination unit for determining that the target model queue cannot accommodate the target model if the estimated size exceeds the size upper limit;

[0186] An accommodation determination unit for determining that the target model queue can accommodate the target model if the estimated size does not exceed the size upper limit.

[0187] In a specific embodiment of the present application, it further includes:

[0188] A dynamic configuration module is used to obtain an authorization file and determine the proportion of different services based on the authorization file. The authorization file is used to enable various functional services of the ultrasonic device. According to the correspondence between services and models, the capacity proportion between model queues of different model scales is determined using the service proportion. Based on the capacity quota and capacity proportion of the models in the ultrasonic device, the upper limit of the capacity of each model queue is determined.

[0189] Correspondingly, a queue size acquisition unit is used to determine the upper limit of the size of the target model queue based on the upper limit of the capacity of the target model queue.

[0190] In a specific embodiment of the present application, the queue size acquisition unit includes:

[0191] A small queue size acquisition subunit is used to, if the target model queue is a small model queue, obtain the number of handles in the target model queue; determine the number as the current size.

[0192] Correspondingly, the estimated size calculation unit is specifically used to add 1 to the number to obtain the estimated size.

[0193] In a specific embodiment of the present application, the queue size acquisition unit includes:

[0194] A large queue size acquisition subunit is used to, if the target model queue is a large model queue, obtain the total model size corresponding to all the handles in the target model queue; determine the total model size as the current size.

[0195] Correspondingly, the estimated size calculation unit is specifically used to superimpose the size of the target model on the current size to obtain the estimated size.

[0196] In a specific embodiment of the present application, the first loading module 104 includes:

[0197] A model to be unloaded determination unit is used to take out the handle at the head of the queue of the target model queue and determine the loaded model to which the taken handle belongs as the model to be unloaded.

[0198] Correspondingly, after unloading the model to be unloaded, the handle management unit is used to, in the target model queue, move all the handles after the handle of the model to be unloaded one position forward and then add the handle of the target model to the end of the queue of the target model queue.

[0199] In a specific embodiment of the present application, the device further includes:

[0200] A loading judgment module is used to determine a target model queue that matches the target model from model queues of different model scales, and then judge whether the handle of the target model already exists in the target model queue; if it already exists, take out the handle of the target model from the target model queue, move the handles originally after the handle of the target model forward by one position, and then add the handle of the target model to the end of the target model queue; if it does not exist, trigger the accommodation judgment module 103 to execute the step of judging whether the target model queue can accommodate the target model.

[0201] In a specific embodiment of the present application, the model determination module 101 is specifically configured to start a target service, determine the model required to execute the target service, and obtain the target model;

[0202] Correspondingly, after loading the target model and adding the handle of the target model to the target model queue, the service execution module is used to execute the target service by using the target model.

[0203] Corresponding to the above method embodiment, the embodiment of the present application also provides an electronic device. An electronic device described below can be correspondingly referred to the model loading method described above.

[0204] See Figure 3 As shown, the electronic device includes:

[0205] A memory 332 for storing computer programs;

[0206] A processor 322 for implementing the steps of the model loading method in the above method embodiment when executing the computer program.

[0207] Specifically, please refer to Figure 4 , Figure 4 which is a schematic structural diagram of an electronic device provided in this embodiment. The electronic device may vary greatly due to configuration or performance, and may include one or more processors (central processing units, CPUs) 322 (for example, one or more processors) and a memory 332. The memory 332 stores one or more computer programs 342 or data 344. Among them, the memory 332 can be short-term storage or persistent storage. The program stored in the memory 332 may include one or more modules (not marked in the figure), and each module may include a series of instruction operations on the data processing device. Further, the processor 322 can be set to communicate with the memory 332 and execute a series of instruction operations in the memory 332 on the electronic device 301.

[0208] The electronic device 301 may further include one or more power supplies 326, one or more wired or wireless network interfaces 350, one or more input / output interfaces 358, and / or one or more operating systems 341.

[0209] The steps in the model loading method described above may be implemented by the structure of the electronic device.

[0210] Corresponding to the above method embodiments, the embodiments of the present application further provide a readable storage medium, and a readable storage medium described below can be correspondingly referred to with a model loading method described above.

[0211] A readable storage medium has a computer program stored thereon, and when the computer program is executed by a processor, the steps of the model loading method in the above method embodiments are implemented.

[0212] Specifically, the readable storage medium may be various readable storage media such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disc that can store program codes.

[0213] The various embodiments in this specification are described in a progressive manner. Each embodiment focuses on the differences from other embodiments. The same or similar parts among the various embodiments can be referred to each other. For the devices disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the description is relatively simple, and the relevant parts can be referred to the description of the method part.

[0214] Those skilled in the art can further realize that the units and algorithm steps of the examples described in combination with the embodiments disclosed herein can be implemented by electronic hardware, computer software, or a combination of the two. To clearly illustrate the interchangeability of hardware and software, the components and steps of the examples have been generally described according to functions in the above description. Whether these functions are executed in the form of hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the present application.

[0215] The steps of the methods or algorithms described in combination with the embodiments disclosed herein can be directly implemented by hardware, software modules executed by a processor, or a combination of the two. The software modules can be placed in a random access memory (RAM), memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other form of storage medium well-known in the technical field.

[0216] Finally, it should also be noted that in this text, relationships such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms including, containing or any other variant are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements not only includes those elements, but also includes other elements not explicitly listed, or also includes elements inherent in such a process, method, article or device.

[0217] Specific examples are used in this text to elaborate on the principles and implementation manners of the present application. The description of the above embodiments is only used to help understand the method and its core idea of the present application; at the same time, for those of ordinary skill in the art, according to the idea of the present application, there will be changes in the specific implementation manners and application scopes. In summary, the content of this specification should not be construed as a limitation to the present application.

Claims

1. A model loading method, characterized in that, Applied to an ultrasound device, including: Determine the target model to be loaded; Determine a target model queue that matches the target model from a model queue with different model scales; Judge whether the target model queue can accommodate the target model; If not, determine the model to be unloaded from the target model queue, and after unloading the model to be unloaded, load the target model and add the handle of the target model to the target model queue; If so, load the target model and add the handle of the target model to the target model queue.

2. The method according to claim 1, characterized in that, Judging whether the target model queue can accommodate the target model includes: Obtain the current size and size upper limit of the target model queue; Overlay the size of the target model on the current size to obtain an estimated size; If the estimated size exceeds the size upper limit, determine that the target model queue cannot accommodate the target model; If the estimated size does not exceed the size upper limit, determine that the target model queue can accommodate the target model.

3. The method according to claim 2, characterized in that, The method further includes: Obtain an authorization file, and use the authorization file to determine different business ratios; wherein, the authorization file is used to enable various functional services of the ultrasound device; According to the correspondence between services and models, use the business ratio to determine the capacity ratio between model queues with different model scales; Based on the capacity quota of the models in the ultrasound device and the capacity ratio, determine the capacity upper limit of each model queue; Correspondingly, obtaining the size upper limit of the target model queue includes: Based on the capacity upper limit of the target model queue, determine the size upper limit of the target model queue.

4. The method according to claim 2, characterized in that, Obtaining the current size of the target model queue includes: If the target model queue is a small model queue, obtain the number of handles in the target model queue; Determine the number as the current size; Correspondingly, overlaying the size of the target model on the current size to obtain an estimated size includes: Add 1 to the number to obtain the estimated size.

5. The method according to claim 2, characterized in that, Obtaining the current size of the target model queue includes: If the target model queue is a large model queue, obtain the total size of the models corresponding to all handles in the target model queue; Determine the total model size as the current size; Correspondingly, overlaying the size of the target model on the current size to obtain an estimated size includes: Overlay the size of the target model on the current size to obtain the estimated size.

6. The method according to any one of claims 1 to 5, characterized in that, Determining the model to be unloaded from the target model queue includes: Take out the handle at the head of the target model queue, and determine the loaded model to which the taken handle belongs as the model to be unloaded; Correspondingly, after unloading the model to be unloaded, loading the target model and adding the handle of the target model to the target model queue includes: In the target model queue, move all the handles after the handle of the model to be unloaded forward by one position, and then add the handle of the target model to the end of the target model queue.

7. The method according to any one of claims 1 to 5, characterized in that, After determining the target model queue that matches the target model from the model queues with different model scales, the method further includes: Determine whether the handle of the target model already exists in the target model queue; If it already exists, take out the handle of the target model from the target model queue. After shifting all the handles originally behind the handle of the target model one position forward, add the handle of the target model to the end of the target model queue; If it does not exist, execute the step of determining whether the target model queue can accommodate the target model.

8. The method according to any one of claims 1 to 5, characterized in that, Determine the target model to be loaded, including: Start the target service, determine the model required to execute the target service, and obtain the target model; Correspondingly, after loading the target model and adding the handle of the target model to the target model queue, further include: Execute the target service using the target model.

9. A model loading device, characterized in that, Applied to an ultrasonic device, including: A model determination module for determining the target model to be loaded; A queue determination module for determining the target model queue that matches the target model from model queues with different model scales; An accommodation judgment module for judging whether the target model queue can accommodate the target model; A first loading module for, when the target model queue cannot accommodate the target model, determining the model to be unloaded from the target model queue, and after unloading the model to be unloaded, loading the target model and adding the handle of the target model to the target model queue; A second loading module for, when the target model queue can accommodate the target model, loading the target model and adding the handle of the target model to the target model queue.

10. An electronic device, characterized in that, Including: A memory for storing a computer program; A processor for implementing the steps of the model loading method according to any one of claims 1 to 8 when executing the computer program.

11. A readable storage medium, characterized in that, A computer program is stored on the readable storage medium, and when the computer program is executed by the processor, the steps of the model loading method according to any one of claims 1 to 8 are implemented.