Device upgrading method and apparatus, storage medium, and electronic device

CN115827035BActive Publication Date: 2026-10-27ZHEJIANG DAHUA TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211386124.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-07
Publication Date
2026-10-27
Estimated Expiration
2042-11-07

AI Technical Summary

Technical Problem

[0004]本发明实施例提供了一种设备升级方法、装置、存储介质及电子装置,以至少解决相关技术中存在的设备升级方法的灵活性较差的问题

Benefits of technology

[0021]通过本发明,通过获取待升级包,其中,待升级包中包括第一算法库和/或第一模型库,将待升级包的目标配置信息与目标设备当前已有的当前包的当前配置信息进行对比,再基于对比结果确定出目标算法库及目标模型库,并将目标算法库及目标模型库存储至目标目录中,其中,目标算法库为第一算法库和当前算法库中的版本高的算法库,目标模型库为第一模型库和当前模型库中的模型能力集合大的模型库;然后,加载目标目录中的目标算法库和目标模型库,以及在配置当前业务并运行当前业务后,禁用目标算法库的输出结果,当确定已成功加载目标算法库和目标模型库时,再通过使能目标算法库的输出,以完成目标设备的升级。即,在目标算法库和目标模型库加载成功之前继续使用当前算法库的输出结果,而在确定加载成功之后再使能目标算法库的输出结果,实现了在设备升级过程中业务不中断的目的,即设备的智能业务在升级期间始终处于运行状态,避免了相关技术中在设备升级时需要重启设备或终端业务从而导致用户体验差的问题,因此,解决了相关技术中存在的设备升级方法的灵活性较差的问题,达到了提高设备升级的灵活性的效果。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115827035B_ABST
    Figure CN115827035B_ABST
Patent Text Reader

Abstract

Embodiments of the present application provide a device upgrading method and device, a storage medium and an electronic device, wherein the method comprises: obtaining a to-be-upgraded package, wherein the to-be-upgraded package comprises a first algorithm library and / or a first model library; comparing target configuration information of the to-be-upgraded package with current configuration information of a current package to obtain a comparison result, the comparison result being used to indicate a high-low relationship between the target configuration information and the current configuration information; determining a target algorithm library and a target model library based on the comparison result; loading the target algorithm library and the target model library, and disabling output results of the target algorithm library after a current service is configured and the current service is run; and enabling the output of the target algorithm library to complete upgrading of a target device in a case where it is determined that the target algorithm library and the target model library have been successfully loaded. Through the present application, the problem of poor flexibility of a device upgrading method in the related art is solved, and the effect of improving the flexibility of device upgrading is achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present invention relate to the field of video surveillance technology, and more specifically, to a device upgrade method, apparatus, storage medium, and electronic device. Background Technology

[0002] With the rapid pace of equipment upgrades and the increasing demand for personalized equipment from users, equipment upgrades have become a crucial technical issue that engineers in various fields must address. Taking security monitoring equipment as an example, after the equipment is sold, changes in user business and scenarios may lead to new requirements, such as work uniform and hat detection, changes or additions to clothing and hat styles, or user-discovered issues requiring optimization. These new requirements necessitate equipment upgrades. The upgrade process can impact user operations; for instance, some industries require uninterrupted single-point or large-area recording, or uninterrupted application services. Currently, upgrades typically require restarting the equipment or interrupting services, resulting in a poor user experience. In other words, the current technology suffers from a lack of flexibility in equipment upgrade methods.

[0003] There is currently no effective solution to the problem of poor flexibility in equipment upgrade methods in related technologies. Summary of the Invention

[0004] This invention provides a device upgrade method, apparatus, storage medium, and electronic device to at least address the problem of poor flexibility in device upgrade methods in related technologies.

[0005] According to an embodiment of the present invention, a device upgrade method is provided, comprising: obtaining an upgrade package, wherein the upgrade package includes a first algorithm library and / or a first model library; comparing target configuration information of the upgrade package with current configuration information of a current package to obtain a comparison result, wherein the target configuration information includes first configuration information indicating the version of the first algorithm library and / or second configuration information indicating the set of model capabilities contained in the first model library, the current package includes a software package currently existing on the target device that includes the current algorithm library and the current model library, the current configuration information includes third configuration information indicating the version of the current algorithm library and fourth configuration information indicating the set of model capabilities contained in the current model library, and the comparison result... The comparison results are used to indicate the relative importance of the target configuration information and the current configuration information. Based on the comparison results, a target algorithm library and a target model library are determined and stored in a target directory. The target algorithm library is the algorithm library with the higher version among the first algorithm library and the current algorithm library, and the target model library is the model library with the larger set of model capabilities among the first model library and the current model library. The target algorithm library and the target model library in the target directory are loaded, and after configuring and running the current service, the output of the target algorithm library is disabled. If it is determined that the target algorithm library and the target model library have been successfully loaded, the output of the target algorithm library is enabled to complete the upgrade of the target device.

[0006] In an exemplary embodiment, determining the target algorithm library and the target model library based on the comparison result includes: when the upgrade package only includes the first algorithm library, determining a first high-low relationship between the version information of the first algorithm library and the current algorithm library based on the comparison result, and determining the target algorithm library and the target model library based on the first high-low relationship; when the upgrade package includes both the first algorithm library and the first model library, determining a target relationship between a first set of model capabilities included in the first model library and a second set of model capabilities included in the current model library based on the comparison result, and determining a second high-low relationship between the version information of the first algorithm library and the current algorithm library based on the comparison result, and determining the target algorithm library and the target model library based on the target relationship and the second high-low relationship; wherein the first set of model capabilities and the second set of model capabilities are both used to correspond to sets indicating the types and attributes of objects that the target device is allowed to detect.

[0007] In an exemplary embodiment, determining the target algorithm library and the target model library based on the comparison result when one of the following first predetermined conditions is met includes: if the upgrade package includes only the first algorithm library, performing the following operations: if it is determined that the first high-low relationship indicates that the first version information of the first algorithm library is higher than the second version information of the current algorithm library, determining the first algorithm library as the target algorithm library and the current model library as the target model library; if the upgrade package includes both the first algorithm library and the first model library, performing at least one of the following operations: if it is determined that the first model capability set and the second model capability set satisfy a predetermined relationship based on the target relationship, and if it is determined that the second high-low relationship indicates that the first version information of the first algorithm library is higher than or equal to the second version information of the current algorithm library. In this context, the first algorithm library is identified as the target algorithm library, and the first model library is identified as the target model library; if the first model capability set and the second model capability set satisfy a predetermined relationship based on the target relationship, and if the second high-low relationship is determined to indicate that the first version information of the first algorithm library is lower than the second version information of the current algorithm library, the current algorithm library is identified as the target algorithm library, and the first model library is identified as the target model library; if the first model capability set and the second model capability set are the same based on the target relationship, and if the second high-low relationship is determined to indicate that the first version information of the first algorithm library is higher than the second version information of the current algorithm library, the first algorithm library is identified as the target algorithm library, and the first model library is identified as the target model library.

[0008] In an exemplary embodiment, the method further includes: determining the target algorithm library and the target model library under the following second predetermined conditions: determining the current algorithm library as the target algorithm library when it is determined that the first model capability set and the second model capability set satisfy the predetermined relationship, and determining that the upgrade package does not contain the first algorithm library; and determining the first model library as the target model library.

[0009] In one exemplary embodiment, the method further includes: performing an exit operation if it is determined that the first predetermined condition and the second predetermined condition are not met.

[0010] In one exemplary embodiment, comparing the target configuration information of the package to be upgraded with the current configuration information of the current package includes: if it is determined that the target identifier of the package to be upgraded is the same as the current identifier of the current package, checking the target configuration information; and comparing the target configuration information with the current configuration information.

[0011] In one exemplary embodiment, the method further includes: if it is determined that there is no software package in the target device that is the same as the target identifier, parsing the package description file of the package to be upgraded to obtain the type of the package to be upgraded; if it is determined based on the type of the package to be upgraded that the package to be upgraded contains only the first algorithm library or only the first model library, performing an exit operation; if it is determined based on the type of the package to be upgraded that the package to be upgraded contains both the first algorithm library and the first model library, and if it is determined that the current hardware platform matches the platform and computing power characteristics indicated by the target identifier, storing the package to be upgraded in the target path and installing the package to be upgraded.

[0012] In one exemplary embodiment, loading the target algorithm library and the target model library in the target directory includes: loading the target algorithm library via dlopen and loading a pre-agreed set of application programming interfaces (APIs) with the target algorithm library; and loading the target model library via the API set.

[0013] In one exemplary embodiment, disabling the output of the target algorithm library includes: disabling the output of the target algorithm library while continuing to output the output of the current algorithm library.

[0014] In one exemplary embodiment, if it is determined that the target algorithm library and the target model library have been successfully loaded, upgrading the target device by enabling the output of the target algorithm library includes: if it is determined that the target algorithm library and the target model library have been successfully loaded, disabling the output of the current algorithm library, and upgrading the target device by enabling the output of the target algorithm library.

[0015] In one exemplary embodiment, after upgrading the target device by enabling the output of the target algorithm library, the method further includes: uninstalling the current algorithm library and deleting files in the directory where the current algorithm library is located.

[0016] In one exemplary embodiment, the method further includes: unloading the target algorithm library if it is determined that there is an anomaly in the loading process.

[0017] In an exemplary embodiment, the upgrade package further includes at least one of the following: if the upgrade package includes the first algorithm library, the upgrade package further includes first version information of the first algorithm library; a first model capability set included in the first model library, wherein the first model capability set is used to indicate a set of object types and attributes allowed for detection by the target device; a package description file of the upgrade package, wherein the package description file is used to indicate at least one of the following: the type of the upgrade package, wherein the type of the upgrade package is used to indicate that the upgrade package is a package containing one or all of the first algorithm library and the first model library; the first algorithm library and its first version information; the first model library and its first model capability set, wherein the first model capability set is used to indicate a set of object types and attributes allowed for detection by the target device; the relationship between the first algorithm library and the first model library; a target identifier for the upgrade package, wherein the target identifier is used to identify the relationship between the first algorithm library and the first model library, and the platform and computing power characteristics that the upgrade package needs to match; and a pre-agreed set of application programming interfaces (APIs) between the target application and the first algorithm library.

[0018] According to another embodiment of the present invention, a device upgrade apparatus is also provided, comprising: an acquisition module, configured to acquire an upgrade package, wherein the upgrade package includes a first algorithm library and / or a first model library; and a comparison module, configured to compare target configuration information of the upgrade package with current configuration information of a current package to obtain a comparison result, wherein the target configuration information includes first configuration information indicating the version of the first algorithm library and / or second configuration information indicating the set of model capabilities contained in the first model library, the current package includes a software package currently existing on the target device that includes the current algorithm library and the current model library, the current configuration information includes third configuration information indicating the version of the current algorithm library and fourth configuration information indicating the set of model capabilities contained in the current model library, and the comparison result is used to indicate... The system displays the hierarchical relationship between the target configuration information and the current configuration information; a first determining module is used to determine the target algorithm library and the target model library based on the comparison result, and store the target algorithm library and the target model library in the target directory, wherein the target algorithm library is the algorithm library with the higher version among the first algorithm library and the current algorithm library, and the target model library is the model library with the larger set of model capabilities among the first model library and the current model library; a loading module is used to load the target algorithm library and the target model library in the target directory, and disable the output results of the target algorithm library after configuring and running the current service; a first processing module is used to complete the upgrade of the target device by enabling the output of the target algorithm library when it is determined that the target algorithm library and the target model library have been successfully loaded.

[0019] According to yet another embodiment of the present invention, a computer-readable storage medium is also provided, wherein a computer program is stored therein, wherein the computer program is configured to perform the steps in any of the above method embodiments when executed.

[0020] According to yet another embodiment of the present invention, an electronic device is also provided, including a memory and a processor, wherein the memory stores a computer program and the processor is configured to run the computer program to perform the steps in any of the above method embodiments.

[0021] This invention involves acquiring an upgrade package, which includes a first algorithm library and / or a first model library. The target configuration information of the upgrade package is compared with the current configuration information of the current package currently existing on the target device. Based on the comparison result, the target algorithm library and target model library are determined and stored in a target directory. The target algorithm library is the algorithm library with the higher version among the first algorithm library and the current algorithm library, and the target model library is the model library with the largest set of model capabilities among the first model library and the current model library. Then, the target algorithm library and target model library in the target directory are loaded. After configuring and running the current service, the output of the target algorithm library is disabled. When it is determined that the target algorithm library and target model library have been successfully loaded, the output of the target algorithm library is enabled to complete the upgrade of the target device. In other words, the current algorithm library's output is used until the target algorithm library and target model library are successfully loaded, and the target algorithm library's output is enabled only after successful loading. This achieves the goal of uninterrupted service during device upgrades, meaning the device's intelligent services remain running throughout the upgrade process. This avoids the problem of poor user experience caused by restarting the device or terminal services during upgrades, as required by related technologies. Therefore, it solves the problem of poor flexibility in device upgrade methods in related technologies and improves the flexibility of device upgrades. Attached Figure Description

[0022] Figure 1 This is a block diagram of the mobile terminal hardware structure of the device upgrade method according to an embodiment of the present invention;

[0023] Figure 2 This is a schematic diagram of equipment upgrade documents in related technologies;

[0024] Figure 3 This is a flowchart of a device upgrade method according to an embodiment of the present invention;

[0025] Figure 4 This is a disassembly diagram of the device upgrade package according to a specific embodiment of the present invention;

[0026] Figure 5 This is a flowchart of a device thermal upgrade method according to a specific embodiment of the present invention;

[0027] Figure 6 This is a structural block diagram of an equipment upgrade device according to an embodiment of the present invention. Detailed Implementation

[0028] The embodiments of the present invention will be described in detail below with reference to the accompanying drawings and examples.

[0029] It should be noted that the terms "first," "second," etc., in the specification, claims, and drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence.

[0030] The methods and embodiments provided in this application can be executed on a mobile terminal, a computer terminal, or a similar computing device. Taking running on a mobile terminal as an example, Figure 1 This is a block diagram of the mobile terminal hardware structure of the device upgrade method according to an embodiment of the present invention. Figure 1 As shown, a mobile terminal may include one or more ( Figure 1 Only one is shown in the diagram. A processor 102 (which may include, but is not limited to, a microprocessor MCU or a programmable logic device FPGA, etc.) and a memory 104 for storing data are also shown. The mobile terminal may further include a transmission device 106 for communication functions and an input / output device 108. Those skilled in the art will understand that... Figure 1 The structure shown is for illustrative purposes only and does not limit the structure of the mobile terminal described above. For example, the mobile terminal may also include components that are more... Figure 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown.

[0031] The memory 104 can be used to store computer programs, such as application software programs and modules, like the computer program corresponding to the device upgrade method in this embodiment of the invention. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, thereby implementing the above-described method. The memory 104 may include high-speed random access memory and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include memory remotely located relative to the processor 102, and these remote memories can be connected to the mobile terminal via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.

[0032] The transmission device 106 is used to receive or send data via a network. Specific examples of the network described above may include a wireless network provided by the mobile terminal's communication provider. In one example, the transmission device 106 includes a Network Interface Controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the transmission device 106 may be a Radio Frequency (RF) module, used for wireless communication with the Internet.

[0033] Figure 2 This is a diagram illustrating device upgrade files in related technologies. In these technologies, system upgrades are performed using device image files. The image contains all the device's software, including the file system, etc. Figure 2 The term "traditional device image upgrade file" is used in this context; related technologies also include those using device image upgrade files and APP upgrade files, corresponding to... Figure 2 The “newly emerging device image upgrade file + APP upgrade file” refers to the fact that the device’s application business program is developed into an APP package, and the application upgrade is supported through the upgrade features of the device APP (such as HEOP of Company A, DHOP of Company B, and SDC of Company C). This approach is a new form that has emerged in recent years. Since the functional differences of security equipment are mainly in the application business, while the basic functions of the equipment, such as audio and video encoding formats, recording, storage, and protocols, are relatively fixed, their update and iteration cycles are usually long.

[0034] However, among the device upgrade methods of related technologies, system upgrades require restarting the device, which inevitably leads to recording and service interruptions, and the upgrade and restart process takes a long time (minutes); or, it must be a device that supports an app, where app upgrades are system-level, meaning different apps are treated uniformly without regard to the app's internal functions, and the app will be restarted, thus interrupting services; whether or not to restart the device depends on the characteristics of the system app upgrade. App upgrades without restart characteristics generally take (seconds).

[0035] This embodiment provides a device upgrade method. Figure 3 This is a flowchart of a device upgrade method according to an embodiment of the present invention, such as... Figure 3 As shown, the process includes the following steps:

[0036] Step S302: Obtain the upgrade package, wherein the upgrade package includes a first algorithm library and / or a first model library;

[0037] Step S304: Compare the target configuration information of the package to be upgraded with the current configuration information of the current package to obtain a comparison result. The target configuration information includes first configuration information indicating the version of the first algorithm library and / or second configuration information indicating the set of model capabilities contained in the first model library. The current package includes a software package currently existing on the target device that contains the current algorithm library and the current model library. The current configuration information includes third configuration information indicating the version of the current algorithm library and fourth configuration information indicating the set of model capabilities contained in the current model library. The comparison result is used to indicate the relative importance of the target configuration information and the current configuration information.

[0038] Step S306: Based on the comparison results, determine the target algorithm library and the target model library, and store the target algorithm library and the target model library in the target directory. The target algorithm library is the algorithm library with the higher version among the first algorithm library and the current algorithm library, and the target model library is the model library with the larger set of model capabilities among the first model library and the current model library.

[0039] Step S308: Load the target algorithm library and the target model library in the target directory, and after configuring and running the current service, disable the output results of the target algorithm library;

[0040] Step S310: If it is determined that the target algorithm library and the target model library have been successfully loaded, the upgrade of the target device is completed by enabling the output of the target algorithm library.

[0041] Through the above steps, the upgrade package is obtained, which includes a first algorithm library and / or a first model library. The target configuration information of the upgrade package is compared with the current configuration information of the current package currently existing on the target device. Based on the comparison result, the target algorithm library and the target model library are determined and stored in the target directory. The target algorithm library is the algorithm library with the higher version among the first algorithm library and the current algorithm library, and the target model library is the model library with the largest set of model capabilities among the first model library and the current model library. Then, the target algorithm library and the target model library in the target directory are loaded. After configuring and running the current service, the output of the target algorithm library is disabled. When it is determined that the target algorithm library and the target model library have been successfully loaded, the output of the target algorithm library is enabled to complete the upgrade of the target device. In other words, the current algorithm library's output is used until the target algorithm library and target model library are successfully loaded, and the target algorithm library's output is enabled only after successful loading. This achieves the goal of uninterrupted service during device upgrades, meaning the device's intelligent services remain running throughout the upgrade process. This avoids the problem of poor user experience caused by restarting the device or terminal services during upgrades, as required by related technologies. Therefore, it solves the problem of poor flexibility in device upgrade methods in related technologies and improves the flexibility of device upgrades.

[0042] The entity executing the above steps can be a terminal, or a terminal device, such as the target device mentioned above, or an application program in the terminal, or a processor with human-computer interaction capabilities configured on a storage device, or a processing device or processing unit with similar processing capabilities, etc., but is not limited to these. The following explanation uses a terminal performing the above operations as an example (this is only an illustrative example; in actual operation, other devices or modules can also perform the above operations).

[0043] In the above embodiments, the terminal obtains an upgrade package, which includes a first algorithm library and / or a first model library. The terminal can be the target device or an application in the terminal. The content of the upgrade package in this embodiment is flexible; it can be a patch package that only upgrades the algorithm library or the model, thus allowing for more flexible control over the package size. The upgrade package can also include both the algorithm library and the model. The target configuration information of the upgrade package is compared with the current configuration information of the current package to obtain a comparison result. The target configuration information may include the version configuration information of the first algorithm library (i.e., the first configuration information mentioned above) and / or the models contained in the first model library. The configuration information (i.e., the second configuration information mentioned above) refers to the software package currently available on the target device, including the current algorithm library and the current model library. The current configuration information refers to the configuration information of the current algorithm library (i.e., the third configuration information mentioned above) and the configuration information of the current model library (i.e., the fourth configuration information mentioned above). The comparison result is used to indicate the relative importance of the target configuration information of the package to be upgraded and the current configuration information of the current package. For example, the relative importance of the version information of the first algorithm library in the package to be upgraded and the version information of the current algorithm library in the current package. Optionally, the comparison result can also be used to indicate the relative importance of the first model capability set in the first model library in the package to be upgraded and the second model capability set in the current model library of the current package. The target relationship between force sets is defined. Both the first and second model capability sets correspond to sets indicating the types and attributes of objects that the target device is allowed to detect. For example, the first model capability set may contain the second model capability set, or the first and second model capability sets may be equal, or they may intersect or not intersect. Then, based on the comparison results, the target algorithm library and target model library are determined and stored in the target directory. For example, the first algorithm library and the algorithm library with the higher version information in the current algorithm library are used as the target algorithm library. Similarly, the first model capability set... The larger of the first and second model capability sets (meaning one set truly contains the other set), or the set containing more detectable target types and attributes, is used as the target model library. For example, the first model capability set truly contains the second model capability set, or the second model capability set truly contains the first model capability set. Then, the target algorithm library and target model library in the target directory are loaded. After configuring and running the current service, the output results of the target algorithm library are disabled. The current service refers to the service supported or running by the target device in the current package. At this time, the output results of the current algorithm library will continue to be output, that is, the output results of the old algorithm library will still be output.Once the target algorithm library and target model library have been successfully loaded, the upgrade of the target device is completed by enabling the output of the target algorithm library. Specifically, when it is confirmed that the target algorithm library and target model library have been successfully loaded, the output of the new algorithm library is enabled. In practical applications, the output of the current algorithm library is also disabled at this time. That is, the output of the new algorithm library is output, and the output of the old algorithm library is disabled. This achieves the goal of uninterrupted service during device upgrades, meaning that the device's intelligent services remain running throughout the upgrade process. This avoids the problem of poor user experience caused by restarting the device or terminal services during upgrades, as required by related technologies. Therefore, it solves the problem of poor flexibility in device upgrade methods in related technologies, achieving the effect of improving the flexibility of device upgrades.

[0044] In an optional embodiment, determining the target algorithm library and the target model library based on the comparison results includes: when the upgrade package only includes the first algorithm library, determining a first high-low relationship between the version information of the first algorithm library and the current algorithm library based on the comparison results, and determining the target algorithm library and the target model library based on the first high-low relationship; when the upgrade package includes both the first algorithm library and the first model library, determining a target relationship between a first set of model capabilities included in the first model library and a second set of model capabilities included in the current model library based on the comparison results, and determining a second high-low relationship between the version information of the first algorithm library and the current algorithm library based on the comparison results, and determining the target algorithm library and the target model library based on the target relationship and the second high-low relationship; wherein the first set of model capabilities and the second set of model capabilities are both used to correspond to the set of types and attributes of objects that are allowed to be detected by the target device. In this embodiment, when the upgrade package only includes the first algorithm library (i.e., the upgrade package only includes the algorithm library and not the model), a first high-low relationship between the version information of the first algorithm library and the current algorithm library can be determined based on the comparison results. Then, the target algorithm library and target model library are determined based on this first high-low relationship. When the upgrade package includes both the first algorithm library and the first model library, a target relationship between the first model capability set and the second model capability set can be determined based on the comparison results. A second high-low relationship between the version information of the first algorithm library and the current algorithm library can also be determined based on the comparison results. Then, the target algorithm library and target model library are determined based on the above target relationship and the second high-low relationship. This embodiment achieves the goal of determining the target algorithm library and target model library based on comparison results.

[0045] In an optional embodiment, determining the target algorithm library and the target model library based on the comparison result when one of the following first predetermined conditions is met includes: if the upgrade package includes only the first algorithm library, performing the following operations: if the first high-low relationship is determined to indicate that the first version information of the first algorithm library is higher than the second version information of the current algorithm library, determining the first algorithm library as the target algorithm library and the current model library as the target model library; if the upgrade package includes both the first algorithm library and the first model library, performing at least one of the following operations: if the target relationship determines that the first model capability set and the second model capability set satisfy a predetermined relationship, and if the second high-low relationship is determined to indicate that the first version information of the first algorithm library is higher than or equal to the second version information of the current algorithm library. In this context, the first algorithm library is identified as the target algorithm library, and the first model library is identified as the target model library; if the first model capability set and the second model capability set satisfy a predetermined relationship based on the target relationship, and if the second high-low relationship is determined to indicate that the first version information of the first algorithm library is lower than the second version information of the current algorithm library, the current algorithm library is identified as the target algorithm library, and the first model library is identified as the target model library; if the first model capability set and the second model capability set are the same based on the target relationship, and if the second high-low relationship is determined to indicate that the first version information of the first algorithm library is higher than the second version information of the current algorithm library, the first algorithm library is identified as the target algorithm library, and the first model library is identified as the target model library.In this embodiment, when the upgrade package includes only the first algorithm library, if it is determined that the first version information of the first algorithm library is higher than the second version information of the current algorithm library, the first algorithm library is identified as the target algorithm library, and the current model library is identified as the target model library; that is, the algorithm library with the higher version information is identified as the target algorithm library. When the upgrade package includes both the first algorithm library and the first model library, corresponding operations can be performed according to different predetermined conditions satisfying the above target relationship and the second high-low relationship. For example, when it is determined that the first model capability set and the second model capability set satisfy a predetermined relationship, and the first version information of the first algorithm library is higher than or equal to the second version information of the current algorithm library, the first algorithm library is identified as the target algorithm library, and the first model library is identified as the target model library. For example, the above predetermined relationship can be that the second model capability set is a proper subset of the first model capability set, or... The first model capability set and the second model capability set satisfy a predetermined relationship, and the first version information of the first algorithm library is lower than the second version information of the current algorithm library. Therefore, the current algorithm library and the first model library are both designated as the target algorithm library. In other words, the algorithm library with the higher version among the two is designated as the target algorithm library. If the first model capability set contains the second model capability set, the first model library corresponding to the first model capability set is designated as the target model library. Similarly, if the second model capability set contains the first model capability set, the current model library corresponding to the second model capability set is designated as the target model library. Furthermore, if the first model capability set and the second model capability set are the same, and the first version information of the first algorithm library is higher than the second version information of the current algorithm library, the first algorithm library and the first model library are both designated as the target algorithm library. Through this embodiment, the purpose of determining the target algorithm library and the target model library based on different predetermined conditions satisfied by the comparison results is achieved.

[0046] In an optional embodiment, the method further includes: determining the target algorithm library and the target model library under the following second predetermined conditions: determining the current algorithm library as the target algorithm library and the first model library as the target model library when it is determined that the first model capability set and the second model capability set satisfy the predetermined relationship, and determining that the upgrade package does not contain the first algorithm library. In this embodiment, when the upgrade package only includes the first model library and does not include the first algorithm library, the current algorithm library is determined as the target algorithm library and the first model library is determined as the target model library when it is determined that the first model capability set and the second model capability set satisfy the predetermined relationship.

[0047] In an optional embodiment, the method further includes: performing an exit operation if it is determined that the first predetermined condition and the second predetermined condition are not met. In this embodiment, when it is determined based on the comparison result that the first predetermined condition and the second predetermined condition in the foregoing embodiment are not met, an exit operation is performed, meaning the device is no longer upgraded. For example, if the version information of the first algorithm library is lower than the current algorithm library version, and the upgrade package does not contain the first model library, then no device upgrade is needed; or, if the version information of the first algorithm library is lower than the current algorithm library version, and the first model capability set and the second model capability set have an intersecting or non-intersecting relationship, then no device upgrade is needed either. This embodiment achieves the purpose of performing an exit upgrade operation when it is determined based on the comparison result that the first predetermined condition and the second predetermined condition are not met.

[0048] In an optional embodiment, comparing the target configuration information of the package to be upgraded with the current configuration information of the current package includes: checking the target configuration information if the target identifier of the package to be upgraded is the same as the current identifier of the current package; and comparing the target configuration information with the current configuration information. In this embodiment, the target configuration information of the package to be upgraded is checked only if the target identifier of the package to be upgraded is the same as the current identifier of the current package, and then compared with the current configuration information of the current package. In other words, if the target identifier of the package to be upgraded is different from the current identifier of the current package, the upgrade can be terminated. In practical applications, when the package to be upgraded (or the algorithm software package) is first packaged by the producer (first version), a source ID is assigned by the package producer to identify the initial relationship between the algorithm library and the model (compatibility of the algorithm library and the model), platform type, and computing power (device compatibility), etc. The producer uses this source ID unchanged in subsequent iterations of its versions. Therefore, check if the source ID of the upgrade package is the same as the source ID of the package in use (or the current package): if they are the same, they are from the same source, continue; if they are different, they are from different sources, exit the upgrade. Of course, this may also be the first installation.

[0049] In an optional embodiment, the method further includes: if it is determined that there is no software package in the target device that is the same as the target identifier, parsing the package description file of the package to be upgraded to obtain the type of the package to be upgraded; if it is determined based on the type of the package to be upgraded that the package to be upgraded contains only the first algorithm library or only the first model library, performing an exit operation; if it is determined based on the type of the package to be upgraded that the package to be upgraded contains both the first algorithm library and the first model library, and if it is determined that the current hardware platform matches the platform and computing power characteristics indicated by the target identifier, storing the package to be upgraded in the target path and installing the package to be upgraded. In this embodiment, when it is determined that there is no software package with the same target identifier as the package to be upgraded in the target device, it may be the first installation. The package description file of the package to be upgraded is parsed to determine the type of the package to be upgraded. The type of the package to be upgraded refers to whether the package to be upgraded contains one or both of the first algorithm library and the first model library. When it is determined that the package to be upgraded contains only the first algorithm library or only the first model library, it is an incomplete package, and an exit operation can be performed. When it is determined that the package to be upgraded contains both the first algorithm library and the first model library, the platform and computing power characteristics of the source ID are parsed and compared with the current hardware platform. If it matches the current hardware platform, it is a usable package, and an installation operation can be performed.

[0050] In an optional embodiment, loading the target algorithm library and the target model library in the target directory includes: loading the target algorithm library via dlopen and loading a pre-agreed set of application programming interfaces (APIs) with the target algorithm library; and loading the target model library via the API set. In this embodiment, the target algorithm library is loaded via dlopen, and the agreed-upon API set is loaded, i.e., the interface address is obtained by API name via dlsym. Then, the target model library is loaded via the API interface provided by the target algorithm library. For example, the storage path of the target model library is passed to the target algorithm library to perform model loading.

[0051] In an optional embodiment, disabling the output of the target algorithm library includes: disabling the output of the target algorithm library while continuing to output the output of the current algorithm library. In this embodiment, by disabling the output of the target algorithm library (or the new algorithm library) while continuing to output the output of the current algorithm library (or the old algorithm library), the goal of ensuring uninterrupted service during the upgrade process can be achieved.

[0052] In an optional embodiment, after determining that the target algorithm library and the target model library have been successfully loaded, the upgrade of the target device is completed by enabling the output of the target algorithm library. This includes: after determining that the target algorithm library and the target model library have been successfully loaded, disabling the output of the current algorithm library, and then enabling the output of the target algorithm library to complete the upgrade of the target device. In this embodiment, when it is determined that the loading has been successful, the output of the target algorithm library (or new algorithm library) is enabled, while the output of the current algorithm library (or old algorithm library, or original algorithm library) is disabled. This achieves the effect of instantaneous intelligent service switching, ensuring that the service program remains running during the upgrade process.

[0053] In an optional embodiment, after upgrading the target device by enabling the output of the target algorithm library, the method further includes: uninstalling the current algorithm library and deleting files in the directory where the current algorithm library is located. In this embodiment, after confirming successful loading and enabling the output of the target algorithm library, the current algorithm library (or old algorithm library, or original algorithm library) can be uninstalled, and all files in the directory where the original algorithm library is located can be deleted, achieving the effect of timely cleaning up unnecessary storage resources.

[0054] In an optional embodiment, the method further includes: unloading the target algorithm library if an anomaly is determined to occur during the loading process. In this embodiment, if any anomaly occurs during the aforementioned loading of the target algorithm library (or new algorithm library) and target model library, the loading operation of the new algorithm library can be stopped, the new algorithm library can be downloaded, and the original algorithm library can be restored to operation.

[0055] In an optional embodiment, the upgrade package further includes at least one of the following: if the upgrade package includes the first algorithm library, the upgrade package also includes first version information of the first algorithm library; a first model capability set included in the first model library, wherein the first model capability set is used to indicate a set of object types and attributes allowed for detection by the target device; a package description file of the upgrade package, wherein the package description file is used to indicate at least one of the following: the type of the upgrade package, wherein the type of the upgrade package is used to indicate that the upgrade package is a package containing one or all of the first algorithm library and the first model library; the first algorithm library and its first version information; the first model library and its first model capability set, wherein the first model capability set is used to indicate a set of object types and attributes allowed for detection by the target device; the relationship between the first algorithm library and the first model library; a target identifier for the upgrade package, wherein the target identifier is used to identify the relationship between the first algorithm library and the first model library, the platform and computing power characteristics that the upgrade package needs to match; and a pre-agreed set of application programming interfaces (APIs) between the target application and the first algorithm library. In this embodiment, by separating the algorithm library and configuration, and the model and configuration from the intelligent application, and by identifying the package content (such as the type of the package to be upgraded mentioned above) through the package description file, the patch package upgrade and full upgrade of the package to be upgraded (or algorithm software package) are realized; by identifying the package inheritance relationship and platform characteristics through the source ID, the identification of packages of the same series is realized during the upgrade.

[0056] Obviously, the embodiments described above are only some embodiments of the present invention, and not all embodiments. The present invention will now be specifically described using the upgrade of security monitoring equipment as an example.

[0057] The device's application programs are primarily intelligent applications, mainly including resource scheduling, service configuration management, intelligent algorithm analysis, analysis result display, event linkage, and some personalized services unrelated to intelligent algorithms. Functions outside of intelligent services, such as preview, video playback, storage management, and system management, are general basic functions, basically consistent across different types of devices, and relatively stable. Intelligent algorithm analysis, however, is the core variable of the application programs, directly addressing user needs; once a device is released, subsequent upgrades mostly involve changes to this part.

[0058] By separating the intelligent algorithm component and upgrading it independently, that is, only upgrading the changed parts, the impact on the operation of the device can be minimized.

[0059] The algorithm software package in this embodiment of the invention is disassembled into upgrade packages for traditional devices that do not support apps and devices that do support apps. Figure 4This is a disassembly diagram of a device upgrade package according to a specific embodiment of the present invention, targeting traditional device images (corresponding to...). Figure 2 As shown in the upper half of the diagram, this embodiment adopts the following... Figure 4 The disassembly scheme shown in the upper middle part is as follows: Figure 4 As shown, in the device image upgrade file, the basic business of the firmware's basic application does not include intelligent algorithms and models. Instead, the algorithm library and configuration, and the model and model configuration are packaged into a separate algorithm software package. However, for the APP upgrade scheme adopted in related technologies (corresponding to...), Figure 2 As shown in the lower half of the diagram, this embodiment adopts the following... Figure 4 The disassembly scheme shown in the lower half is as follows: Figure 4 As shown, the basic application of the app does not include algorithms and models; instead, it packages the algorithm library and configuration, and the model and model configuration into a separate algorithm package. The following section will explain... Figure 4 The disassembly of the device upgrade package and the upgrade process in this embodiment of the invention are described.

[0060] 1. Separate the intelligent algorithms and their configurations, models and their configurations, etc., from the intelligent application and package them into an algorithm software package:

[0061] 1) Intelligent Algorithm: Professional algorithms and AI inference responsible for data processing are compiled into a dynamic library (algorithm library) (corresponding to the first algorithm library mentioned above), and apart from relying on public system libraries (provided by the device environment itself), it no longer relies on other dynamic libraries (removing version dependency issues of other libraries during the upgrade process);

[0062] 2) Algorithm configuration: Includes information such as algorithm library version;

[0063] 3) Models: There can be multiple models, which detect specific target types and target attributes, corresponding to the first model library mentioned above;

[0064] 4) Model configuration: Description package contains the capability set of multiple models (the types of targets that can be detected, and the types of attributes that can be detected for each type; for example, if the target type is a motor vehicle, the category attributes of motor vehicles include sedan, bus, etc., and the color attributes of motor vehicles include black, white, etc.) and the model file path. The algorithm library dynamically loads the model file according to this path.

[0065] 5) Package description file: Description of package contents, which may contain only the algorithm library and its configuration, only the model and its configuration, or both; description of the relationship (source ID) between the algorithm library and the model, etc.

[0066] 6) Source ID: When the algorithm software package is first packaged by the producer (first version), a source ID (corresponding to the aforementioned target identifier) ​​is assigned by the package producer. It identifies the initial relationship between the algorithm library and the model (compatibility between the algorithm library and the model), platform type and computing power (device compatibility), etc. The producer uses this source ID unchanged when iterating its version in subsequent iterations.

[0067] 7) Algorithm Library API Set: This is a set of APIs between the intelligent application and the algorithm library. The iteration of the algorithm library ensures that this API set remains unchanged.

[0068] 2. The intelligent application no longer links to the algorithm library during the compilation phase, but dynamically loads the algorithm library through dlopen during the runtime phase. As the API set between the intelligent application and the algorithm library is agreed upon as mentioned above, the calling process of the intelligent application to the algorithm library can be fixed. That is, the interface remains unchanged after the algorithm library is upgraded, and the intelligent application does not need to adapt to new interfaces.

[0069] 3. Thermal upgrade process:

[0070] 1) Version check:

[0071] a) Check if the source ID of the upgrade package is the same as the source ID of the package in use: if they are the same, they are from the same source, continue; if they are different, they are from different sources, exit the upgrade.

[0072] b) Check if the algorithm library version of the upgrade package is higher than the algorithm library version of the package in use (corresponding to the aforementioned current algorithm library): if it is higher than the current version, the new algorithm library will be used when loading; if it is lower than or equal to the current version, the current version of the algorithm library will still be used when loading.

[0073] c) Check the model capability set of the upgrade package and the model capability set of the in-use package:

[0074] ① If the current package model capability set (corresponding to the aforementioned second model capability set) is a subset of the new package model capability set (corresponding to the aforementioned first model capability set), that is, the new package model capability set adds detectable target types and target attributes without reducing them on the basis of the current package model capability set, then the new model is used;

[0075] ② If the current package model capability set is equal to the new package model capability set, then when the new algorithm library version is higher than the current version, the new model will be used accordingly; when the new algorithm library version is lower than or equal to the current version, the upgrade will be terminated.

[0076] ③ If the current package model capability set intersects with or does not intersect with the new package model capability set, exit the upgrade process;

[0077] 2) Upgrade package file storage:

[0078] The aforementioned version check has determined the algorithm library and model to be used subsequently. A new storage directory is created to save the selected algorithm library and configuration, model and configuration, and the new path (corresponding to the aforementioned target directory) is recorded.

[0079] 3) Hot loading:

[0080] a) Load the algorithm library in the newly saved path using the dlopen method, and pass the new model path to the algorithm library for model loading;

[0081] b) Configure the current smart application to the newly loaded algorithm library and disable its output. At this time, two algorithm libraries are running on the device at the same time, but the actual output is still the original algorithm library.

[0082] c) Disable the output of the original algorithm library and enable the output of the new algorithm library;

[0083] d) Deinitialize the original algorithm library. Use dlclose to uninstall the original algorithm library and delete the algorithm library and its configuration file, model and its configuration file from the original storage path.

[0084] 4) Hot loading exception handling: If any exception occurs during the aforementioned hot loading process, stop loading the algorithm library under the new path, perform a dlcose uninstallation operation on it, and restore the original algorithm library to run.

[0085] Figure 5 This is a flowchart of a device thermal upgrade method according to a specific embodiment of the present invention, which specifically includes:

