CN115827035A - Equipment upgrading method and device, storage medium and electronic device - Google Patents

Equipment upgrading method and device, storage medium and electronic device Download PDF

Info

Publication number
CN115827035A
CN115827035A CN202211386124.9A CN202211386124A CN115827035A CN 115827035 A CN115827035 A CN 115827035A CN 202211386124 A CN202211386124 A CN 202211386124A CN 115827035 A CN115827035 A CN 115827035A
Authority
CN
China
Prior art keywords
target
library
model
algorithm library
package
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211386124.9A
Other languages
Chinese (zh)
Inventor
苏昭行
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhejiang Dahua Technology Co Ltd
Original Assignee
Zhejiang Dahua Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhejiang Dahua Technology Co Ltd filed Critical Zhejiang Dahua Technology Co Ltd
Priority to CN202211386124.9A priority Critical patent/CN115827035A/en
Publication of CN115827035A publication Critical patent/CN115827035A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Stored Programmes (AREA)

Abstract

The embodiment of the invention provides a device upgrading method, a device, a storage medium and an electronic device, wherein the method comprises the following steps: acquiring a package to be upgraded, wherein the package to be upgraded comprises a first algorithm library and/or a first model library; comparing the target configuration information of the package to be upgraded with the current configuration information of the current package to obtain a comparison result, wherein the comparison result is used for indicating the height relation 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 a target algorithm library and a target model library, and forbidding an output result of the target algorithm library after configuring and operating the current service; and in the case that the target algorithm library and the target model library are determined to be loaded successfully, the target equipment is upgraded by enabling the output of the target algorithm library. The invention solves the problem of poor flexibility of the equipment upgrading method in the related technology and achieves the effect of improving the flexibility of equipment upgrading.

Description

