Detailed Description
The present invention will be described in further detail with reference to the accompanying drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not limiting of the invention. It should be further noted that, for the convenience of description, only some of the structures related to the present invention are shown in the drawings, not all of the structures.
Fig. 1 is a flowchart of a service data method according to an embodiment of the present invention, where the embodiment is applicable to issue service data, and typically, the method may be applied to intelligent analysis based on video streams. The method can be executed by a business data device, and the device can be realized by software and/or hardware. Referring to fig. 1, the method specifically includes the following steps:
and step 110, classifying the services to be distributed according to the equipment codes, the algorithm models and the distribution control states of the services to be distributed based on the decision tree model so as to divide the services to be distributed into service groups to be distributed.
The service to be distributed is various services configured by the user in batch, and the configuration information of the service comprises relevant information such as equipment codes, algorithm models, deployment and control states and the like.
The decision tree is a basic classification and regression method, and in this embodiment, a classification model of the decision tree is used. The model is a tree structure for classifying examples, and data is classified and generalized through the sequence of feature selection.
In general, in order to save analysis resources in an intelligent analysis system, analysis units in the intelligent analysis system are divided according to different algorithm models, and each analysis unit only loads a corresponding algorithm model and only supports services associated with the algorithm model. In addition, in an actual application scenario, different services need to be analyzed in different time periods, that is, time-period distribution needs to be performed, and therefore, in order to reduce the influence caused by distribution time switching, services in the same distribution state need to be allocated to the same group for processing.
Therefore, in the embodiment, the device code, the algorithm model and the deployment state are used as the feature selection points of the sorting combination of the services to be distributed.
Specifically, the services to be distributed configured by the user in batch are obtained, configuration information such as equipment codes, algorithm models and distribution control states of the services to be distributed is collected and arranged in a container queue, the equipment codes, the algorithm models and the distribution control states are respectively used as a first dictionary sequence, a second dictionary sequence and a third dictionary sequence based on a decision tree model, and the services in the container queue are classified and ordered according to the dictionary sequence.
Illustratively, table 1 shows the traffic to be distributed before sorting:
service ID
|
Camera encoding
|
Algorithm model
|
Whether to deploy or not
|
ruletype1
|
Camera3
|
Model1
|
Is that
|
ruletype2
|
Camera2
|
Model2
|
Whether or not
|
ruletype3
|
Camera1
|
Model3
|
Is that
|
ruletype4
|
Camera2
|
Model2
|
Whether or not
|
ruletype5
|
Camera3
|
Model1
|
Is that |
Based on a decision tree model, according to the device code, the algorithm model and the deployment and control state of the service to be distributed, the service to be distributed after the service to be distributed is classified is as follows:
in the above table, two services to be distributed, whose service IDs are Ruletype1 and Ruletype5, may be divided into the same service group to be distributed, where the service IDs are Ruletype2 and Ruletype4 are used as the same service group to be distributed, and the service to be distributed, whose service ID is Ruletype3, is used individually as a group of service groups to be distributed. By utilizing the decision tree model, the automatic combination of the services to be distributed is realized according to the equipment codes, the algorithm model and the deployment and control state of the services to be distributed, and the combination efficiency of the services to be distributed is improved.
Step 120, sending the service group to be distributed to a target analysis unit, for instructing the target analysis unit to analyze the received service group.
The target analysis unit is an actual calculation unit for executing intelligent analysis, and each target analysis unit is loaded with a corresponding algorithm model. And distributing the service group to be distributed to a target analysis unit which is the same as the algorithm model of the service group to be distributed, and analyzing the received service group through the target analysis unit.
In the technical scheme of the embodiment, the service to be distributed is classified based on a decision tree model according to the equipment code, the algorithm model and the deployment and control state of the service to be distributed, so that the service to be distributed is divided into service groups to be distributed; and further, the service group to be distributed is sent to the target analysis unit for instructing the target analysis unit to analyze the received service group. The automatic sorting and combining of the services are realized based on the classification tree feature selection, the combining efficiency of the services to be distributed is improved, the batch issuing of the services to be distributed is realized, and the labor cost is saved.
Fig. 2 is a flowchart of another service distribution method according to an embodiment of the present invention. The embodiment of the present invention further refines step 210 on the basis of the above-mentioned embodiment.
With further reference to fig. 3, in this embodiment, the decision tree model includes an apparatus coding feature selection point, an algorithm model feature selection point, and a deployment and control state feature selection point, where the apparatus coding feature selection point is a parent node of the algorithm model feature selection point, and the algorithm model feature selection point is a parent node of the deployment and control state feature selection point.
Specifically, the order of the feature selection points in the decision tree is determined according to the information gain of the variables, and the feature selection points with larger information gain are ranked more front in the hierarchy of the decision number. In this embodiment, the order of the information gain of the feature selection points calculated by the training data set is camera encoding > algorithm model > deployment time. Therefore, in this embodiment, the device coding feature selection point is used as a parent node of the algorithm model feature selection point, and the algorithm model feature selection point is used as a parent node of the deployment and control state feature selection point.
Wherein the information entropy represents the uncertainty of the random variable; the conditional entropy represents the uncertainty of a random variable under a certain condition; the information gain is equal to the information entropy minus the conditional entropy, representing the degree of information uncertainty reduction under certain conditions.
It should be noted that the sorting manner of the feature selection points in this embodiment is only an example, and different hierarchical sorting manners of the decision tree feature selection points may be obtained for different training data sets.
Referring to fig. 2, the method specifically includes:
step 210, selecting points based on the device coding features, and classifying the services to be distributed according to the device codes of the services to be distributed to obtain service groups to be distributed associated with the device codes.
In this embodiment, first, a point is selected based on the device coding feature of the decision tree model, and the services to be distributed are classified according to the device codes of the services to be distributed, so that the services to be distributed with the same device codes are grouped into a group, so as to obtain a service group to be distributed associated with the device codes.
And step 220, selecting points based on the characteristics of the algorithm model, and classifying the service group to be distributed associated with the equipment codes according to the algorithm model of the service to be distributed so as to obtain the service group to be distributed associated with the algorithm model.
After the service group to be distributed with the same equipment code is obtained, the service group to be distributed with the same equipment code is classified according to the algorithm model of the service to be distributed based on the algorithm model feature selection points of the decision tree model, so that the services to be distributed with the same equipment code and algorithm model are divided into a group to obtain the service group to be distributed associated with the algorithm model.
And 230, selecting points based on the deployment state characteristics, and grouping the service groups to be distributed associated with the algorithm model according to the deployment state of the service to be distributed to obtain the service groups to be distributed associated with the deployment state.
After the service groups to be distributed with the same equipment codes and the same algorithm models are obtained, the service groups to be distributed with the same equipment codes and the same algorithm models are classified according to the deployment and control states of the services to be distributed based on the deployment and control state feature selection points of the decision tree models, so that the services to be distributed with the same equipment codes, the same algorithm models and the same deployment and control states are divided into a group to obtain the service groups to be distributed associated with the deployment and control states.
Step 240, issuing the service group to be distributed to a target analysis unit, for instructing the target analysis unit to analyze the received service group.
Specifically, issuing the service group to be distributed to a target analysis unit includes:
issuing the service groups to be distributed associated with different deployment and control states to different target analysis units;
and issuing the service groups to be distributed associated with the same deployment and control state to the same target analysis unit.
In this embodiment, the camera codes, the algorithm models, and the deployment states of the services to be distributed in the service group to be distributed associated with the deployment state are all the same, so that the services to be distributed with the same camera codes, algorithm models, and deployment states form the same service group to be distributed, and the service group to be distributed is distributed to the target analysis unit.
Optionally, issuing the service group to be distributed to a target analysis unit, including:
if the number of the services to be distributed in the service group to be distributed associated with any deployment state is detected to be smaller than the threshold value of the number of the grouped services, the services to be distributed are continuously acquired, the acquired services to be distributed are classified until the number of the services to be distributed in the service group to be distributed associated with the deployment state is detected to be larger than or equal to the threshold value of the number of the grouped services, and the service group to be distributed associated with the deployment state is sent to a target analysis unit.
Illustratively, when the classified services to be distributed are combined, if the number of the services in the service group to be distributed is 1, the services to be distributed may be combined with the newly added services to be distributed, and the recombined services to be distributed are sent to the target analysis unit.
According to the technical scheme of the embodiment, the device codes, the algorithm model and the deployment and control state are used as the feature selection points of the decision tree model, the services to be distributed are distributed and sequenced, the combination efficiency of the services to be distributed is improved, and efficient batch distribution of the services to be distributed is realized.
On the basis of the foregoing embodiment, before issuing the service groups to be distributed associated with the same deployment and control state to the same target analysis unit, the method further includes:
and if the number of the services to be distributed in the service group to be distributed associated with any deployment and control state is greater than the threshold value of the number of the one-way services, grouping the service group to be distributed so that the number of the services to be distributed in each group after grouping is less than or equal to the threshold value of the number of the one-way services.
The single-path service quantity threshold is the upper limit of the service quantity which can be analyzed by a single target analysis unit.
Illustratively, if the threshold of the number of single-path services is 3, and the number of services to be distributed in a service group to be distributed associated with any deployment state is 5, the service group to be distributed may be grouped into a service group to be distributed with a service number of 3 and a service number of 2, so that the number of services to be distributed in each group after grouping is less than or equal to the threshold of the number of single-path services, so as to ensure that the target analysis unit can provide sufficient analysis capability for the service group to be distributed.
Fig. 4 is a schematic structural diagram of a service distribution apparatus according to an embodiment of the present invention, where the apparatus is capable of executing a service distribution method according to an embodiment of the present invention, and has functional modules and beneficial effects corresponding to the execution method. As shown in fig. 4, the apparatus may specifically include:
the service classification module 310 is configured to classify the service to be distributed according to the device code, the algorithm model, and the deployment and control state of the service to be distributed based on the decision tree model, so as to classify the service to be distributed into a service group to be distributed.
The service issuing module 320 is configured to issue the service group to be distributed to a target analysis unit, and instruct the target analysis unit to analyze the received service group.
Specifically, the decision tree model comprises an equipment coding feature selection point, an algorithm model feature selection point and a deployment and control state feature selection point, the equipment coding feature selection point is a father node of the algorithm model feature selection point, and the algorithm model feature selection point is a father node of the deployment and control state feature selection point;
correspondingly, the service classification module 310 is specifically configured to: based on the equipment coding feature selection point, classifying the service to be distributed according to the equipment coding of the service to be distributed so as to obtain a service group to be distributed related to the equipment coding;
based on the algorithm model feature selection points, classifying the service group to be distributed associated with the equipment codes according to the algorithm model of the service to be distributed so as to obtain the service group to be distributed associated with the algorithm model;
and based on the deployment and control state feature selection points, classifying the service group to be distributed associated with the algorithm model according to the deployment and control state of the service to be distributed so as to obtain the service group to be distributed associated with the deployment and control state.
The service issuing module 320 is specifically configured to: issuing the service groups to be distributed associated with different deployment and control states to different target analysis units;
and issuing the service groups to be distributed associated with the same deployment and control state to the same target analysis unit.
Optionally, the apparatus further includes a determining module and a service grouping module, where the determining module is configured to determine whether the number of services to be distributed in the service group to be distributed associated with any deployment and control state is greater than a threshold of the number of single-path services;
and the grouping module is used for grouping the service groups to be distributed if the number of the services to be distributed in the service groups to be distributed associated with any deployment and control state is greater than the threshold value of the number of the single-path services, so that the number of the services to be distributed in each group after grouping is less than or equal to the threshold value of the number of the single-path services.
Optionally, the determining module is further configured to determine whether the number of the to-be-distributed services in the to-be-distributed service group associated with any deployment and control state is smaller than the threshold of the number of the packet services.
The service classification module 310 is further specifically configured to, if the number of services to be distributed in the service group to be distributed associated with any deployment state is smaller than the threshold of the number of packet services, continue to acquire the services to be distributed, and classify the acquired services to be distributed until the number of services to be distributed in the service group to be distributed associated with the deployment state is greater than or equal to the threshold of the number of packet services, where the service issuing module 320 is configured to issue the service group to be distributed associated with the deployment state to the target analysis unit.
The service distribution device provided by the embodiment of the invention can execute the service distribution method provided by any embodiment of the invention, and has corresponding functional modules and beneficial effects of the execution method.
Fig. 5 is a schematic structural diagram of a service distribution device according to an embodiment of the present invention. Fig. 5 illustrates a block diagram of an exemplary device 12 suitable for use in implementing embodiments of the present invention. The device 12 shown in fig. 5 is only an example and should not bring any limitations to the functionality and scope of use of the embodiments of the present invention.
As shown in FIG. 5, device 12 is in the form of a general purpose computing device. The components of device 12 may include, but are not limited to: one or more processors or processing units 16, a system memory 28, and a bus 18 that couples various system components including the system memory 28 and the processing unit 16.
Bus 18 represents one or more of any of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, and a processor or local bus using any of a variety of bus architectures.
Device 12 typically includes a variety of computer system readable media. Such media may be any available media that is accessible by device 12 and includes both volatile and nonvolatile media, removable and non-removable media.
The system memory 28 may include computer system readable media in the form of volatile memory, such as Random Access Memory (RAM)30 and/or cache memory 32. Device 12 may further include other removable/non-removable, volatile/nonvolatile computer system storage media. By way of example only, storage system 34 may be used to read from and write to non-removable, nonvolatile magnetic media (not shown in FIG. 5, and commonly referred to as a "hard drive"). Although not shown in FIG. 5, a magnetic disk drive for reading from and writing to a removable, nonvolatile magnetic disk (e.g., a "floppy disk") and an optical disk drive for reading from or writing to a removable, nonvolatile optical disk (e.g., a CD-ROM, DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to bus 18 by one or more data media interfaces. Memory 28 may include at least one program product having a set (e.g., at least one) of program modules that are configured to carry out the functions of embodiments of the invention.
A program/utility 40 having a set (at least one) of program modules 42 may be stored, for example, in memory 28, such program modules 42 including, but not limited to, an operating system, one or more application programs, other program modules, and program data, each of which examples or some combination thereof may comprise an implementation of a network environment. Program modules 42 generally carry out the functions and/or methodologies of the described embodiments of the invention.
Device 12 may also communicate with one or more external devices 14 (e.g., keyboard, pointing device, display 24, etc.), with one or more devices that enable a user to interact with device 12, and/or with any devices (e.g., network card, modem, etc.) that enable device 12 to communicate with one or more other computing devices. Such communication may be through an input/output (I/O) interface 22. Also, the device 12 may communicate with one or more networks (e.g., a Local Area Network (LAN), a Wide Area Network (WAN), and/or a public network, such as the Internet) via the network adapter 20. As shown, the network adapter 20 communicates with the other modules of the device 12 via the bus 18. The processing unit 16 executes various functional applications and data processing by executing programs stored in the system memory 28, for example, to implement a service distribution method provided by an embodiment of the present invention.
An embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the service distribution method according to the foregoing embodiment of the present invention. Wherein, the method comprises the following steps:
classifying the services to be distributed according to equipment codes, algorithm models and deployment and control states of the services to be distributed based on a decision tree model so as to divide the services to be distributed into service groups to be distributed;
and sending the service group to be distributed to a target analysis unit for indicating the target analysis unit to analyze the received service group.
Computer storage media for embodiments of the invention may employ any combination of one or more computer-readable media. The computer readable medium may be a computer readable signal medium or a computer readable storage medium. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples (a non-exhaustive list) of the computer readable storage medium would include the following: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
A computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
Computer program code for carrying out operations for aspects of the present invention may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C + + or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
It is to be noted that the foregoing is only illustrative of the preferred embodiments of the present invention and the technical principles employed. It will be understood by those skilled in the art that the present invention is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, although the present invention has been described in greater detail by the above embodiments, the present invention is not limited to the above embodiments, and may include other equivalent embodiments without departing from the spirit of the present invention, and the scope of the present invention is determined by the scope of the appended claims.