[0086] S502 checks storage space and decompresses the algorithm package to a temporary directory. In practical applications, before decompressing the algorithm package, the algorithm package should be imported into the device. This can be done manually or by importing it through a protocol using the platform.

[0087] S504: Obtain the new packet source ID and check if the device has the source ID;

[0088] It should be noted that in step S504, if it is determined that the package does not exist, it is the first installation. The package content identifier is checked. If only the algorithm library or only the model (patch package) is present, it is an incomplete package and the process is exited. Otherwise, the platform and computing power characteristics of the source ID are parsed and compared with the current hardware platform. If it matches the current hardware platform, it is a usable package. After other verifications are performed and there are no errors, an actual storage directory (or allocation path) is allocated to it, and the contents of the temporary directory are transferred to the allocation path. If the determination result of step S504 is that the package does not exist, the process proceeds to step S542, that is, the temporary directory is deleted.

[0089] S506, If it is determined in step S504 that an installation path exists, then an installation path is allocated;

[0090] S508, determine whether it is a patch package; that is, determine whether the software package only includes algorithm packages or model packages;

[0091] S510, if the judgment result of the above step S508 is yes, further determine whether it is an algorithm upgrade;

[0092] S512, if the judgment result of step S510 is yes, that is, the algorithm software package only contains the algorithm library, determine whether the algorithm version is higher than the current version;

[0093] S514: When the new algorithm library version is higher than the version in use, allocate an actual storage directory (or allocation path) for it, transfer the contents of the temporary directory to the allocation path, and copy the currently used model and its configuration to the allocation path (or new path).

[0094] It should be noted that if the new algorithm library version is equal to or lower than the version in use, proceed to step S542, which is to delete the aforementioned temporary directory.

[0095] S516, if the judgment result of the above step S510 is negative, that is, the algorithm software package only includes the model, further determine whether the current model capability set is a proper subset of the new model capability set;

[0096] S518: If the current package model capability set is a proper subset of the new package model capability set, allocate an actual storage directory for it, transfer the contents of the temporary directory to the allocated path, and copy the currently used algorithm library and its configuration to the allocated path; otherwise, exit.

[0097] S520, if the judgment result of the above step S508 is negative, that is, the current algorithm software package to be upgraded includes both algorithm library and model, that is, the current software package to be upgraded is a complete package, then determine whether the current model capability set is a proper subset of the new model capability set.

[0098] S522, if the judgment result of step S520 is yes, that is, the current package model capability set is a proper subset of the new package model capability set, allocate an actual storage directory for it, transfer the model and its configuration in the temporary directory to the allocation path, and further determine whether the new package algorithm library version is higher than the current algorithm library version.

[0099] S524, If the algorithm library version of the new package is higher than or equal to the current algorithm library version, the algorithm library and its configuration in the temporary directory will be moved to the allocation path;

[0100] After steps S522 and S524, all contents in the temporary directory are transferred to the allocation path (or new path);

[0101] S526, If the algorithm library version of the new package is lower than the current algorithm library version, copy the currently used algorithm library and its configuration to the allocation path;

[0102] S528, If the judgment result of the above step S520 is negative, further determine whether the current package model capability set is equal to the new package model capability set;

[0103] It should be noted that if the judgment result of step S528 is negative, that is, if the new package model capability set is a proper subset of the current package model capability set, or if the current package model capability set intersects with or does not intersect with the new package model capability set, then the upgrade will be terminated.

[0104] S530, if the judgment result of step S528 is yes, further determine whether the new package algorithm library version is higher than the current algorithm library version;

[0105] S532, if the judgment result of step S530 is yes, that is, the current package model capability set is equal to the new package model capability set and the new package algorithm library version is higher than the current algorithm library version, allocate an actual storage directory for it and transfer the contents of the temporary directory to the allocated path.

[0106] It should be noted that if the judgment result of step S530 is negative, that is, if the new package algorithm library version is equal to or lower than the current algorithm library version, the upgrade will be terminated.

[0107] When step S514, or S518, or S524, or S526, or S532 is executed, the algorithm library and model to be used are determined, and the algorithm library and configuration, model and configuration have been transferred or copied to the allocation path (or new path). The loading operation will be performed next.

[0108] S534: Load the algorithm library and model under the new path, set the current business configuration to the newly loaded algorithm library, and disable its output; for example, the algorithm library under the newly allocated path can be loaded through dlopen, and the new model path can be passed to the algorithm library for model loading;

[0109] S536, determine if the loading and configuration process is abnormal;

[0110] S538, if the judgment result of step S536 is negative, disable the output of the original algorithm library and enable the output of the newly loaded algorithm library, that is, disable the output result of the current algorithm library and enable the output result of the new algorithm library.

[0111] S540 uninstalls the old algorithm library and deletes files in the old path, that is, deletes all files in the directory where the old algorithm library is located; for example, the original algorithm library can be uninstalled by using dlclose, and the algorithm library and its configuration file, model and its configuration file in the original storage path can be deleted.

[0112] S542, Delete the temporary directory, which is the temporary directory created when the aforementioned decompressing algorithm software package was executed;

[0113] S544, if the judgment result of step S536 above is yes, that is, if any abnormality occurs in the loading process, stop loading the algorithm library under the new path, perform the dlcose uninstallation operation on it, delete the file in the new path, and restore the original algorithm library to run.

[0114] S546, End.

[0115] In the above embodiments, the content of the algorithm package is flexible. It can be used as a patch package to upgrade only the algorithm library or model. The size of the package can be controlled more flexibly. Problems with the upgrade package can be found through loading and trial running, and can be restored in time. In addition, the intelligent service switching is completed instantly, and the business program is always in the running state during the upgrade. Other services outside the intelligent service are not changed, thereby achieving the purpose of hot upgrade.

[0116] The device upgrade method provided by this invention ensures interface compatibility during algorithm library upgrades by defining the API set of the application and algorithm library; simplifies third-party library version management during upgrades by limiting dynamic link dependencies of the algorithm library; resolves symbol conflicts between different algorithm libraries with the same API by loading dynamic libraries using the dlopen method; and allows simultaneous loading of multiple algorithm libraries using the dlopen method, migrating business configurations from the old library to the new library, and then deleting the old package, thus maintaining the application's running state and ensuring business continuity. This invention also provides an algorithm package packaging method, which separates the algorithm library and configuration, and the model and configuration from the intelligent application, and identifies the package content through a package description file, enabling patch package upgrades and full upgrades of the algorithm package. It identifies package inheritance relationships and platform characteristics through source IDs, enabling the identification of packages within the same series during upgrades. Furthermore, this invention provides an algorithm package content extraction method, which retains the higher version by comparing the algorithm library version within the upgrade package with the current version; and compares the detection target type and attribute capability set of the upgrade package model with the capability set of the current model, and retains the version with the larger capability set by combining the algorithm library version comparison.

[0117] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of the present invention.

[0118] This embodiment also provides a device upgrade apparatus. Figure 6 This is a structural block diagram of an equipment upgrade device according to an embodiment of the present invention, such as... Figure 6 As shown, the device includes:

[0119] The acquisition module 602 is used to acquire the package to be upgraded, wherein the package to be upgraded includes a first algorithm library and / or a first model library;

[0120] The comparison module 604 is used to compare the target configuration information of the package to be upgraded with the current configuration information of the current package to obtain a comparison result. The target configuration information includes first configuration information indicating the version of the first algorithm library and / or second configuration information indicating the set of model capabilities contained in the first model library. The current package includes a software package currently existing on the target device that contains the current algorithm library and the current model library. The current configuration information includes third configuration information indicating the version of the current algorithm library and fourth configuration information indicating the set of model capabilities contained in the current model library. The comparison result is used to indicate the relative importance of the target configuration information and the current configuration information.

[0121] The first determining module 606 is used to determine the target algorithm library and the target model library based on the comparison results, and store the target algorithm library and the target model library in the target directory, wherein the target algorithm library is the algorithm library with the higher version among the first algorithm library and the current algorithm library, and the target model library is the model library with the larger set of model capabilities among the first model library and the current model library;

[0122] The loading module 608 is used to load the target algorithm library and the target model library in the target directory, and to disable the output results of the target algorithm library after configuring and running the current service;

[0123] The first processing module 610 is used to upgrade the target device by enabling the output of the target algorithm library when it is determined that the target algorithm library and the target model library have been successfully loaded.

[0124] In an optional embodiment, the determining module 606 includes: a first determining unit, configured to, when the upgrade package includes only the first algorithm library, determine a first high-low relationship between the version information of the first algorithm library and the current algorithm library based on the comparison result, and determine the target algorithm library and the target model library based on the first high-low relationship; a second determining unit, configured to, when the upgrade package includes both the first algorithm library and the first model library, determine a target relationship between a first model capability set included in the first model library and a second model capability set included in the current model library based on the comparison result, and determine a second high-low relationship between the version information of the first algorithm library and the current algorithm library based on the comparison result, and determine the target algorithm library and the target model library based on the target relationship and the second high-low relationship; wherein the first model capability set and the second model capability set are both used to correspond to the set of objects and attributes that are allowed to be detected by the target device.

[0125] In an optional embodiment, the determining module 606 includes the following: a first execution unit, configured to perform the following operations when the upgrade package includes only the first algorithm library: determining the first algorithm library as the target algorithm library and determining the current model library as the target model library when the first high-low relationship indicates that the first version information of the first algorithm library is higher than the second version information of the current algorithm library; and a second execution unit, configured to perform at least one of the following operations when the upgrade package includes both the first algorithm library and the first model library: determining that the first model capability set and the second model capability set satisfy a predetermined relationship based on the target relationship, and determining that the second high-low relationship indicates that the first version information of the first algorithm library is higher than or equal to the second version information of the current algorithm library. In the case of version information, the first algorithm library is determined as the target algorithm library, and the first model library is determined as the target model library; if the first model capability set and the second model capability set satisfy a predetermined relationship based on the target relationship, and if the second high-low relationship is determined to indicate that the first version information of the first algorithm library is lower than the second version information of the current algorithm library, the current algorithm library is determined as the target algorithm library, and the first model library is determined as the target model library; if the first model capability set and the second model capability set are the same based on the target relationship, and if the second high-low relationship is determined to indicate that the first version information of the first algorithm library is higher than the second version information of the current algorithm library, the first algorithm library is determined as the target algorithm library, and the first model library is determined as the target model library.

[0126] In an optional embodiment, the above apparatus further includes: a second determining module, configured to determine the target algorithm library and the target model library under the following second predetermined conditions: when it is determined that the first model capability set and the second model capability set satisfy the predetermined relationship, and when it is determined that the first algorithm library is not included in the upgrade package, the current algorithm library is determined as the target algorithm library, and the first model library is determined as the target model library.

[0127] In an optional embodiment, the above apparatus further includes: a first execution module, configured to perform an exit operation if it is determined that the first predetermined condition and the second predetermined condition are not met.

[0128] In an optional embodiment, the comparison module 604 includes: a checking unit, configured to check the target configuration information when it is determined that the target identifier of the package to be upgraded is the same as the current identifier of the current package; and a comparison unit, configured to compare the target configuration information with the current configuration information.

[0129] In an optional embodiment, the above apparatus further includes: a parsing module, configured to parse the package description file of the package to be upgraded to obtain the type of the package to be upgraded if it is determined that there is no software package in the target device that is the same as the target identifier; a second execution module, configured to perform an exit operation if it is determined based on the type of the package to be upgraded that the package to be upgraded contains only the first algorithm library or only the first model library; and a second processing module, configured to store the package to be upgraded in the target path and install the package to be upgraded if it is determined based on the type of the package to be upgraded that the package to be upgraded contains both the first algorithm library and the first model library, and if it is determined that the current hardware platform matches the platform and computing power characteristics indicated by the target identifier.

[0130] In an optional embodiment, the loading module 608 includes: a first loading unit, configured to load the target algorithm library via dlopen and load a set of application programming interfaces (APIs) pre-agreed with the target algorithm library; and a second loading unit, configured to load the target model library via the API set.

[0131] In an optional embodiment, the loading module 608 includes: a first processing unit, configured to disable the output of the target algorithm library and continue to output the output of the current algorithm library.

[0132] In an optional embodiment, the first processing module 610 includes a second processing unit, configured to disable the output of the current algorithm library and enable the output of the target algorithm library to complete the upgrade of the target device when it is determined that the target algorithm library and the target model library have been successfully loaded.

[0133] In an optional embodiment, the above apparatus further includes: a first uninstallation module, configured to uninstall the current algorithm library and delete files in the directory where the current algorithm library is located after the target device has been upgraded by enabling the output of the target algorithm library.

[0134] In an optional embodiment, the above apparatus further includes: a second unloading module, configured to unload the target algorithm library if an anomaly is determined to exist in the loading process.

[0135] In an optional embodiment, the upgrade package further includes at least one of the following: if the upgrade package includes the first algorithm library, the upgrade package further includes first version information of the first algorithm library; a first model capability set included in the first model library, wherein the first model capability set is used to indicate a set of object types and attributes allowed for detection by the target device; a package description file of the upgrade package, wherein the package description file is used to indicate at least one of the following: the type of the upgrade package, wherein the type of the upgrade package is used to indicate that the upgrade package is a package containing one or all of the first algorithm library and the first model library; the first algorithm library and its first version information; the first model library and its first model capability set, wherein the first model capability set is used to indicate a set of object types and attributes allowed for detection by the target device; the relationship between the first algorithm library and the first model library; a target identifier for the upgrade package, wherein the target identifier is used to identify the relationship between the first algorithm library and the first model library, the platform and computing power characteristics that the upgrade package needs to match; and a pre-agreed set of application programming interfaces (APIs) between the target application and the first algorithm library.

[0136] It should be noted that the above modules can be implemented by software or hardware. For the latter, they can be implemented in the following ways, but are not limited to: all the above modules are located in the same processor; or, the above modules are located in different processors in any combination.

[0137] Embodiments of the present invention also provide a computer-readable storage medium storing a computer program, wherein the computer program is configured to perform the steps in any of the above method embodiments when executed.

[0138] In one exemplary embodiment, the aforementioned computer-readable storage medium may include, but is not limited to, various media capable of storing computer programs, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard disk, magnetic disk, or optical disk.

[0139] Embodiments of the present invention also provide an electronic device including a memory and a processor, the memory storing a computer program and the processor being configured to run the computer program to perform the steps in any of the above method embodiments.

[0140] In one exemplary embodiment, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor and the input / output device is connected to the processor.

[0141] Specific examples in this embodiment can be found in the examples described in the above embodiments and exemplary implementations, and will not be repeated here.

[0142] It is obvious to those skilled in the art that the modules or steps of the present invention described above can be implemented using general-purpose computing devices. They can be centralized on a single computing device or distributed across a network of multiple computing devices. They can be implemented using computer-executable program code, and thus can be stored in a storage device for execution by a computing device. In some cases, the steps shown or described can be performed in a different order than those described herein, or they can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. Thus, the present invention is not limited to any particular combination of hardware and software.

[0143] The above description is merely a preferred embodiment of the present invention and is not intended to limit the invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, or improvements made within the principles of the present invention should be included within the scope of protection of the present invention.

Claims

1. A method for upgrading equipment, characterized in that, include: Obtain the upgrade package, wherein the upgrade package includes a first algorithm library and / or a first model library; The target configuration information of the package to be upgraded is compared with the current configuration information of the current package to obtain a comparison result. The target configuration information includes first configuration information indicating the version of the first algorithm library and / or second configuration information indicating the set of model capabilities contained in the first model library. The current package includes a software package that the target device currently has, which contains the current algorithm library and the current model library. The current configuration information includes third configuration information indicating the version of the current algorithm library and fourth configuration information indicating the set of model capabilities contained in the current model library. The comparison result is used to indicate the relative importance of the target configuration information and the current configuration information. Based on the comparison results, the target algorithm library and the target model library are determined and stored in the target directory. The target algorithm library is the algorithm library with the higher version among the first algorithm library and the current algorithm library, and the target model library is the model library with the larger set of model capabilities among the first model library and the current model library. Load the target algorithm library and the target model library in the target directory, and disable the output of the target algorithm library after configuring and running the current business; If it is confirmed that the target algorithm library and the target model library have been successfully loaded, the upgrade of the target device is completed by enabling the output of the target algorithm library; The determination of the target algorithm library and target model library based on the comparison results includes: when the upgrade package only includes the first algorithm library, determining a first high-low relationship between the version information of the first algorithm library and the current algorithm library based on the comparison results, and determining the target algorithm library and the target model library based on the first high-low relationship; when the upgrade package includes both the first algorithm library and the first model library, determining a target relationship between a first set of model capabilities included in the first model library and a second set of model capabilities included in the current model library based on the comparison results, and determining a second high-low relationship between the version information of the first algorithm library and the current algorithm library based on the comparison results, and determining the target algorithm library and the target model library based on the target relationship and the second high-low relationship; wherein the first set of model capabilities and the second set of model capabilities are both used to correspond to the set of types and attributes of objects that are allowed to be detected by the target device; Disabling the output of the target algorithm library includes: disabling the output of the target algorithm library while continuing to output the output of the current algorithm library; If the target algorithm library and the target model library have been successfully loaded, the target device is upgraded by enabling the output of the target algorithm library, including: if the target algorithm library and the target model library have been successfully loaded, disabling the output of the current algorithm library, and upgrading the target device by enabling the output of the target algorithm library.

2. The method according to claim 1, characterized in that, The target algorithm library and the target model library are determined based on the comparison results under one of the following first predetermined conditions: If the upgrade package only includes the first algorithm library, perform the following operations: if it is determined that the first high-low relationship is used to indicate that the first version information of the first algorithm library is higher than the second version information of the current algorithm library, determine the first algorithm library as the target algorithm library, and determine the current model library as the target model library; If the upgrade package includes the first algorithm library and the first model library, perform at least one of the following operations: Based on the target relationship, it is determined that the first model capability set and the second model capability set satisfy a predetermined relationship, and it is determined that the second high-low relationship is used to indicate that the first version information of the first algorithm library is higher than or equal to the second version information of the current algorithm library. In this case, the first algorithm library is determined as the target algorithm library, and the first model library is determined as the target model library. The predetermined relationship is that the second model capability set is a proper subset or subset of the first model capability set. Based on the target relationship, it is determined that the first model capability set and the second model capability set satisfy a predetermined relationship, and it is determined that the second high-low relationship is used to indicate that the first version information of the first algorithm library is lower than the second version information of the current algorithm library. In this case, the current algorithm library is determined as the target algorithm library, and the first model library is determined as the target model library. Based on the target relationship, if the first model capability set is determined to be the same as the second model capability set, and if the second high-low relationship is determined to indicate that the first version information of the first algorithm library is higher than the second version information of the current algorithm library, then the first algorithm library is determined to be the target algorithm library, and the first model library is determined to be the target model library.

3. The method according to claim 2, characterized in that, The method further includes: The target algorithm library and the target model library are determined under the following second predetermined conditions: If it is determined that the first model capability set and the second model capability set satisfy the predetermined relationship, and if it is determined that the first algorithm library is not included in the upgrade package, the current algorithm library is determined as the target algorithm library, and the first model library is determined as the target model library.

4. The method according to claim 3, characterized in that, The method further includes: If it is determined that the first predetermined condition and the second predetermined condition are not met, an exit operation is performed.

5. The method according to claim 1, characterized in that, The target configuration information of the package to be upgraded is compared with the current configuration information of the current package, including: If it is determined that the target identifier of the package to be upgraded is the same as the current identifier of the current package, check the target configuration information; The target configuration information is compared with the current configuration information.

6. The method according to claim 5, characterized in that, The method further includes: If it is determined that there is no software package with the same target identifier in the target device, the package description file of the package to be upgraded is parsed to obtain the type of the package to be upgraded; If, based on the type of the upgrade package, it is determined that the upgrade package contains only the first algorithm library or only the first model library, an exit operation is performed. If, based on the type of the upgrade package, it is determined that the upgrade package contains the first algorithm library and the first model library, and if it is determined that the current hardware platform matches the platform and computing power characteristics indicated by the target identifier, the upgrade package is stored in the target path and installed.

7. The method according to claim 1, characterized in that, Loading the target algorithm library and the target model library from the target directory includes: The target algorithm library is loaded using dlopen, and a set of application programming interfaces (APIs) pre-agreed with the target algorithm library is also loaded. The target model library is loaded through the API set.

8. The method according to claim 1, characterized in that, After upgrading the target device by enabling the output of the target algorithm library, the method further includes: Uninstall the current algorithm library and delete the files in the directory where the current algorithm library is located.

9. The method according to claim 1, characterized in that, The method further includes: If an anomaly is detected during the loading process, the target algorithm library is uninstalled.

10. The method according to any one of claims 1-9, characterized in that, The upgrade package also includes at least one of the following: If the upgrade package includes the first algorithm library, the upgrade package also includes the first version information of the first algorithm library; The first model library includes a first model capability set, wherein the first model capability set is used to indicate the set of types and attributes of objects that the target device is allowed to detect; The package description file of the package to be upgraded, wherein the package description file is used to indicate at least one of the following: the type of the package to be upgraded, wherein the type of the package to be upgraded is used to indicate that the package to be upgraded is a package containing one or all of the first algorithm library and the first model library; the first algorithm library and the first version information of the first algorithm library; the first model library and the first model capability set included in the first model library, wherein the first model capability set is used to indicate the set of types and attributes of objects that the target device is allowed to detect; the relationship between the first algorithm library and the first model library; The target identifier of the upgrade package, wherein the target identifier is used to identify the relationship between the first algorithm library and the first model library, and the platform and computing power characteristics that the upgrade package needs to match; A pre-agreed set of application programming interface (API) sets between the target application and the first algorithm library.

11. An equipment upgrade device, characterized in that, include: An acquisition module is used to acquire the package to be upgraded, wherein the package to be upgraded includes a first algorithm library and / or a first model library; The comparison module is used to compare the target configuration information of the package to be upgraded with the current configuration information of the current package to obtain a comparison result. The target configuration information includes first configuration information indicating the version of the first algorithm library and / or second configuration information indicating the set of model capabilities contained in the first model library. The current package includes a software package currently existing on the target device that contains the current algorithm library and the current model library. The current configuration information includes third configuration information indicating the version of the current algorithm library and fourth configuration information indicating the set of model capabilities contained in the current model library. The comparison result is used to indicate the relative importance of the target configuration information and the current configuration information. The first determining module is used to determine the target algorithm library and the target model library based on the comparison results, and store the target algorithm library and the target model library in the target directory, wherein the target algorithm library is the algorithm library with the higher version among the first algorithm library and the current algorithm library, and the target model library is the model library with the larger set of model capabilities among the first model library and the current model library; The loading module is used to load the target algorithm library and the target model library in the target directory, and to disable the output results of the target algorithm library after configuring and running the current service; The first processing module is used to upgrade the target device by enabling the output of the target algorithm library when it is determined that the target algorithm library and the target model library have been successfully loaded. The first determining module is further configured to: when the upgrade package includes only the first algorithm library, determine a first high-low relationship between the version information of the first algorithm library and the current algorithm library based on the comparison result, and determine the target algorithm library and the target model library based on the first high-low relationship; when the upgrade package includes both the first algorithm library and the first model library, determine a target relationship between a first model capability set included in the first model library and a second model capability set included in the current model library based on the comparison result, and determine a second high-low relationship between the version information of the first algorithm library and the current algorithm library based on the comparison result, and determine the target algorithm library and the target model library based on the target relationship and the second high-low relationship; wherein the first model capability set and the second model capability set are both used to correspond to the set of object types and attributes that the target device is allowed to detect; The loading module is also used to disable the output of the target algorithm library and continue to output the output of the current algorithm library; The first processing module is further configured to, upon determining that the target algorithm library and the target model library have been successfully loaded, disable the output results of the current algorithm library, and enable the output of the target algorithm library to complete the upgrade of the target device.

12. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, wherein the computer program, when executed by a processor, implements the steps of the method described in any one of claims 1 to 10.

13. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the method described in any one of claims 1 to 10.

Citation Information

Patent Citations

  • Application program upgrading method and device

    CN107748668A

  • Service processing method, device and equipment

    CN112099882A