Equipment upgrading method and device, storage medium and electronic device
Technical Field
The embodiment of the invention relates to the technical field of video monitoring, in particular to a method and a device for upgrading equipment, a storage medium and an electronic device.
Background
With the speed of equipment upgrading and the increase of the personalized requirements of users on equipment, the equipment is upgraded to become a technical problem which needs to be solved by technical personnel in various fields, and for example, security monitoring equipment is taken as an example below, after the equipment is sold, new requirements such as work clothes and work hat detection, clothes and hat style change or increase, or the requirements for optimizing the problems found in the use process of the users can be provided along with the change of the user services and scenes. The output product package with new requirements needs to be upgraded, and the upgrading mode may affect the development of user work, for example, some industries require monitoring that single-point video interruption or large-area video interruption cannot be performed, application services cannot be interrupted, and the like.
Aiming at the problem of poor flexibility of the equipment upgrading method in the related technology, an effective solution is not provided at present.
Disclosure of Invention
The embodiment of the invention provides an equipment upgrading method, an equipment upgrading device, a storage medium and an electronic device, and at least solves the problem that the equipment upgrading method in the related technology is poor in flexibility.
According to an embodiment of the present invention, there is provided a device upgrade method including: acquiring a package to be upgraded, wherein the package to be upgraded comprises a first algorithm library and/or a first model library; comparing the target configuration information of the package to be upgraded with the current configuration information of the current package to obtain a comparison result, wherein the target configuration information comprises first configuration information used for indicating the version of the first algorithm library and/or second configuration information used for indicating the model capability set contained in the first model library, the current package comprises a software package which is currently existed in a target device and contains the current algorithm library and the current model library, the current configuration information comprises third configuration information used for indicating the version of the current algorithm library and fourth configuration information used for indicating the model capability set contained in the current model library, and the comparison result is used for indicating the high-low relation 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, and storing the target algorithm library and the target model library into a target directory, wherein the target algorithm library is an algorithm library with a high version in the first algorithm library and the current algorithm library, and the target model library is a model library with a large model capability set in the first model library and the current model library; loading the target algorithm library and the target model library in the target directory, and forbidding an output result of the target algorithm library after configuring a current service and running the current service; and in the case that the target algorithm library and the target model library are determined to be successfully loaded, completing the upgrading of the target equipment by enabling the output of the target algorithm library.
In an exemplary embodiment, determining a target algorithm library and a target model library based on the comparison result includes: under the condition that the package to be upgraded only comprises the first algorithm library, determining a first high-low relation of 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 relation; under the condition that the package to be upgraded comprises the first algorithm library and the first model library, determining a target relation 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, determining a second high-low relation between 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 relation and the second high-low relation; wherein the first and second sets of model capabilities are each for a set of types and attributes that indicate objects that the target device is allowed to detect.
In an exemplary embodiment, the determining the target algorithm library and the target model library based on the comparison result when one of the following first predetermined conditions is satisfied comprises: in the case that only the first algorithm library is included in the package to be upgraded, performing the following operations: determining the first algorithm library as the target algorithm library and the current model library as the target model library in case that 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; under the condition that the package to be upgraded comprises the first algorithm library and the first model library, at least one of the following operations is executed: determining the first algorithm library as the target algorithm library and the first model library as the target model library 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 the second high-low relationship is used to indicate that first version information of the first algorithm library is higher than or equal to second version information of the current algorithm library; determining the current algorithm library as the target algorithm library and the first model library as the target model library 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 the second high-low relationship is used to indicate that first version information of the first algorithm library is lower than second version information of the current algorithm library; determining the first algorithm library as the target algorithm library and determining the first model library as the target model library if it is determined that the first model capability set is the same as the second model capability set based on the target relationship and the second high-low relationship is used to indicate that first version information of the first algorithm library is higher than second version information of the current algorithm library.
In one exemplary embodiment, the method further comprises: determining the target algorithm library and the target model library under the condition that the following second preset conditions are met: determining the current algorithm library as the target algorithm library and determining the first model library as the target model library if the first model capability set and the second model capability set are determined to meet the predetermined relationship and the first algorithm library is determined not to be included in the package to be upgraded.
In one exemplary embodiment, the method further comprises: performing an exit operation if it is determined that the first predetermined condition and the second predetermined condition are not satisfied.
In an exemplary embodiment, comparing the target configuration information of the package to be upgraded with the current configuration information of the current package includes: under the condition that the target identification of the package to be upgraded is determined to be the same as the current identification of the current package, checking the target configuration information; and comparing the target configuration information with the current configuration information.
In one exemplary embodiment, the method further comprises: under the condition that the target equipment is determined not to have the software package which is the same as the target identification, analyzing a package description file of the package to be upgraded to obtain the type of the package to be upgraded; executing an exit operation if it is determined that only the first algorithm library or only the first model library is included in the package to be upgraded based on the type of the package to be upgraded; and under the condition that the package to be upgraded comprises the first algorithm library and the first model library based on the type of the package to be upgraded and under the condition that the current hardware platform is determined to be matched with the platform and the algorithm characteristics indicated by the target identification, storing the package to be upgraded into a target path, and installing the package to be upgraded.
In one exemplary embodiment, loading the target algorithm library and the target model library in the target directory comprises: loading the target algorithm library through dlopen, and loading an Application Program Interface (API) set agreed with the target algorithm library in advance; and loading the target model library through the API set.
In one exemplary embodiment, disabling the output of the target algorithm library comprises: and forbidding the output result of the target algorithm library, and continuously outputting the output result of the current algorithm library.
In one exemplary embodiment, in the case that it is determined that the target algorithm library and the target model library have been successfully loaded, the upgrading of the target device by enabling the output of the target algorithm library comprises: and under the condition that the target algorithm library and the target model library are determined to be successfully loaded, disabling the output result of the current algorithm library, and completing the upgrading of the target equipment by enabling the output of the target algorithm library.
In one exemplary embodiment, after completing the upgrade of the target device by enabling the output of the target algorithm library, the method further comprises: and unloading the current algorithm library, and deleting the files in the directory where the current algorithm library is located.
In one exemplary embodiment, the method further comprises: and unloading the target algorithm library under the condition that the loading process is determined to have abnormity.
In an exemplary embodiment, the package to be upgraded further includes at least one of the following: under the condition that the package to be upgraded comprises the first algorithm library, the package to be upgraded further comprises 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 for indicating a set of types and attributes of objects which are allowed to be detected by the target device; the package description file of the package to be upgraded is used for indicating at least one of the following: the type of the package to be upgraded is used for indicating 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 first version information of the first algorithm library; the first model base and a first model capability set included in the first model base, wherein the first model capability set is used for indicating a set of types and attributes of objects which are allowed to be detected by the target equipment; a relationship between the first library of algorithms and the first library of models; the target identification of the package to be upgraded is used for identifying the relationship between the first algorithm library and the first model library, and the platform and the computing power characteristics of the package to be upgraded which need to be matched; and an application program interface API set between the pre-agreed target application program and the first algorithm library.
According to another embodiment of the present invention, there is also provided an apparatus upgrading apparatus including: the system comprises an acquisition module, a storage module and a processing module, wherein the acquisition module is used for acquiring a package to be upgraded, and the package to be upgraded comprises a first algorithm library and/or a first model library; a comparison module, configured to compare target configuration information of the package to be upgraded with current configuration information of a current package to obtain a comparison result, where the target configuration information includes first configuration information used to indicate a version of the first algorithm library and/or second configuration information used to indicate a model capability set included in the first model library, the current package includes a software package that includes the current algorithm library and the current model library and is currently existing in a target device, the current configuration information includes third configuration information used to indicate the version of the current algorithm library and fourth configuration information used to indicate the model capability set included in the current model library, and the comparison result is used to indicate a high-low relationship between the target configuration information and the current configuration information; the first determination module is used for determining a target algorithm library and a target model library based on the comparison result, and storing the target algorithm library and the target model library into a target directory, wherein the target algorithm library is an algorithm library with a high version in the first algorithm library and the current algorithm library, and the target model library is a model library with a large model capability set in the first model library and the current model library; a loading module, configured to load the target algorithm library and the target model library in the target directory, and disable an output result of the target algorithm library after configuring a current service and running the current service; and the first processing module is used for completing the upgrading of the target equipment by enabling the output of the target algorithm library under the condition that the target algorithm library and the target model library are determined to be loaded successfully.
According to a further embodiment of the present invention, there is also provided a computer-readable storage medium having a computer program stored thereon, wherein the computer program is arranged to, when executed, perform the steps of any of the method embodiments described above.
According to yet another embodiment of the present invention, there is also provided an electronic device, including a memory in which a computer program is stored and a processor configured to execute the computer program to perform the steps in any of the above method embodiments.
According to the method and the device, a package to be upgraded is obtained, wherein the package to be upgraded comprises a first algorithm library and/or a first model library, target configuration information of the package to be upgraded is compared with current configuration information of a current package currently existing in a target device, the target algorithm library and the target model library are determined based on a comparison result, and the target algorithm library and the target model library are stored in a target directory, wherein the target algorithm library is an algorithm library with a high version in the first algorithm library and the current algorithm library, and the target model library is a model library with a large model capability set in the first model library and the current model library; and then, loading a target algorithm library and a target model library in the target directory, forbidding an output result of the target algorithm library after configuring the current service and running the current service, and completing the upgrading of the target equipment by enabling the output of the target algorithm library when the target algorithm library and the target model library are determined to be successfully loaded. Namely, the output result of the current algorithm library is continuously used before the target algorithm library and the target model library are loaded successfully, and the output result of the target algorithm library is enabled after the successful loading is determined, so that the purpose of uninterrupted service in the equipment upgrading process is realized, namely, the intelligent service of the equipment is always in a running state during the upgrading process, and the problem of poor user experience caused by restarting the equipment or terminal service during the equipment upgrading in the related technology is avoided.
Drawings
Fig. 1 is a block diagram of a mobile terminal hardware structure of an apparatus upgrading method according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of a device upgrade file in the related art;
FIG. 3 is a flow diagram of a device upgrade method according to an embodiment of the present invention;
FIG. 4 is a schematic diagram of a device upgrade package disassembly according to an embodiment of the present invention;
FIG. 5 is a flow diagram of a method for hot upgrade of a device, in accordance with a specific embodiment of the present invention;
fig. 6 is a block diagram of a device upgrade apparatus according to an embodiment of the present invention.
Detailed Description
Hereinafter, embodiments of the present invention will be described in detail with reference to the accompanying drawings in conjunction with the embodiments.
It should be noted that the terms "first," "second," and the like in the description and claims of the present invention and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order.
The method embodiments provided in the embodiments of the present application may be executed in a mobile terminal, a computer terminal, or a similar computing device. Taking the operation on the mobile terminal as an example, fig. 1 is a block diagram of a hardware structure of the mobile terminal of the device upgrading method according to the embodiment of the present invention. As shown in fig. 1, the mobile terminal may include one or more (only one shown in fig. 1) processors 102 (the processor 102 may include, but is not limited to, a processing device such as a microprocessor MCU or a programmable logic device FPGA), and a memory 104 for storing data, wherein the mobile terminal may further include a transmission device 106 for communication functions and an input-output device 108. It will be understood by those skilled in the art that the structure shown in fig. 1 is only an illustration, and does not limit the structure of the mobile terminal. For example, the mobile terminal may also include more or fewer components than shown in FIG. 1, or have a different configuration than shown in FIG. 1.
The memory 104 may be used to store computer programs, for example, software programs and modules of application software, such as computer programs corresponding to the device upgrading method in the embodiment of the present invention, and the processor 102 executes various functional applications and data processing by running the computer programs stored in the memory 104, so as to implement the method described above. 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 examples, the memory 104 may further include memory located remotely from the processor 102, which may be connected to the mobile terminal over a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The transmission device 106 is used for receiving or transmitting data via a network. Specific examples of the network described above may include a wireless network provided by a communication provider of the mobile terminal. In one example, the transmission device 106 includes a Network adapter (NIC), which can be connected to other Network devices through a base station so as to communicate with the internet. In one example, the transmission device 106 may be a Radio Frequency (RF) module, which is used to communicate with the internet in a wireless manner.
Fig. 2 is a schematic diagram of a device upgrade file in the related art, system upgrade is performed, that is, upgrade is performed through a device image file, and an image includes all software of a device, including a file system and the like, which corresponds to a "conventional device image upgrade file" in fig. 2; in the related art, an equipment image upgrade file and an APP upgrade file are also adopted, which corresponds to "newly appeared equipment image upgrade file + APP upgrade file" in fig. 2, wherein an application service program of the equipment is developed into an APP package, and application upgrade is supported through an upgrade characteristic of the equipment APP (such as an HEOP of a company a, a DHOP of a company b, and a SDC of a company c).
However, in the device upgrading method of the related art, the system upgrading needs to restart the device, which inevitably brings about video interruption and service interruption, and the time consumption of the upgrading and restarting process is long (minute level); or, the device needs to support the APP, and the APP is upgraded in a system level, that is, different APPs are treated uniformly, the inherent functions of the APP are not concerned, and the APP is restarted, so that the service is interrupted; whether to restart the device is determined by the system APP upgrade feature. An APP upgrade of the non-restart feature takes time typically (on the order of seconds).
In this embodiment, an apparatus upgrading method is provided, and fig. 3 is a flowchart of an apparatus upgrading method according to an embodiment of the present invention, as shown in fig. 3, the flowchart includes the following steps:
step S302, acquiring a package to be upgraded, wherein the package to be upgraded comprises a first algorithm library and/or a first model library;
step S304, comparing the target configuration information of the package to be upgraded with the current configuration information of the current package to obtain a comparison result, where the target configuration information includes first configuration information used for indicating a version of the first algorithm library and/or second configuration information used for indicating a model capability set included in the first model library, the current package includes a software package which includes the current algorithm library and the current model library and is currently existed in a target device, the current configuration information includes third configuration information used for indicating the version of the current algorithm library and fourth configuration information used for indicating the model capability set included in the current model library, and the comparison result is used for indicating a high-low relationship between the target configuration information and the current configuration information;
step S306, determining a target algorithm library and a target model library based on the comparison result, and storing the target algorithm library and the target model library into a target directory, wherein the target algorithm library is an algorithm library with a high version in the first algorithm library and the current algorithm library, and the target model library is a model library with a large model capability set in the first model library and the current model library;
step S308, loading the target algorithm library and the target model library in the target directory, and forbidding an output result of the target algorithm library after configuring a current service and running the current service;
and step S310, under the condition that the target algorithm library and the target model library are determined to be loaded successfully, finishing the upgrading of the target equipment by enabling the output of the target algorithm library.
Through the steps, the package to be upgraded is obtained, wherein the package to be upgraded comprises 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 currently existing in the target equipment, the target algorithm library and the target model library are determined based on the comparison result, and the target algorithm library and the target model library are stored in a target directory, wherein the target algorithm library is an algorithm library with a high version in the first algorithm library and the current algorithm library, and the target model library is a model library with a large model capability set in the first model library and the current model library; and then, loading a target algorithm library and a target model library in the target directory, forbidding an output result of the target algorithm library after configuring the current service and running the current service, and completing the upgrading of the target equipment by enabling the output of the target algorithm library when the target algorithm library and the target model library are determined to be successfully loaded. Namely, the output result of the current algorithm library is continuously used before the target algorithm library and the target model library are loaded successfully, and the output result of the target algorithm library is enabled after the successful loading is determined, so that the purpose of uninterrupted service in the equipment upgrading process is realized, namely, the intelligent service of the equipment is always in a running state during the upgrading process, and the problem of poor user experience caused by restarting the equipment or terminal service during the equipment upgrading in the related technology is avoided.
The executing body of the above steps may be a terminal, or a terminal device, such as the above target device, or an application program in the terminal, or a processor with human-computer interaction capability configured on a storage device, or a processing device or a processing unit with similar processing capability, etc., but is not limited thereto. The following description is given by taking the terminal as an example (which is only an exemplary description, and in actual operation, other devices or modules may be used to perform the above operations).
In the above embodiment, the terminal obtains the package to be upgraded, where the package to be upgraded includes a first algorithm library and/or a first model library, where the terminal may be the target device or an application program in the terminal, and the content of the package to be upgraded in this embodiment is flexible, and may be used as a patch package to upgrade only the algorithm library or the model therein, so that the size control of the package is more flexible, and the package to be upgraded may include both the algorithm library and the model; comparing the target configuration information of the package to be upgraded with the current configuration information of the current package to obtain a comparison result, where the target configuration information may include version configuration information of the first algorithm library (i.e. the first configuration information) and/or model configuration information included in the first model library (i.e. the second configuration information), the current package is a software package currently existing in the target device and including the current algorithm library and the current model library, the current configuration information refers to configuration information of the current algorithm library (i.e. the third configuration information) and configuration information of the current model library (i.e. the fourth configuration information), and the comparison result is used to indicate a high-low relationship between the target configuration information of the package to be upgraded and the current configuration information of the current package, for example, optionally, the comparison result may be further used to indicate a target relationship between a first model capability set in the first model library in the package to be upgraded and a second model capability set in the current model library of the current package, where the first model capability set and the second model capability set are both used to correspond to a set indicating types and attributes of objects that allow the target device to detect, for example, the first model capability set includes the second model capability set, or the first model capability set is equal to the second model capability set, or the first model capability set is intersected or non-intersected with the second model capability set; then, determining a target algorithm library and a target model library based on the comparison result, and storing the target algorithm library and the target model library in a target directory, for example, taking the algorithm library with higher version information in the first algorithm library and the current algorithm library as the target algorithm library, and similarly, taking the larger one (meaning that one set really includes the other set) between the first model capability set and the second model capability set, or the more types and attributes of the detectable target types contained in the sets as the target model library, for example, the first model capability set really includes the second model capability set, or the second model capability set really includes the first model capability set; loading a target algorithm library and a target model library in a target directory, and after configuring a current service and operating the current service, forbidding an output result of the target algorithm library, wherein the current service refers to a service supported or operated by a current packet of target equipment, and at the moment, continuously outputting the output result of the current algorithm library, namely, still outputting the output result of an old algorithm library; under the condition that the target algorithm library and the target model library are determined to be loaded successfully, the target equipment is upgraded by enabling the output of the target algorithm library, namely when the target algorithm library and the target model library are determined to be loaded successfully, the output result of the new algorithm library is enabled, and in practical application, the output result of the current algorithm library is also disabled, namely the output result of the new algorithm library is output at the moment, and the output result of the old algorithm library is disabled. The purpose of uninterrupted service in the equipment upgrading process is achieved, namely, the intelligent service of the equipment is always in a running state during the upgrading process, and the problem of poor user experience caused by restarting the equipment or terminal service during the equipment upgrading in the related technology is solved, so that the problem of poor flexibility of the equipment upgrading method in the related technology is solved, and the effect of improving the flexibility of the equipment upgrading is achieved.
In an optional embodiment, determining the target algorithm library and the target model library based on the comparison result includes: under the condition that the package to be upgraded only comprises the first algorithm library, determining a first high-low relationship between the version information of the first algorithm library and the version information of 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; under the condition that the package to be upgraded comprises the first algorithm library and the first model library, determining 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, determining a second high-low relationship between version information of the first algorithm library and version information of 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 and second sets of model capabilities each correspond to a set indicating types and attributes of objects that the target device is allowed to detect. In this embodiment, when the package to be upgraded only includes the first algorithm library, that is, the package to be upgraded only includes the algorithm library but not the model, at this time, the first high-low relationship between the version information of the first algorithm library and the version information of the current algorithm library may be determined based on the comparison result, and then the target algorithm library and the target model library may be determined based on the first high-low relationship; when the package to be upgraded includes both the first algorithm library and the first model library, at this time, a target relationship between the first model capability set and the second model capability set may be determined based on the comparison result, a second high-low relationship between version information of the first algorithm library and version information of the current algorithm library may be determined based on the comparison result, and then the target algorithm library and the target model library may be determined based on the target relationship and the second high-low relationship. Through the embodiment, the purpose of determining the target algorithm library and the target model library based on the comparison result is achieved.
In an optional embodiment, the determining the target algorithm library and the target model library based on the comparison result when one of the following first predetermined conditions is satisfied comprises: in the case that only the first algorithm library is included in the package to be upgraded, performing the following operations: determining the first algorithm library as the target algorithm library and the current model library as the target model library in case that 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; under the condition that the package to be upgraded comprises the first algorithm library and the first model library, at least one of the following operations is executed: determining the first algorithm library as the target algorithm library and the first model library as the target model library 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 the second high-low relationship is used to indicate that first version information of the first algorithm library is higher than or equal to second version information of the current algorithm library; determining the current algorithm library as the target algorithm library and the first model library as the target model library 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 the second high-low relationship is used to indicate that first version information of the first algorithm library is lower than second version information of the current algorithm library; determining the first algorithm library as the target algorithm library and determining the first model library as the target model library if it is determined that the first model capability set is the same as the second model capability set based on the target relationship and if it is determined that the second high-low relationship is used to indicate that first version information of the first algorithm library is higher than second version information of the current algorithm library. In this embodiment, when the package to be upgraded only includes the first algorithm library, under the condition that 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 determined as the target algorithm library, and the current model library is determined as the target model library, that is, the algorithm library with higher version information is determined as the target algorithm library; when the package to be upgraded includes both the first algorithm library and the first model library, corresponding operations may be performed according to that the target relationship and the second high-low relationship satisfy different predetermined conditions, for example, when it is determined that the first model capability set and the second model capability set satisfy the 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 determined as the target algorithm library, and the first model library is determined as the target model library, for example, the predetermined relationship may be that the second model capability set is a proper subset, or a subset, of the first model capability; when the first model capability set and the second model capability set are determined to meet the preset relation and the first version information of the first algorithm library is lower than the second version information of the current algorithm library, determining the current algorithm library as a target algorithm library and determining the first model library as the target model library, namely, determining the higher version of the two algorithm libraries as the target algorithm library; if the first model capability set comprises a second model capability set, taking the first model library corresponding to the first model capability set as a target model library, and similarly, if the second model capability set comprises the first model capability set, taking the current model library corresponding to the second model capability set as the target model library; and when the first model capability set is determined to be the same as the second model capability set and 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 a target algorithm library and determining the first model library as the target model library. Through the embodiment, the purpose of determining the target algorithm library and the target model library based on different preset conditions met by the comparison result is achieved.
In an optional embodiment, the method further comprises: determining the target algorithm library and the target model library under the condition that the following second preset conditions are met: determining the current algorithm library as the target algorithm library and determining the first model library as the target model library if the first model capability set and the second model capability set are determined to meet the predetermined relationship and the first algorithm library is determined not to be included in the package to be upgraded. In this embodiment, when the package to be upgraded only includes the first model library and does not include the first algorithm library, when it is determined that the first model capability set and the second model capability set satisfy the predetermined relationship, the current algorithm library is determined as the target algorithm library, and the first model library is determined as the target model library.
In an optional embodiment, the method further comprises: performing an exit operation if it is determined that the first predetermined condition and the second predetermined condition are not satisfied. 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 satisfied, then an exit operation is performed, that is, the device is not upgraded any more, for example, when the version information of the first algorithm library is lower than the version of the current algorithm library and the package to be upgraded does not include the first model library, at this time, the device does not need to be upgraded; or, when the version information of the first algorithm library is lower than the version of the current algorithm library, and the first model capability set and the second model capability set are in an intersection or non-intersection relationship, the equipment does not need to be upgraded. With the present embodiment, it is achieved that the exit of the upgrade operation is performed when it is determined based on the comparison result that the first predetermined condition and the second predetermined condition are not satisfied.
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: under the condition that the target identification of the package to be upgraded is determined to be the same as the current identification of the current package, checking the target configuration information; and comparing the target configuration information with the current configuration information. In this embodiment, only 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, the target configuration information of the package to be upgraded is checked, and the target configuration information of the package to be upgraded is compared with the current configuration information of the current package. In practical application, when a producer packs a package to be upgraded (or called an algorithm software package) for the first time (a first version), the producer of the package allocates a source ID, and identifies characteristics such as an initial relationship between an algorithm library and a model (compatibility between the algorithm library and the model), a platform type, and computing power (equipment compatibility), and when the producer iterates the version, the source ID is used for the subsequent producers. Therefore, it is checked whether the source ID of the upgrade package is the same as that of the active package (or the current package): if the two packets are the same, the packet is a homologous packet and continues; if different, i.e. not the same source package, the upgrade is exited, but of course, it may be the first installation.
In an optional embodiment, the method further comprises: under the condition that the target equipment is determined not to have the software package which is the same as the target identification, analyzing a package description file of the package to be upgraded to obtain the type of the package to be upgraded; executing an exit operation under the condition that the package to be upgraded only comprises the first algorithm library or only comprises the first model library based on the type of the package to be upgraded; and under the condition that the package to be upgraded comprises the first algorithm library and the first model library based on the type of the package to be upgraded and under the condition that the current hardware platform is determined to be matched with the platform and the algorithm characteristics indicated by the target identification, storing the package to be upgraded into a target path, and installing the package to be upgraded. In this embodiment, when it is determined that a software package identical to a target identifier of a package to be upgraded does not exist in a target device, it may be that the software package is installed for the first time, a package description file of the package to be upgraded is analyzed to determine a type of the package to be upgraded, where the type of the package to be upgraded refers to that the package to be upgraded includes one or both of a first algorithm library and a first model library, and when it is determined that the package to be upgraded only includes the first algorithm library or only includes the first model library, it is an incomplete package, and then an exit operation may be performed; and when the package to be upgraded contains the first algorithm library and the first model library, analyzing the platform and the calculation force characteristics of the source ID, comparing the platform and the calculation force characteristics with the current hardware platform, and executing the installation operation according with the condition that the current hardware platform is an available package.
In an alternative embodiment, loading the target algorithm library and the target model library in the target directory includes: loading the target algorithm library through dlopen, and loading an Application Program Interface (API) set agreed with the target algorithm library in advance; and loading the target model library through the API set. In this embodiment, the target algorithm library is loaded by dlopen, and an agreed API set is loaded, that is, an interface address is obtained by dlsym according to an API name, and then the target model library is loaded through an API interface provided by the target algorithm library, for example, a storage path of the target model library is transferred to the target algorithm library to load a model.
In an alternative embodiment, disabling the output of the target algorithm library comprises: and forbidding the output result of the target algorithm library, and continuously outputting the output result of the current algorithm library. In this embodiment, the output result of the current algorithm library (or referred to as the old algorithm library) continues to be output while the output result of the target algorithm library (or referred to as the new algorithm library) is disabled, so that the purpose of uninterrupted service in the upgrading process can be achieved.
In an alternative embodiment, in the case that it is determined that the target algorithm library and the target model library have been successfully loaded, the upgrading of the target device is completed by enabling an output of the target algorithm library, including: and under the condition that the target algorithm library and the target model library are determined to be successfully loaded, disabling the output result of the current algorithm library, and completing the upgrading of the target equipment by enabling the output of the target algorithm library. In this embodiment, when it is determined that the loading has been successful, the output result of the target algorithm library (or called new algorithm library) is enabled, and the output result of the current algorithm library (or called old algorithm library, or original algorithm library) is disabled. The effect that intelligent service switching is completed instantly is achieved, and the purpose that the service program is always in a running state during upgrading is guaranteed.
In an optional embodiment, after completing the upgrade of the target device by enabling the output of the target algorithm library, the method further comprises: and unloading the current algorithm library, and deleting the files in the directory where the current algorithm library is located. In this embodiment, after the successful loading is determined and the output result of the target algorithm library is enabled, at this time, the current algorithm library (or called old algorithm library or original algorithm library) may be unloaded, and all files in the directory where the original algorithm library is located may be deleted, so as to achieve the effect of timely cleaning up redundant storage resources.
In an optional embodiment, the method further comprises: and unloading the target algorithm library under the condition that the loading process is determined to have abnormity. In this embodiment, when any abnormal condition occurs in the process of loading the target algorithm library (or the new algorithm library) and the target model library, the loading operation of the new algorithm library may be stopped, the downloading operation may be performed on the new algorithm library, and the operation of the original algorithm library may be resumed.
In an optional embodiment, the package to be upgraded further includes at least one of the following: under the condition that the package to be upgraded comprises the first algorithm library, the package to be upgraded further comprises 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 for indicating a set of types and attributes of objects which are allowed to be detected by the target device; the package description file of the package to be upgraded is used for indicating at least one of the following: the type of the package to be upgraded is used for indicating 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 first version information of the first algorithm library; the first model base and a first model capability set included in the first model base, wherein the first model capability set is used for indicating a set of types and attributes of objects which are allowed to be detected by the target equipment; a relationship between the first library of algorithms and the first library of models; the target identification of the package to be upgraded is used for identifying the relationship between the first algorithm library and the first model library, and the platform and the computing power characteristics of the package to be upgraded which need to be matched; and the pre-agreed API set of the application program interface between the target application program and the first algorithm library. In this embodiment, the algorithm library and configuration, the model and the configuration are separated from the intelligent application, and the package content (such as the type of the package to be upgraded) is identified by the package description file, so that the patch package upgrade and the complete upgrade of the package to be upgraded (or called as an algorithm software package) are realized; and identifying the package of the same series during upgrading through the inheritance relationship and the platform characteristics of the source ID identification package.
It is to be understood that the above-described embodiments are only a few, and not all, embodiments of the present invention. The invention is specifically described below with reference to upgrading of security monitoring equipment as an example.
The application service program of the equipment is mainly intelligent application and mainly comprises resource scheduling, service configuration management, intelligent algorithm analysis, analysis result display, event linkage, some personalized services which are irrelevant to the intelligent algorithm and the like. Functions such as preview, video playback, storage management, system management and the like outside the intelligent service are all general basic functions, and different types of equipment are basically consistent and relatively stable. The intelligent algorithm analysis is a core variable of an application service, the core variable is directly oriented to user appeal, and after one device is released, most of the follow-up upgrade of the device is the change of the part.
The intelligent algorithm part is stripped, independent packaging upgrading is carried out, namely only the change part is upgraded, and therefore the influence on the operation of the equipment is minimized.
The algorithm software package in the embodiment of the present invention is disassembled for a traditional device that does not support APP and a device upgrade package that supports APP, fig. 4 is a schematic diagram of disassembling the device upgrade package according to a specific embodiment of the present invention, and for a traditional device image (corresponding to the upper half of fig. 2), the present embodiment adopts a disassembling scheme shown in the upper half of fig. 4, as shown in fig. 4, in a device image upgrade file, a basic service in a basic application of firmware does not include an intelligent algorithm and a model, but packs an algorithm library and configuration, a model and model configuration into an algorithm software package, and is independent; for the APP upgrade scheme (corresponding to the lower half of fig. 2) adopted in the related art, the disassembly scheme shown in the lower half of fig. 4 is adopted in this embodiment, and as shown in fig. 4, the APP basic application does not include an algorithm and a model, but packs an algorithm library and configuration, and a model and model configuration into an algorithm software package to be independent. The following describes a disassembly part and an upgrade process of the device upgrade package according to an embodiment of the present invention with reference to fig. 4.
1. The intelligent algorithm and the configuration thereof, the model and the configuration thereof, and the like in the intelligent application program are separated and packaged into an algorithm software package:
1) The intelligent algorithm comprises the following steps: professional algorithms and AI reasoning which are responsible for data processing are compiled into a dynamic library (algorithm library) (corresponding to the first algorithm library), and the dynamic library does not depend on other dynamic libraries (the version dependence problem of other libraries in the upgrading process is removed) except a public system library (provided by the equipment environment);
2) Algorithm configuration: the method comprises the information of algorithm library version and the like;
3) Model: there may be a plurality of, detecting specific target types, target attributes, corresponding to the aforementioned first model library;
4) Model configuration: describing a capability set (types of detectable target types and types of detectable attributes of each type; for example, a target type motor vehicle, a motor vehicle with the type attribute of a car, a bus and the like, and the color attribute of the motor vehicle of black, white and the like) and a model file path of a plurality of models in the package, and dynamically loading the model file according to the path by an algorithm library;
5) Package description file: the package content description may only contain the algorithm library and its configuration, or only contain the model and its configuration, or contain all; algorithm library and model relationship (source ID) descriptions, etc.;
6) A source ID: when the producer packs the software package for the first time (the first edition), a source ID (corresponding to the target identifier) distributed by the package producer identifies the characteristics of the initial relationship between the algorithm library and the model (the compatibility between the algorithm library and the model), the platform type, the computing power (equipment compatibility) and the like; the source ID is continuously used by the subsequent producers when the versions of the subsequent producers are iterated;
7) And (3) an algorithm library API set: and appointing an API set between the intelligent application program and the algorithm library, wherein iteration of the algorithm library ensures that the API set is unchanged.
2. The intelligent application program does not need to link the algorithm library any more in the compiling stage, and the algorithm library is dynamically loaded in the running stage in a dlopen mode.
3. And (3) hot upgrading process:
1) And (3) checking the version:
a) Check if the source ID of the upgrade package is the same as the source ID of the active package: if the two packets are the same, the packet is a homologous packet and continues; if the two packages are different, namely the non-homologous packages, exiting the upgrade;
b) Check if the version of the algorithm library of the upgrade package is higher than the version of the algorithm library of the active package (corresponding to the current algorithm library mentioned earlier): if the current version is higher than the current version, a new algorithm library is used during loading; if the current version is lower than or equal to the current version, the current version algorithm library is still used during loading;
c) Checking the model capability set of the upgrade package and the model capability set of the active package:
(1) if the current package model capability set (corresponding to the second model capability set) is a subset of the new package model capability set (corresponding to the first model capability set), i.e. the new package model capability set is increased by detectable target types, target attributes without reduction on the basis of the current package model capability set, using the new model;
(2) if the current package model capability set is equal to the new package model capability set, when the version of the new algorithm library is higher than the current version, the new model is matched for use, and when the version of the new algorithm library is lower than or equal to the current version, the upgrading is quitted;
(3) if the current package model capability set is intersected or not intersected with the new package model capability set, exiting upgrading;
2) Storing the upgrade package file:
the version check determines the algorithm library and the model to be used subsequently, a storage directory is newly established, the selected algorithm library and configuration, the model and configuration are stored, and a new path (corresponding to the target directory) is recorded;
3) And (3) thermal loading:
a) Loading the saved algorithm library under the new path in a dlopen mode, and transmitting the new model path to the algorithm library for model loading;
b) Configuring the current intelligent application, setting the current intelligent application to the newly loaded algorithm library, and forbidding the output result of the newly loaded algorithm library, wherein at the moment, two algorithm libraries are simultaneously operated in the equipment, but the actually output result is still the original algorithm library;
c) Forbidding the output result of the original algorithm library, and enabling the output result of the new algorithm library;
d) The original algorithm library is reversely initialized, dlclose unloads the original algorithm library, and deletes the algorithm library and the configuration file thereof, the model and the configuration file thereof under the original storage path;
4) And (4) hot loading exception handling: and stopping loading the algorithm library under the new path when any exception occurs in the hot loading process, carrying out dlcose unloading operation on the algorithm library, and recovering the operation of the original algorithm library.
Fig. 5 is a flowchart of a device hot upgrade method according to an embodiment of the present invention, which specifically includes:
s502, checking a storage space, and decompressing the algorithm software package to a temporary directory; in practical application, before decompressing the algorithm software package, the algorithm software package is firstly imported into the equipment, and the algorithm software package can be manually imported or imported by using a platform through a protocol;
s504, obtaining a new packet source ID and inquiring whether the equipment has the source ID;
it should be noted that, in step S504, if it is determined that there is no content, the package is first installed, the package content identifier is checked, if there is only an algorithm library or only a model (patch package), the package is an incomplete package, the process exits, otherwise, the platform and the computation capability characteristics of the source ID are analyzed, the current hardware platform is compared with the current hardware platform, the package is a usable package according to the current hardware platform, after performing other verification and no error, an actual storage directory (or called as an allocation path) is allocated to the package, and the temporary directory content is transferred to the allocation path; if the determination result in step S504 is that the temporary directory does not exist, the process proceeds to step S542, i.e., the temporary directory is deleted;
s506, if it is determined in step S504 that the installation path exists, allocating an installation path;
s508, judging whether the patch package is a patch package; namely judging whether the software package only comprises an algorithm package or a model package;
s510, if the determination result in the step S508 is yes, further determining whether the algorithm is upgraded;
s512, under the condition that the judgment result in the step S510 is yes, namely only an algorithm library exists in the algorithm software package, judging whether the algorithm version is higher than the current version;
s514, when the version of the new algorithm library is higher than the version in use, distributing an actual storage directory (or called a distribution path) for the new algorithm library, transferring the content of the temporary directory to the distribution path, and copying the current model in use and the configuration thereof to the distribution path (or called a new path);
it should be noted that, when the version of the new algorithm library is equal to or lower than the current version, step S542 is performed, that is, the temporary directory is deleted;
s516, under the condition that the judgment result in the step S510 is negative, namely the algorithm software package only comprises the model, further judging whether the current model capability set is a proper subset of the new model capability set;
s518, if the current package model capability set is a proper subset of the new package model capability set, distributing an actual storage directory for the current package model capability set, transferring the content of the temporary directory to a distribution path, and copying the current in-use algorithm library and the configuration thereof to the distribution path; otherwise, quitting;
s520, under the condition that the judgment result in the step S508 is negative, namely the current algorithm software package to be upgraded comprises both an algorithm library and a model, namely the current software package to be upgraded is a complete package, at the moment, whether the current model capability set is a proper subset of the new model capability set is judged;
s522, under the condition that the judgment result in the step S520 is yes, namely the current package model capability set is a proper subset of the new package model capability set, distributing an actual storage directory for the current package model capability set, transferring the models in the temporary directory and the configuration of the models to a distribution path, and further judging whether the version of the new package algorithm library is higher than that of the current algorithm library;
s524, if the version of the new algorithm library is higher than or equal to the version of the current algorithm library, transferring the algorithm library and the configuration thereof in the temporary directory to a distribution path;
after steps S522 and S524, all the contents in the temporary directory are transferred to the distribution path (or called new path);
s526, if the version of the new algorithm library is lower than that of the current algorithm library, copying the current algorithm library and the configuration thereof to a distribution path;
s528, if the determination result in the step S520 is negative, further determining whether the current package model capability set is equal to the new package model capability set;
it should be noted that, when the determination result in the step S528 is negative, that is, the new package model capability set at this time is a true subset of the current package model capability set, or the current package model capability set intersects or does not intersect with the new package model capability set, the upgrade is exited;
s530, when the judgment result in the step S528 is yes, further judging whether the new package algorithm library version is higher than the current algorithm library version;
s532, when the judgment result in the step S530 is yes, namely the current package model capability set is equal to the new package model capability set, the version of the new package algorithm library is higher than that of the current algorithm library, distributing an actual storage directory for the new package algorithm library, and transferring the content of the temporary directory to a distribution path;
it should be noted that, when the determination result in step S530 is negative, that is, when the version of the new package algorithm library is equal to or lower than the version of the current algorithm library, the upgrade is exited;
when the step S514, or S518, or S524, or S526, or S532 is executed, the algorithm library and the model to be used subsequently are determined, and the algorithm library and the configuration, the model and the configuration are already transferred or copied to the distribution path (or the new path), and then the loading operation is executed;
s534, loading the algorithm library and the model under the new path, setting the current service configuration to the newly loaded algorithm library, and forbidding the output of the new loaded algorithm library; for example, an algorithm library under a new distribution path can be loaded in a dlopen mode, and the new model path is transmitted to the algorithm library for model loading;
s536, judging whether the loading and configuration process is abnormal;
s538, under the condition that the judgment result in the step S536 is negative, forbidding the output of the original algorithm library, and enabling the output of the newly loaded algorithm library, namely forbidding the output result of the current algorithm library and enabling the output result of the new algorithm library;
s540, unloading the old algorithm library, and deleting the old path files, namely deleting all files in the directory where the old algorithm library is located; for example, the original algorithm library can be unloaded through dlclose, and the algorithm library and the configuration file thereof, the model and the configuration file thereof under the original storage path are deleted;
s542, deleting a temporary directory, wherein the temporary directory is established when the algorithm software package is decompressed;
s544, if the determination result of the step S536 is yes, that is, if any abnormality occurs in the loading process, stopping loading the algorithm library under the new path, performing dllose unloading operation on the algorithm library, deleting the new path file, and recovering the operation of the original algorithm library;
and S546, ending.
In the embodiment, the content of the algorithm software package is flexible, and can be used as a patch package to only upgrade the algorithm library or the model in the patch package, so that the size control of the package is more flexible; the problem of the upgrade package can be found through loading and commissioning, and the upgrade package can be recovered in time; in addition, the intelligent service switching is completed instantly, the service program is always in a running state during upgrading, and other services except the intelligent service are not changed, so that the purpose of hot upgrading is achieved.
According to the equipment upgrading method provided by the embodiment of the invention, the compatibility of the interface in the upgrading process of the algorithm library is ensured by appointing the API set of the application program and the algorithm library; the three-party library version management in the upgrading process is simplified by limiting the dynamic link dependence of the algorithm library; loading a dynamic library in a dlopen mode to solve symbol conflicts of different algorithm libraries with the same API; simultaneously loading a plurality of algorithm libraries in a dlopen mode, migrating service configuration from an old library to a new library, and deleting an old package to realize that an application program keeps a running state and the service is continuous; the embodiment of the invention also provides an algorithm software package packing method, which realizes the patch package upgrading and complete upgrading of the algorithm software package by separating the algorithm library and configuration, the model and the configuration from the intelligent application and identifying the package content through the package description file; identifying the same-series packages during upgrading through the inheritance relationship and platform characteristics of the source ID identification packages; in addition, the embodiment of the invention also provides an algorithm software package content extraction method, which is characterized in that a high version is reserved by comparing the version of the algorithm library in the upgrade package with the current version; comparing the detection target type and attribute capability set of the upgrade package model with the current model capability set, and comparing by combining the algorithm library version, and reserving the version with larger capability set.
Through the above description of the embodiments, those skilled in the art can clearly understand that the method according to the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but the former is a better implementation mode in many cases. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, which is stored in a storage medium (e.g., ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal device (e.g., a mobile phone, a computer, a server, or a network device) to execute the method according to the embodiments of the present invention.
In this embodiment, an apparatus upgrading apparatus is further provided, and fig. 6 is a block diagram of a structure of an apparatus upgrading apparatus according to an embodiment of the present invention, as shown in fig. 6, the apparatus includes:
an obtaining module 602, configured to obtain a package to be upgraded, where the package to be upgraded includes a first algorithm library and/or a first model library;
a comparison module 604, configured to compare target configuration information of the package to be upgraded with current configuration information of a current package to obtain a comparison result, where the target configuration information includes first configuration information used to indicate a version of the first algorithm library and/or second configuration information used to indicate a model capability set included in the first model library, the current package includes a software package that includes the current algorithm library and the current model library and is currently existing in a target device, the current configuration information includes third configuration information used to indicate the version of the current algorithm library and fourth configuration information used to indicate the model capability set included in the current model library, and the comparison result is used to indicate a high-low relationship between the target configuration information and the current configuration information;
a first determining module 606, configured to determine a target algorithm library and a target model library based on the comparison result, and store the target algorithm library and the target model library in a target directory, where the target algorithm library is an algorithm library with a higher version in the first algorithm library and the current algorithm library, and the target model library is a model library with a larger model capability set in the first model library and the current model library;
a loading module 608, configured to load the target algorithm library and the target model library in the target directory, and disable an output result of the target algorithm library after configuring a current service and running the current service;
a first processing module 610, configured to enable output of the target algorithm library to complete upgrading of the target device if it is determined that the target algorithm library and the target model library have been successfully loaded.
In an optional embodiment, the determining module 606 includes: a first determining unit, configured to determine, based on the comparison result, a first high-low relationship between version information of the first algorithm library and version information of the current algorithm library when the package to be upgraded only includes the first algorithm library, and determine, based on the first high-low relationship, the target algorithm library and the target model library; a second determining unit, configured to determine, when the package to be upgraded includes the first algorithm library and the first model library, 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, determine a second high-low relationship between 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 and second sets of model capabilities are each for a set of types and attributes that indicate objects that the target device is allowed to detect.
In an alternative embodiment, in case one of the following first predetermined conditions is met, the determining module 606 includes: a first execution unit, configured to, if only the first algorithm library is included in the package to be upgraded, execute the following operations: in the case that 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, determining the first algorithm library as the target algorithm library and determining the current model library as the target model library; a second execution unit, configured to, in a case that the package to be upgraded includes the first algorithm library and the first model library, execute at least one of the following operations: determining the first algorithm library as the target algorithm library and the first model library as the target model library 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 the second high-low relationship is used to indicate that first version information of the first algorithm library is higher than or equal to second version information of the current algorithm library; determining the current algorithm library as the target algorithm library and the first model library as the target model library 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 the second high-low relationship is used to indicate that first version information of the first algorithm library is lower than second version information of the current algorithm library; determining the first algorithm library as the target algorithm library and determining the first model library as the target model library if it is determined that the first model capability set is the same as the second model capability set based on the target relationship and the second high-low relationship is used to indicate that first version information of the first algorithm library is higher than second version information of the current algorithm library.
In an optional embodiment, the apparatus further comprises: a second determining module, configured to determine the target algorithm library and the target model library when the following second predetermined condition is satisfied: determining the current algorithm library as the target algorithm library and determining the first model library as the target model library if the first model capability set and the second model capability set are determined to meet the predetermined relationship and the first algorithm library is determined not to be included in the package to be upgraded.
In an optional embodiment, the apparatus further comprises: a first execution module to execute an exit operation if it is determined that the first predetermined condition and the second predetermined condition are not satisfied.
In an alternative embodiment, the comparing module 604 comprises: the checking unit is used for checking the target configuration information under the condition that the target identification of the package to be upgraded is determined to be the same as the current identification of the current package; and the comparison unit is used for comparing the target configuration information with the current configuration information.
In an optional embodiment, the apparatus further comprises: the analysis module is used for analyzing the package description file of the package to be upgraded under the condition that the software package which is the same as the target identifier does not exist in the target equipment so as to obtain the type of the package to be upgraded; the second execution module is used for executing exit operation under the condition that the package to be upgraded only contains the first algorithm library or only contains the first model library based on the type of the package to be upgraded; and the second processing module is used for storing the package to be upgraded into a target path and installing the package to be upgraded under the condition that the package to be upgraded comprises the first algorithm library and the first model library and under the condition that the current hardware platform is determined to be matched with the platform and the algorithm characteristics indicated by the target identifier based on the type of the package to be upgraded.
In an alternative embodiment, the loading module 608 includes: the first loading unit is used for loading the target algorithm library through dlopen and loading an Application Program Interface (API) set agreed with the target algorithm library in advance; and the second loading unit is used for loading the target model library through the API set.
In an alternative embodiment, the loading module 608 includes: and the first processing unit is used for forbidding the output result of the target algorithm library and continuously outputting the output result of the current algorithm library.
In an optional embodiment, the first processing module 610 includes: and the second processing unit is used for disabling the output result of the current algorithm library and completing the upgrading of the target equipment by enabling the output of the target algorithm library under the condition that the target algorithm library and the target model library are determined to be successfully loaded.
In an optional embodiment, the apparatus further comprises: and the first unloading module is used for unloading the current algorithm library and deleting the files in the directory where the current algorithm library is located after the target equipment is upgraded by enabling the output of the target algorithm library.
In an optional embodiment, the apparatus further comprises: and the second unloading module is used for unloading the target algorithm library under the condition that the abnormity exists in the loading process.
In an optional embodiment, the package to be upgraded further includes at least one of the following: under the condition that the package to be upgraded comprises the first algorithm library, the package to be upgraded further comprises 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 for indicating a set of types and attributes of objects allowed to be detected by the target device; the package description file of the package to be upgraded is used for indicating at least one of the following: the type of the package to be upgraded is used for indicating 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 first version information of the first algorithm library; the first model base and a first model capability set included in the first model base, wherein the first model capability set is used for indicating a set of types and attributes of objects which are allowed to be detected by the target equipment; a relationship between the first library of algorithms and the first library of models; the target identification of the package to be upgraded is used for identifying the relationship between the first algorithm library and the first model library, and the platform and the computing power characteristics of the package to be upgraded which need to be matched; and the pre-agreed API set of the application program interface between the target application program and the first algorithm library.
It should be noted that, the above modules may be implemented by software or hardware, and for the latter, the following may be implemented, but not limited to: the modules are all positioned in the same processor; alternatively, the modules are respectively located in different processors in any combination.
Embodiments of the present invention also provide a computer-readable storage medium having a computer program stored thereon, wherein the computer program is arranged to perform the steps of any of the above-mentioned method embodiments when executed.
In an exemplary embodiment, the computer readable storage medium may include, but is not limited to: various media capable of storing computer programs, such as a usb disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a removable hard disk, a magnetic disk, or an optical disk.
Embodiments of the present invention further provide an electronic device, comprising a memory in which a computer program is stored and a processor configured to execute the computer program to perform the steps in any of the above method embodiments.
In an exemplary embodiment, the electronic apparatus 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.
For specific examples in this embodiment, reference may be made to the examples described in the above embodiments and exemplary embodiments, and details of this embodiment are not repeated herein.
It will be apparent to those skilled in the art that the various modules or steps of the invention described above may be implemented using a general purpose computing device, they may be centralized on a single computing device or distributed across a network of computing devices, and they may be implemented using program code executable by the computing devices, such that they may be stored in a memory device and executed by the computing device, and in some cases, the steps shown or described may be performed in an order different than that described herein, or they may be separately fabricated into various integrated circuit modules, or multiple ones of them may be fabricated into a single integrated circuit module. Thus, the present invention is not limited to any specific combination of hardware and software.
The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, or improvement made within the principle of the present invention shall be included in the protection scope of the present invention.

Claims (16)

1. A method for upgrading a device, comprising:
acquiring a package to be upgraded, wherein the package to be upgraded comprises a first algorithm library and/or a first model library;
comparing the target configuration information of the package to be upgraded with the current configuration information of the current package to obtain a comparison result, wherein the target configuration information comprises first configuration information used for indicating the version of the first algorithm library and/or second configuration information used for indicating the model capability set contained in the first model library, the current package comprises a software package which is currently existed in a target device and contains the current algorithm library and the current model library, the current configuration information comprises third configuration information used for indicating the version of the current algorithm library and fourth configuration information used for indicating the model capability set contained in the current model library, and the comparison result is used for indicating the high-low relation 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, and storing the target algorithm library and the target model library into a target directory, wherein the target algorithm library is an algorithm library with a high version in the first algorithm library and the current algorithm library, and the target model library is a model library with a large model capability set in the first model library and the current model library;
loading the target algorithm library and the target model library in the target directory, and forbidding an output result of the target algorithm library after configuring and running the current service;
and in the case that the target algorithm library and the target model library are determined to be successfully loaded, completing the upgrading of the target equipment by enabling the output of the target algorithm library.
2. The method of claim 1, wherein determining a target algorithm library and a target model library based on the comparison comprises:
under the condition that the package to be upgraded only comprises the first algorithm library, determining a first high-low relationship between the version information of the first algorithm library and the version information of 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;
under the condition that the package to be upgraded comprises the first algorithm library and the first model library, determining a target relation 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, determining a second high-low relation between 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 relation and the second high-low relation; wherein the first and second sets of model capabilities each correspond to a set indicating types and attributes of objects that the target device is allowed to detect.
3. The method of claim 2, wherein determining the target algorithm library and the target model library based on the comparison result if one of the following first predetermined conditions is met comprises:
in the case that only the first algorithm library is included in the package to be upgraded, performing the following operations: determining the first algorithm library as the target algorithm library and the current model library as the target model library in case that 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;
under the condition that the package to be upgraded comprises the first algorithm library and the first model library, at least one of the following operations is executed:
determining the first algorithm library as the target algorithm library and the first model library as the target model library 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 the second high-low relationship is used to indicate that first version information of the first algorithm library is higher than or equal to second version information of the current algorithm library;
determining the current algorithm library as the target algorithm library and the first model library as the target model library 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 the second high-low relationship is used to indicate that first version information of the first algorithm library is lower than second version information of the current algorithm library;
determining the first algorithm library as the target algorithm library and determining the first model library as the target model library if it is determined that the first model capability set is the same as the second model capability set based on the target relationship and the second high-low relationship is used to indicate that first version information of the first algorithm library is higher than second version information of the current algorithm library.
4. The method of claim 3, further comprising:
determining the target algorithm library and the target model library under the condition that the following second preset conditions are met:
determining the current algorithm library as the target algorithm library and determining the first model library as the target model library if the first model capability set and the second model capability set are determined to meet the predetermined relationship and the first algorithm library is determined not to be included in the package to be upgraded.
5. The method of claim 4, further comprising:
performing an exit operation if it is determined that the first predetermined condition and the second predetermined condition are not satisfied.
6. The method of claim 1, wherein comparing the target configuration information of the package to be upgraded with the current configuration information of the current package comprises:
under the condition that the target identification of the package to be upgraded is determined to be the same as the current identification of the current package, checking the target configuration information;
and comparing the target configuration information with the current configuration information.
7. The method of claim 6, further comprising:
under the condition that the target equipment is determined not to have the software package which is the same as the target identification, analyzing a package description file of the package to be upgraded to obtain the type of the package to be upgraded;
executing an exit operation if it is determined that only the first algorithm library or only the first model library is included in the package to be upgraded based on the type of the package to be upgraded;
and under the condition that the package to be upgraded comprises the first algorithm library and the first model library based on the type of the package to be upgraded and under the condition that the current hardware platform is determined to be matched with the platform and the algorithm characteristics indicated by the target identification, storing the package to be upgraded into a target path, and installing the package to be upgraded.
8. The method of claim 1, wherein loading the target algorithm library and the target model library in the target directory comprises:
loading the target algorithm library through dlopen, and loading an Application Program Interface (API) set agreed with the target algorithm library in advance;
and loading the target model library through the API set.
9. The method of claim 1, wherein disabling the output of the target algorithm library comprises:
and forbidding the output result of the target algorithm library, and continuously outputting the output result of the current algorithm library.
10. The method of claim 1, wherein in the event that it is determined that the target algorithm library and the target model library have been successfully loaded, completing the upgrade of the target device by enabling an output of the target algorithm library comprises:
and under the condition that the target algorithm library and the target model library are determined to be loaded successfully, disabling the output result of the current algorithm library, and completing the upgrading of the target equipment by enabling the output of the target algorithm library.
11. The method of claim 1, wherein after completing the upgrade of the target device by enabling the output of the target algorithm library, the method further comprises:
and unloading the current algorithm library, and deleting the files in the directory where the current algorithm library is located.
12. The method of claim 1, further comprising:
and unloading the target algorithm library under the condition that the loading process is determined to have abnormity.
13. The method according to any one of claims 1-12, wherein the package to be upgraded further comprises at least one of:
under the condition that the package to be upgraded comprises the first algorithm library, the package to be upgraded further comprises 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 for indicating a set of types and attributes of objects which are allowed to be detected by the target device;
the package description file of the package to be upgraded is used for indicating at least one of the following: the type of the package to be upgraded is used for indicating 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 first version information of the first algorithm library; the first model base and a first model capability set included in the first model base, wherein the first model capability set is used for indicating a set of types and attributes of objects which are allowed to be detected by the target equipment; a relationship between the first library of algorithms and the first library of models;
the target identification of the package to be upgraded is used for identifying the relationship between the first algorithm library and the first model library, and the platform and the computing power characteristics of the package to be upgraded which need to be matched;
and the pre-agreed API set of the application program interface between the target application program and the first algorithm library.
14. An apparatus upgrade device, comprising:
the system comprises an acquisition module, a storage module and a processing module, wherein the acquisition module is used for acquiring a package to be upgraded, and the package to be upgraded comprises a first algorithm library and/or a first model library;
a comparison module, configured to compare target configuration information of the package to be upgraded with current configuration information of a current package to obtain a comparison result, where the target configuration information includes first configuration information used to indicate a version of the first algorithm library and/or second configuration information used to indicate a model capability set included in the first model library, the current package includes a software package that includes the current algorithm library and the current model library and is currently existing in a target device, the current configuration information includes third configuration information used to indicate the version of the current algorithm library and fourth configuration information used to indicate the model capability set included in the current model library, and the comparison result is used to indicate a high-low relationship between the target configuration information and the current configuration information;
the first determination module is used for determining a target algorithm library and a target model library based on the comparison result, and storing the target algorithm library and the target model library into a target directory, wherein the target algorithm library is an algorithm library with a high version in the first algorithm library and the current algorithm library, and the target model library is a model library with a large model capability set in the first model library and the current model library;
the loading module is used for loading the target algorithm library and the target model library in the target directory and forbidding an output result of the target algorithm library after configuring the current service and running the current service;
and the first processing module is used for completing the upgrading of the target equipment by enabling the output of the target algorithm library under the condition that the target algorithm library and the target model library are determined to be loaded successfully.
15. A computer-readable storage medium, in which a computer program is stored, which computer program, when being executed by a processor, carries out the steps of the method of one of claims 1 to 13.
16. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the steps of the method as claimed in any one of claims 1 to 13 when executing the computer program.
CN202211386124.9A 2022-11-07 2022-11-07 Equipment upgrading method and device, storage medium and electronic device Pending CN115827035A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211386124.9A CN115827035A (en) 2022-11-07 2022-11-07 Equipment upgrading method and device, storage medium and electronic device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211386124.9A CN115827035A (en) 2022-11-07 2022-11-07 Equipment upgrading method and device, storage medium and electronic device

Publications (1)

Publication Number Publication Date
CN115827035A true CN115827035A (en) 2023-03-21

Family

ID=85526964

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211386124.9A Pending CN115827035A (en) 2022-11-07 2022-11-07 Equipment upgrading method and device, storage medium and electronic device

Country Status (1)

Country Link
CN (1) CN115827035A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116932012A (en) * 2023-09-15 2023-10-24 合肥康芯威存储技术有限公司 Memory firmware upgrading method, device and medium based on data verification

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116932012A (en) * 2023-09-15 2023-10-24 合肥康芯威存储技术有限公司 Memory firmware upgrading method, device and medium based on data verification

Similar Documents

Publication Publication Date Title
CN111061484B (en) Code compiling method, device, server, user terminal and readable medium
CN107832100B (en) APK plug-in loading method and terminal thereof
CN111045714B (en) Firmware updating method and device, earphone and computer readable storage medium
CN108572845B (en) Upgrading method of distributed micro-service cluster and related system
CN111309335B (en) Compiling method and device of plug-in application and computer readable storage medium
CN106897095B (en) Method and device for hot repairing application program, readable storage medium and computing equipment
CN109800005B (en) Client hot update method and device
CN109725952B (en) Method, system and related device for application program plug-in
CN115827035A (en) Equipment upgrading method and device, storage medium and electronic device
CN112988169A (en) Application installation method and device, terminal equipment, server and storage medium
CN110837391B (en) Application program hot updating method and device, storage medium and electronic equipment
CN106557404B (en) Application control method and mobile terminal
CN111708548A (en) Software installation method, device, equipment and storage medium
CN104375854A (en) Application updating and downloading method and user terminal
CN110046100B (en) Packet testing method, electronic device and medium
CN112214413B (en) Application program testing method, device, equipment and storage medium
CN110308914B (en) Upgrade processing method, device, equipment, system and computer readable storage medium
CN111506388A (en) Container performance detection method, container management platform and computer storage medium
CN111143033A (en) Operation execution method and device based on scalable operating system
CN115277398A (en) Cluster network configuration method and device
EP4086756A1 (en) Method and apparatus for processing virtual machine component
CN114968776A (en) Application program detection method and device
CN113010195B (en) System upgrading method, storage medium and terminal equipment
CN114610331A (en) Software installation method and system
CN112463228A (en) Storage pool hybrid deployment method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination