Algorithm scheduling method, device, computer equipment and medium for camera
By training the algorithm scheduling model, and automatically predicting and configuring the scheduling scheme of intelligent cameras, the problem of low scheduling efficiency and accuracy in the existing technology is solved, and fully automated and efficient scheduling is achieved.
Patent Information
- Application Number
- CN202211710090.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-29
- Publication Date
- 2025-02-14
- Estimated Expiration
- 2042-12-29
AI Technical Summary
In the prior art, the algorithm scheduling efficiency and accuracy of smart cameras are low, and require manual operation, which can easily lead to configuration errors and repeated work.
By obtaining the basic information and scheduling scheme of the camera, establishing association relationships, building training samples, and training algorithm scheduling models, the automatic scheduling scheme prediction and configuration of the target camera are achieved.
It improves the robustness and automation of the algorithm scheduling process, and enhances the efficiency and accuracy of camera algorithm scheduling.
Smart Images

Figure CN116170660B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of artificial intelligence technology, and in particular to an algorithm scheduling method, device, computer equipment and medium for a camera. Background Art
[0002] With the development of artificial intelligence technology, smart cameras are becoming more and more popular. Various smart cameras with different algorithm capabilities are covered in different application scenarios, such as public transportation scenarios, commercial shopping scenarios, medical scenarios, etc. The increasing number of smart cameras has also brought about the problem of time-consuming and labor-intensive algorithm scheduling of cameras. At present, the operation of algorithm scheduling mainly adopts manual scheduling to deploy different algorithms for different cameras to adapt to the application scenarios.
[0003] However, for multifunctional smart cameras, it is necessary to adjust their running algorithms according to real-time scene information to achieve different functions. Obviously, if manual scheduling is adopted, the manual operation process will be cumbersome, and when facing new application scenarios, manual scheduling will lead to a series of problems such as error-prone configuration, repeated debugging, and repeated work. Therefore, how to effectively improve the efficiency and accuracy of camera algorithm scheduling has become an urgent problem to be solved. Summary of the invention
[0004] In view of this, an embodiment of the present invention provides a method, apparatus, computer equipment and medium for algorithm scheduling of a camera to solve the problem of low efficiency and accuracy of algorithm scheduling of a camera.
[0005] In a first aspect, an embodiment of the present invention provides an algorithm scheduling method for a camera, the algorithm scheduling method comprising:
[0006] Obtain basic information of N cameras and the scheduling scheme used, where the scheduling scheme includes running time, focal length, and scheduling algorithm, and N is an integer greater than zero;
[0007] Traversing the N cameras, respectively establishing association relationships between basic information of the N cameras and scheduling schemes, and obtaining at least one association relationship;
[0008] The basic information and the scheduling scheme having an associated relationship constitute a training sample, and at least one training sample is obtained. The preset algorithm scheduling model is trained using all the training samples to obtain a trained algorithm scheduling model.
[0009] Inputting the acquired target basic information of the target camera into the trained algorithm scheduling model to predict the scheduling algorithm, and obtaining a target scheduling solution corresponding to the target camera;
[0010] The algorithm in the target camera is configured as the scheduling algorithm in the target scheduling scheme, and the working time and lens configuration of the target camera are updated according to the running time and focal length in the target scheduling scheme.
[0011] In a second aspect, an embodiment of the present invention provides an algorithm scheduling device for a camera, the algorithm scheduling device comprising:
[0012] An information acquisition module, used to obtain basic information of N cameras and the scheduling scheme used, wherein the scheduling scheme includes running time, focal length, and scheduling algorithm, where N is an integer greater than zero;
[0013] A relationship establishment module, used to traverse the N cameras, respectively establish association relationships between the basic information of the N cameras and the scheduling scheme, and obtain at least one association relationship;
[0014] A model training module is used to form a training sample from the basic information and the scheduling scheme that have an associated relationship, obtain at least one training sample, and use all the training samples to train the preset algorithm scheduling model to obtain a trained algorithm scheduling model;
[0015] A scheme determination module is used to input the acquired target basic information of the target camera into the trained algorithm scheduling model to predict the scheduling algorithm, and obtain a target scheduling scheme corresponding to the target camera;
[0016] The algorithm scheduling module is used to configure the algorithm in the target camera as the scheduling algorithm in the target scheduling scheme, and update the working time and lens configuration of the target camera according to the running time and focal length in the target scheduling scheme.
[0017] In a third aspect, an embodiment of the present invention provides a computer device, comprising a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the processor implements the algorithm scheduling method as described in the first aspect when executing the computer program.
[0018] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the algorithm scheduling method as described in the first aspect is implemented.
[0019] Compared with the prior art, the embodiments of the present invention have the following beneficial effects:
[0020] The basic information of N cameras and the scheduling scheme used are obtained, the scheduling scheme includes running time, focal length, and scheduling algorithm, the N cameras are traversed, and the association relationship between the basic information of the N cameras and the scheduling scheme is established respectively to obtain at least one association relationship, and the basic information and scheduling scheme with the association relationship constitute a training sample to obtain at least one training sample, and all the training samples are used to train the preset algorithm scheduling model to obtain the trained algorithm scheduling model, and the target basic information of the target camera is input into the trained algorithm scheduling model to predict the scheduling algorithm to obtain the target scheduling scheme corresponding to the target camera, and the algorithm in the target camera is configured as the scheduling algorithm in the target scheduling scheme, and the working time and lens configuration of the target camera are updated according to the running time and focal length in the target scheduling scheme, and the camera deployment information and scene information are used to establish an association relationship with the camera scheduling scheme, and the training sample is determined according to the association relationship to train the algorithm scheduling model, thereby improving the robustness of the algorithm scheduling process, realizing the full automation of the camera algorithm scheduling process, and thereby improving the efficiency and accuracy of the camera algorithm scheduling. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0022] Figure 1 This is a schematic diagram of an application environment of an algorithm scheduling method for a camera provided in Embodiment 1 of the present invention;
[0023] Figure 2 1 is a flow chart of an algorithm scheduling method for a camera provided in Embodiment 1 of the present invention;
[0024] Figure 3 is a structural diagram of an algorithm scheduling device for a camera provided in Embodiment 2 of the present invention;
[0025] Figure 4 It is a structural diagram of a computer device provided in Embodiment 3 of the present invention. DETAILED DESCRIPTION
[0026] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present invention. However, it should be clear to those skilled in the art that the present invention may be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present invention.
[0027] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, integers, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or combinations thereof.
[0028] It should also be understood that the term "and / or" used in the present description and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.
[0029] As used in the present specification and the appended claims, the term "if" may be interpreted as "when" or "upon" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is detected" may be interpreted as meaning "upon determination" or "in response to determining" or "upon detection of [described condition or event]" or "in response to detecting [described condition or event]", depending on the context.
[0030] In addition, in the description of the present specification and the appended claims, the terms "first", "second", "third", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.
[0031] References to "one embodiment" or "some embodiments" etc. described in the present specification mean that one or more embodiments of the present invention include specific features, structures or characteristics described in conjunction with the embodiment. Therefore, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.
[0032] The embodiments of the present invention can acquire and process relevant data based on artificial intelligence technology. Artificial Intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.
[0033] AI basic technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing technology, operation / interaction systems, mechatronics, etc. AI software technologies mainly include computer vision technology, robotics technology, biometrics technology, speech processing technology, natural language processing technology, and machine learning / deep learning.
[0034] It should be understood that the order of execution of the steps in the following embodiments does not imply a precedence of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.
[0035] In order to illustrate the technical solution of the present invention, specific embodiments are provided below for illustration.
[0036] The algorithm scheduling method for a camera provided in the first embodiment of the present invention can be applied in the following aspects: Figure 1 In an application environment, the client communicates with the server. The client includes but is not limited to PDAs, desktop computers, laptops, ultra-mobile personal computers (UMPCs), netbooks, cloud terminal devices, personal digital assistants (PDAs) and other computer devices. The server can be an independent server or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms.
[0037] Both the client and the server can be deployed in a cloud environment, using computer devices and servers with high computing power and large storage space. The server communicates with at least one camera. The camera can also be replaced with a camera, a video recorder, a handheld camera or other image acquisition device. The camera is deployed in a specific application scenario. The application scenario may include but is not limited to medical scenarios, public transportation scenarios, commercial shopping scenarios, garbage collection scenarios, party and government agency scenarios, water scenarios, etc. The intelligent algorithms run by the camera in different application scenarios are different. When a new camera is deployed in any application scenario, or when an old camera changes its application scenario when it is relocated, it is necessary to determine the intelligent algorithm for the corresponding application scenario for the camera so as to deploy it in the camera to execute the intelligent functions of the corresponding application scenario. In addition, the same camera may involve multiple application scenarios. For example, a camera deployed at the entrance of a hospital can capture both medical scenes and public transportation scenes. The intelligent algorithms run by such cameras involve issues such as algorithm switching.
[0038] See also Figure 2 , is a flow chart of an algorithm scheduling method for a camera provided by Embodiment 1 of the present invention. The algorithm scheduling method for a camera can be applied to Figure 1 The client in the embodiment of the present invention, the computer device corresponding to the client is connected to the server, the server communicates with at least one camera, and the computer device corresponding to the client obtains the basic information and scheduling plan of the camera from the server, as well as the target basic information of the target camera. The target basic information of the target camera can be used to determine the target scheduling plan of the target camera. Figure 2 As shown, the algorithm scheduling method for a camera may include the following steps:
[0039] Step S201, obtaining basic information of N cameras and the scheduling scheme used.
[0040] Among them, N is an integer greater than zero, the basic information may refer to the installation information, scene information and configuration information of the camera, etc. The installation information may include the camera's height information, posture information and other information when the camera is installed, the scene information may include the scene type, shooting target, recognition area, geographic location information, etc. in which the camera is deployed, the configuration information may include the camera's lens parameters, configured algorithm information, etc., the scheduling plan may include running time, focal length, scheduling algorithm, the running time may refer to the time period information when the camera acquires images and uses the configured algorithm for processing, the focal length may refer to the target focal length to which the camera needs to be adjusted from the current focal length, and the scheduling algorithm may refer to the target algorithm that the camera needs to update.
[0041] Specifically, N cameras can be deployed in multiple different application scenarios. The basic information obtained and the scheduling scheme used can be the basic information of the camera at the current moment and the scheduling scheme used at the current moment, or the basic information of the camera at historical moments and the scheduling scheme used at historical moments, to provide sufficient information for subsequent association establishment.
[0042] Optionally, the basic information includes installation information, lens information, recognition area information, configured algorithm information, and geographic location information;
[0043] Obtaining basic information of N cameras includes:
[0044] For any camera, stitching the camera's installation information, lens information, configured algorithm information, recognition area information, and geographic location information acquired within at least one preset time period to obtain at least one first stitching result corresponding to the preset time period;
[0045] Determine all first stitching results as basic information of the camera, traverse the N cameras, and obtain the basic information of the N cameras.
[0046] Among them, the lens information may refer to the lens parameters of the camera. In this embodiment, the height information is used as the installation information, and the clarity information is used as the lens information. The recognition area information may refer to the area information covered by the camera's viewing angle. The configured algorithm information may include at least one configured algorithm. The geographic location information may refer to the geographic coordinate information of the camera deployment. In this embodiment, the longitude and latitude information is used as the geographic location information. The first stitching result may be a representation of the basic information of the camera. The preset time period may refer to several historical time periods and the current time period.
[0047] Specifically, assuming that there are M preset time periods, there are M first stitching results for a single camera, and the M first stitching results are used as the basic information of the camera. If the number of cameras is N, there are N*M first stitching results as the basic information. It should be noted that, in this embodiment, it is assumed that the basic information of the same camera in different preset time periods is different.
[0048] The first stitching result can be represented as a vector of size 1*K, that is, a vector of one row and K columns, where each column corresponds to a basic information. Since this embodiment stitches the camera's installation information, lens information, configured algorithm information, recognition area information, and geographic location information, the value of K is 5.
[0049] By default, the camera has intelligent processing capabilities. A single camera can store multiple configured algorithms at the same time. For cameras with lower computing power, a single camera can store only one configured algorithm. Configured here means that the camera can directly deploy the algorithm in the camera for intelligent task processing.
[0050] In this embodiment, the basic information of the camera is represented in the form of a vector, which ensures that the basic information can be represented in a unified form, facilitates the subsequent training of the algorithm scheduling model as part of the training samples, and improves the efficiency of the algorithm scheduling process.
[0051] Optionally, after obtaining at least one splicing result corresponding to a preset time period, the method further includes:
[0052] For any preset time period, obtain the scene image collected by the camera within the preset time period, input the scene image into the trained scene analysis model to predict the camera information, and obtain the predicted lens information, predicted installation information, predicted recognition area information and predicted geographic location information;
[0053] Compare the predicted lens information, predicted installation information, predicted identification area information, and predicted geographic location information with the lens information, installation information, identification area information, and geographic location information of the camera acquired in a preset time period, respectively, to obtain a comparison result;
[0054] If the comparison result meets the preset condition, the first stitching result of the preset time period is used as the basic information of the camera, and all preset time periods are traversed to obtain the basic information of the camera.
[0055] Among them, the scene image may refer to the actual image collected by the camera within a preset time period, the trained scene analysis model may be used to predict the basic information of the camera, the trained scene analysis model may adopt the trained prediction model, the trained prediction model may include a trained encoder and multiple trained fully connected layers, the trained encoder may be used to extract image features of the scene image, the trained fully connected layer may be used to map the image features to the feature space of the basic information, and different trained fully connected layers correspond to the feature spaces of different basic information.
[0056] The predicted lens information, predicted installation information, predicted identification area information, and predicted geographic location information may refer to the results of a trained scene analysis model predicting basic information of the camera based on image features of the scene image.
[0057] The comparison result may include multiple comparison sub-results, each comparison sub-result corresponds to a basic information, and the preset condition may refer to a quantity condition of the consistency of the comparison sub-results, that is, comparing the statistical number of consistent comparison sub-results with a preset quantity threshold. If the statistical number of consistent comparison sub-results is greater than or equal to the preset quantity threshold, it is determined that the comparison result meets the preset condition.
[0058] Specifically, the input of the trained scene analysis model can be a fixed number of scene images, and the fixed number can be set to 3. All scene images are size normalized to ensure that the input of the trained scene analysis model is of the same size.
[0059] In this embodiment, the configured algorithm in the basic information cannot make predictions based on the scene image, so only the lens information, installation information, identification area information and geographic location information are predicted. The lens information can be clarity information, and the installation information can be height information.
[0060] The trained fully-connected layer corresponding to the lens information, the trained fully-connected layer corresponding to the installation information, and the trained fully-connected layer corresponding to the identification area information are all fully-connected layers for the prediction task. Since the prediction of geographic location information is more difficult, in this embodiment, the trained fully-connected layer corresponding to the geographic location information is used as the fully-connected layer for the classification task. The fully-connected layer for the classification task has a fixed number of preset geographic location labels during training.
[0061] The predicted lens information, predicted installation information, predicted identification area information and predicted geographic location information are respectively compared with the lens information, installation information, identification area information and geographic location information of the camera obtained within a preset time period, that is, the predicted lens information is compared with the lens information of the camera, the predicted installation information is compared with the installation information of the camera, the predicted identification area information is compared with the identification area information of the camera, and the predicted geographic location information is compared with the geographic location information of the camera to obtain four comparison sub-results. In this embodiment, the quantity threshold is set to 2. If the number of consistent statistics in the four comparison sub-results is greater than 2, it means that the comparison result meets the preset conditions.
[0062] By comparing the predicted basic information with the basic information obtained from the camera, errors in the obtained basic information can be avoided, making the obtained basic information sufficiently reliable.
[0063] In one embodiment, since the conditions for consistency of comparison sub-results are relatively stringent, a distance measurement method can be used for comparison. For example, for lens information, the absolute value of the difference between the predicted clarity information and the acquired clarity information is used as the comparison sub-result. It should be noted that each distance measurement result needs to be normalized. In this embodiment, a preset normalization function is used for processing.
[0064] The preset normalization function can be expressed as:
[0065]
[0066] Among them, x can represent the distance measurement result, and f(x) can represent the normalized result of the distance measurement result. Since the distance measurement results are all values greater than zero, the closer the distance measurement result is to 0, the closer its normalized result is to 1, indicating that the predicted basic information and the acquired basic information are sufficiently similar. The closer the distance measurement result is to 1, the closer its normalized result is to 0, indicating that the predicted basic information and the acquired basic information are not similar.
[0067] After normalization, each comparison sub-result can be directly added to compare the added result with the preset value. When the added result is greater than or equal to the preset value, it means that the comparison result meets the preset condition. At this time, the preset value can be the same as the preset quantity threshold.
[0068] In this embodiment, the basic information is predicted by the scene analysis model and compared with the acquired basic information to ensure the reliability of the acquired basic information and filter out erroneous or inappropriate basic information, thereby ensuring the accuracy of the subsequent algorithm scheduling model after training.
[0069] Optionally, the scheduling scheme also includes an algorithm function and an algorithm type;
[0070] The scheduling schemes used to obtain N cameras include:
[0071] For any camera, stitching the historical running time, historical focal length, historical scheduling algorithm, historical algorithm function and historical algorithm type of the camera obtained in at least one preset time period to obtain at least one second stitching result corresponding to the preset time period;
[0072] All second stitching results are determined as scheduling solutions for the cameras, and N cameras are traversed to obtain at least one scheduling solution.
[0073] Among them, the algorithm function may refer to the intelligent processing tasks to which the algorithm is applicable, and the algorithm type may refer to the basic tasks of the algorithm, which may include classification tasks, prediction tasks, etc.
[0074] The historical running time, historical focal length, historical scheduling algorithm, historical algorithm function and historical algorithm type may refer to the scheduling scheme used by the camera within a historical preset time period, and the second stitching result may refer to the representation of the scheduling scheme.
[0075] Specifically, intelligent processing tasks can be mask detection tasks and crowd gathering tasks in medical scenarios, red light running detection tasks, speeding identification tasks, illegal parking tasks, etc. in public transportation scenarios, crowd gathering tasks and unlicensed operation tasks in commercial shopping scenarios, garbage overflow detection tasks and garbage exposure detection tasks in garbage collection scenarios, stranger identification tasks in party and government agency scenarios, water level detection tasks and floating object detection tasks in water affairs scenarios.
[0076] The second splicing result can be expressed as a vector of size 1*L, that is, a vector of one row and L columns, each column corresponding to the content in a scheduling plan. Since this embodiment splices the running time, focal length, scheduling algorithm, algorithm function and algorithm type, the value of L is also 5.
[0077] Suppose there are M preset time periods in total, then for a single camera, there are M second stitching results, and the M second stitching results are used as the scheduling plan for the camera. The number of cameras is N, then there are N*M second stitching results as the scheduling plan. It should be noted that in this embodiment, it is assumed that the scheduling plan for the same camera in different preset time periods is different.
[0078] The implementer may set a specific scheduling plan for the camera based on actual conditions. The manually set scheduling plan may not be the scheduling plan actually adopted by the camera, so as to increase the flexibility of determining subsequent scheduling plans.
[0079] In this embodiment, the camera scheduling scheme is represented in vector form, which ensures that the scheduling scheme can be represented in a unified form, facilitates the subsequent training of the algorithm scheduling model as part of the training samples, and improves the efficiency of the algorithm scheduling process.
[0080] The above steps of obtaining the basic information of N cameras and the scheduling scheme used provide real information for the subsequent establishment of basic information and scheduling schemes, so that the generalization of related information is high enough, thereby improving the accuracy of subsequent algorithm intelligent scheduling.
[0081] Step S202, traverse N cameras, respectively establish association relationships between basic information of the N cameras and scheduling schemes, and obtain at least one association relationship.
[0082] The association relationship may refer to the relationship between basic information and a scheduling plan, and the association relationship may be used to determine a scheduling plan that conforms to the basic information of the camera.
[0083] Specifically, a single information in the basic information can be mapped to a single plan in the scheduling plan. For example, for the installation information of the camera, an association relationship between the height information and the scheduling algorithm is established. For a camera height of 2 to 3 meters, the associated scheduling algorithm is a small object recognition algorithm, such as paper scraps recognition algorithm, garbage recognition algorithm, smoking recognition algorithm, mask recognition algorithm, helmet recognition algorithm, etc. For a camera height of 3 to 5 meters, the associated scheduling algorithm can be a medium-sized object and personnel-related recognition algorithm, such as a human body detection algorithm, an advertising banner recognition algorithm, etc. For a camera height greater than 5 meters, the associated scheduling algorithm can be a large object recognition algorithm, such as a vehicle recognition algorithm, a construction recognition algorithm, and a river embankment detection algorithm.
[0084] Since the association relationship may be that a single piece of information in the basic information corresponds to a single scheme in the scheduling scheme, one piece of basic information may correspond to multiple scheduling schemes, and similarly, one scheduling scheme may correspond to multiple pieces of basic information.
[0085] Optionally, N cameras are traversed, and associations between basic information of the N cameras and the scheduling schemes are established respectively, to obtain at least one association, including:
[0086] For any camera among the N cameras, associate the basic information of the camera in any preset time period with the scheduling plan to obtain the corresponding association relationship of the camera in the preset time period, traverse the M preset time periods, and establish the association relationship of the camera in the corresponding M preset time periods;
[0087] A camera is selected from N cameras, and association relationships of the selected camera in corresponding M preset time periods are continuously established until all N cameras are traversed, so as to respectively establish association relationships of the N cameras in corresponding M preset time periods, and obtain at least one association relationship.
[0088] The number of preset time periods is M, where M is an integer greater than zero. A single camera has M association relationships, and N cameras have N*M association relationships.
[0089] Specifically, the above N*M association relationships are only the association relationships between the basic information of the camera and the scheduling scheme actually used. Since the scheduling scheme can be manually configured, the association relationships are actually rich enough.
[0090] In this embodiment, a sufficient number of association relationships are established to ensure that sufficient training samples are provided for the subsequent training process, ensure the fitting effect of the algorithm scheduling model, and improve the generalization and accuracy of the subsequent algorithm scheduling model after training.
[0091] The above-mentioned step of traversing N cameras, establishing the association relationship between the basic information of the N cameras and the scheduling scheme respectively, and obtaining at least one association relationship facilitates the subsequent construction of training samples according to the association relationship, trains the algorithm scheduling model, provides sufficient training samples for the training process, and ensures the accuracy of the trained algorithm scheduling model.
[0092] Step S203, forming a training sample from the associated basic information and the scheduling scheme to obtain at least one training sample, and using all the training samples to train a preset algorithm scheduling model to obtain a trained algorithm scheduling model.
[0093] Among them, the training sample can refer to the input during the training of the algorithm scheduling model. The trained algorithm scheduling model can predict the scheduling plan for the basic information of the unknown camera obtained. Basic information and a scheduling plan with an associated relationship constitute a training sample.
[0094] Specifically, every time an algorithm needs to be scheduled for a camera, the basic information of the camera and the scheduling plan need to be collected to ensure a high accuracy rate in each algorithm scheduling process. The generalization ability of the algorithm model will become better and better, making the intelligent algorithm scheduling more accurate and close to the usage scenario.
[0095] Optionally, all training samples are used to train a preset algorithm scheduling model to obtain a trained algorithm scheduling model, including:
[0096] Input the basic information of any training sample into the preset algorithm scheduling model to obtain the predicted sample plan;
[0097] According to the sample plan, the scheduling plan in the training sample and the preset prediction loss function, the prediction sub-loss of the corresponding training sample is calculated;
[0098] Traverse all training samples to obtain the prediction sub-loss of the corresponding training samples, add up all prediction sub-losses to obtain the prediction loss, and use the prediction loss as the basis to train the algorithm scheduling model using the gradient descent method until the prediction loss converges to meet the preset conditions, thus obtaining a trained algorithm scheduling model.
[0099] Among them, the sample plan may refer to the result of the preset algorithm scheduling model predicting the training sample, the prediction loss function may adopt the mean square error loss function, the prediction sub-loss may refer to the loss of the corresponding training sample, the prediction loss may refer to the total loss of all training samples, and the gradient descent method may adopt the stochastic gradient descent method, the batch gradient descent method, etc.
[0100] In this embodiment, the preset condition may mean that the prediction loss no longer decreases under the preset number of training batches. The preset number of training batches can be set to 5. The prediction loss is calculated by the prediction results and the input training samples, and the algorithm scheduling model is trained so that the trained algorithm scheduling model can learn the relationship between the basic information and the scheduling plan, thereby providing a more accurate scheduling plan for the algorithm scheduling task.
[0101] The above-mentioned steps of forming training samples from basic information and scheduling plans with associated relationships, obtaining at least one training sample, using all training samples to train the preset algorithm scheduling model, and obtaining a trained algorithm scheduling model, constructing enough training samples through sufficient associated relationships, and training the preset algorithm scheduling model, can effectively improve the generalization and accuracy of the trained algorithm scheduling model.
[0102] Step S204, inputting the acquired target basic information of the target camera into the trained algorithm scheduling model to predict the scheduling algorithm, and obtaining the target scheduling solution corresponding to the target camera.
[0103] Among them, the target camera may refer to a camera that needs to be scheduled by the algorithm, the target basic information may refer to the basic information of the target camera, and the target scheduling plan may refer to the scheduling plan applied to the target camera output by the trained algorithm scheduling model.
[0104] Optionally, after obtaining the target scheduling solution corresponding to the target camera, the method further includes:
[0105] The target sample is composed of target basic information and target scheduling plan;
[0106] The algorithm scheduling model is retrained using all training samples and target samples to obtain an updated algorithm scheduling model. The updated algorithm scheduling model is used to perform algorithm scheduling prediction according to the updated target basic information.
[0107] Among them, the target sample may refer to the training sample used to update the algorithm scheduling model. The updated algorithm scheduling model is used to perform algorithm scheduling prediction based on the updated target basic information. The updated target basic information may refer to the basic information of the new camera acquired subsequently.
[0108] Specifically, since the algorithm scheduling model needs to be retrained each time the algorithm scheduling is performed, in actual use, the implementer can set it to perform batch algorithm scheduling processing after receiving the target basic information of a preset number of target cameras.
[0109] As for the target basic information that is processed by algorithm scheduling in the same batch, after algorithm scheduling is performed on the target basic information of a target camera, the target basic information and the corresponding target scheduling plan can be used to form a target sample, and the algorithm scheduling model can be trained again to obtain an updated algorithm scheduling model to improve the accuracy of the algorithm scheduling process of other target basic information in the batch.
[0110] It should be noted that when obtaining the target sample, the implementer can adjust the target sample according to the actual situation so that the correlation between the target sample corresponding to the target basic information and the target scheduling plan is more in line with the implementer's experience.
[0111] In this embodiment, the algorithm scheduling model is retrained by constituting a target sample with target basic information and a target scheduling scheme, so that during batch processing, the generalization of the algorithm scheduling model is gradually increased as the processing progresses, thereby improving the accuracy of the algorithm scheduling.
[0112] The above-mentioned step of inputting the acquired target basic information of the target camera into the trained algorithm scheduling model to predict the scheduling algorithm and obtain the target scheduling plan for the corresponding target camera can train the algorithm scheduling model in real time, making the trained algorithm scheduling model more robust, and making the scheduling method obtained by the algorithm intelligent scheduling more accurate and closer to the usage scenario.
[0113] Step S205, configuring the algorithm in the target camera as the scheduling algorithm in the target scheduling scheme, and updating the working time and lens configuration of the target camera according to the running time and focal length in the target scheduling scheme.
[0114] Among them, the algorithm in the target camera may refer to the algorithm configured in the target camera at the current moment, and the working time and lens configuration of the target camera may refer to the working time period and lens parameters of the algorithm configured in the target camera at the current moment.
[0115] Specifically, if the target camera already stores the scheduling algorithm in the target scheduling scheme, the scheduling algorithm is directly deployed in the target camera. If the target camera does not store the scheduling algorithm in the target scheduling scheme, the model parameters are sent to the target camera through the server. After the target camera receives the model parameters, the scheduling algorithm is deployed in the target camera.
[0116] For example, the target basic information of the target camera identifies the area as an illegal parking area, and the stored intelligent algorithm includes a motor vehicle illegal parking recognition algorithm. If the target basic information is input into the trained algorithm scheduling model to predict the scheduling algorithm, and the scheduling algorithm in the obtained target scheduling plan is a motor vehicle illegal parking recognition algorithm, then the motor vehicle illegal parking recognition algorithm can be configured in the target camera.
[0117] According to the running time and focal length in the target scheduling plan, the working time of the target camera is updated. For example, if the running time in the target scheduling plan is from 8 am to 8 pm and the lens focal length in the target scheduling plan is 75mm, then the working time of the target camera to enable the scheduled algorithm is set to the running time, that is, from 8 am to 8 pm, and the lens focal length when the target camera enables the scheduled algorithm is adjusted to 75mm.
[0118] The above-mentioned steps of configuring the algorithm in the target camera as the scheduling algorithm in the target scheduling scheme, and updating the working time and lens configuration of the target camera according to the running time and focal length in the target scheduling scheme, can reduce the workload when configuring algorithm scheduling for large quantities of cameras, and can effectively avoid problems such as cumbersome configuration, easy errors, and difficulty in getting started, thereby improving the efficiency of algorithm scheduling.
[0119] In this embodiment, an association relationship is established with the camera's deployment information and scene information and the camera's scheduling plan, and training samples are determined based on the association relationship to train the algorithm scheduling model, thereby improving the robustness of the algorithm scheduling process and achieving full automation of the camera algorithm scheduling process, thereby improving the efficiency and accuracy of the camera algorithm scheduling.
[0120] Corresponding to the algorithm scheduling method for the camera in the above embodiment, Figure 3 The structural block diagram of the algorithm scheduling device for a camera provided by the second embodiment of the present invention is shown. The algorithm scheduling device for a camera is applied to a client. The computer device corresponding to the client is connected to the server. The server communicates with at least one camera. The computer device corresponding to the client obtains the basic information and scheduling scheme of the camera from the server, as well as the target basic information of the target camera. The target basic information of the target camera can be used to determine the target scheduling scheme of the target camera. For the convenience of explanation, only the part related to the embodiment of the present invention is shown.
[0121] See also Figure 3 , the algorithm scheduling device for the camera includes:
[0122] An information acquisition module 31 is used to acquire basic information of N cameras and the scheduling scheme used, where the scheduling scheme includes running time, focal length, and scheduling algorithm, and N is an integer greater than zero;
[0123] A relationship building module 32, used to traverse the N cameras, respectively establish an association relationship between the basic information of the N cameras and the scheduling scheme, and obtain at least one association relationship;
[0124] The model training module 33 is used to form a training sample from the basic information and the scheduling scheme that have an associated relationship, obtain at least one training sample, and use all the training samples to train the preset algorithm scheduling model to obtain a trained algorithm scheduling model;
[0125] A scheme determination module 34 is used to input the acquired target basic information of the target camera into the trained algorithm scheduling model to predict the scheduling algorithm and obtain a target scheduling scheme corresponding to the target camera;
[0126] The algorithm scheduling module 35 is used to configure the algorithm in the target camera as the scheduling algorithm in the target scheduling scheme, and update the working time and lens configuration of the target camera according to the running time and focal length in the target scheduling scheme.
[0127] Optionally, the basic information includes installation information, lens information, recognition area information, configured algorithm information, and geographic location information;
[0128] The information acquisition module 31 includes:
[0129] A first information stitching submodule is used to stitch, for any camera, the camera's installation information, lens information, configured algorithm information, identification area information, and geographic location information acquired within at least one preset time period to obtain at least one first stitching result corresponding to the preset time period;
[0130] The information determination submodule is used to determine all the first splicing results as the basic information of the camera, traverse the N cameras, and obtain the basic information of the N cameras.
[0131] Optionally, the information acquisition module 31 further includes:
[0132] The information prediction submodule is used to obtain the scene image collected by the camera within any preset time period, input the scene image into the trained scene analysis model to perform camera information prediction, and obtain the predicted lens information, predicted installation information, predicted recognition area information and predicted geographic location information;
[0133] An information comparison submodule, for comparing the predicted lens information, predicted installation information, predicted identification area information and predicted geographic location information with the lens information, installation information, identification area information and geographic location information of the camera acquired in a preset time period, respectively, to obtain a comparison result;
[0134] The condition judgment submodule is used to take the first splicing result of the preset time period as the basic information of the camera if the comparison result meets the preset condition, traverse all preset time periods, and obtain the basic information of the camera.
[0135] Optionally, the scheduling scheme also includes an algorithm function and an algorithm type;
[0136] The above-mentioned information acquisition module 31 also includes:
[0137] The second information stitching submodule is used to stitch, for any camera, the historical operating time, historical focal length, historical scheduling algorithm, historical algorithm function and historical algorithm type of the camera obtained in at least one preset time period to obtain at least one second stitching result corresponding to the preset time period;
[0138] The scheme determination submodule is used to determine all the second splicing results as the scheduling scheme of the camera, traverse N cameras, and obtain at least one scheduling scheme.
[0139] Optionally, the relationship establishing module 32 includes:
[0140] The time period traversal submodule is used to associate the basic information of any camera in any preset time period with the scheduling scheme for any camera among the N cameras, obtain the association relationship corresponding to the camera in the preset time period, traverse M preset time periods, and establish the association relationship of the camera in the corresponding M preset time periods, where M is an integer greater than zero;
[0141] The camera traversal submodule is used to select a camera from N cameras and continue to establish association relationships between the selected camera and the corresponding M preset time periods until all N cameras are traversed, so as to respectively establish association relationships between the N cameras and the corresponding M preset time periods to obtain at least one association relationship.
[0142] Optionally, the model training module 33 includes:
[0143] The solution prediction submodule is used to input the basic information of any training sample into the preset algorithm scheduling model to obtain the predicted sample solution;
[0144] The loss calculation submodule is used to calculate the prediction sub-loss of the corresponding training sample according to the sample scheme, the scheduling scheme in the training sample and the preset prediction loss function;
[0145] The iterative training submodule is used to traverse all training samples, obtain the prediction sub-loss of the corresponding training samples, add up all the prediction sub-losses to obtain the prediction loss, and use the prediction loss as the basis to train the algorithm scheduling model using the gradient descent method until the prediction loss converges to meet the preset conditions, thereby obtaining a trained algorithm scheduling model.
[0146] Optionally, the algorithm scheduling device for a camera further includes:
[0147] A sample construction module is used to construct a target sample with target basic information and a target scheduling plan;
[0148] The model updating module is used to retrain the algorithm scheduling model using all training samples and target samples to obtain an updated algorithm scheduling model. The updated algorithm scheduling model is used to perform algorithm scheduling prediction according to the updated target basic information.
[0149] It should be noted that the information interaction, execution process and other contents between the above-mentioned modules and sub-modules are based on the same concept as the embodiment of the method of the present invention. Their specific functions and technical effects can be found in the method embodiment part and will not be repeated here.
[0150] Figure 4 This is a schematic diagram of the structure of a computer device provided in Embodiment 3 of the present invention. Figure 4 As shown, the computer device of this embodiment includes: at least one processor ( Figure 4 Only one is shown), a memory, and a computer program stored in the memory and executable on at least one processor. When the processor executes the computer program, it implements the steps in any of the above-mentioned algorithm scheduling method embodiments for cameras.
[0151] The computer device may include, but is not limited to, a processor and a memory. Those skilled in the art will appreciate that Figure 4 This is merely an example of a computer device and does not constitute a limitation on the computer device. The computer device may include more or fewer components than those shown in the figure, or a combination of certain components, or different components. For example, it may also include a network interface, a display screen, and an input device.
[0152] The processor may be a CPU, or other general-purpose processors, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.
[0153] The memory includes a readable storage medium, an internal memory, etc., wherein the internal memory may be the memory of a computer device, and the internal memory provides an environment for the operation of an operating system and computer-readable instructions in the readable storage medium. The readable storage medium may be a hard disk of a computer device, and in other embodiments may also be an external storage device of a computer device, for example, a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on a computer device. Further, the memory may also include both an internal storage unit of a computer device and an external storage device. The memory is used to store an operating system, an application program, a boot loader (BootLoader), data, and other programs, such as program codes of computer programs, etc. The memory may also be used to temporarily store data that has been output or is to be output.
[0154] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the device is divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated into a processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of the present invention. The specific working process of the units and modules in the above-mentioned device can refer to the corresponding process in the above-mentioned method embodiment, which will not be repeated here. If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on such understanding, the present invention implements all or part of the processes in the above-mentioned embodiment method, which can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a computer-readable storage medium. When the computer program is executed by the processor, the steps of the above-mentioned method embodiment can be implemented. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may at least include: any entity or device capable of carrying computer program code, recording medium, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium. For example, a USB flash drive, a mobile hard disk, a magnetic disk or an optical disk. In some jurisdictions, according to legislation and patent practice, computer-readable media cannot be electric carrier signals and telecommunication signals.
[0155] The present invention implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by a computer program product. When the computer program product runs on a computer device, the computer device can implement the steps in the above-mentioned method embodiment when executing.
[0156] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0157] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.
[0158] In the embodiments provided by the present invention, it should be understood that the disclosed devices / computer equipment and methods can be implemented in other ways. For example, the device / computer equipment embodiments described above are only schematic, for example, the division of modules or units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0159] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0160] The above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention, and should be included in the protection scope of the present invention.
Claims
1. An algorithm scheduling method for a camera, characterized in that: The algorithm scheduling method comprises: Get The basic information of each camera and the scheduling scheme used, the scheduling scheme includes the running time, focal length, and scheduling algorithm, is an integer greater than zero; Traverse the cameras, respectively establishing association relationships between basic information of the N cameras and scheduling schemes to obtain at least one association relationship, where the association relationship refers to a relationship between a basic information and a scheduling scheme; The basic information and the scheduling scheme having an associated relationship constitute a training sample, and at least one training sample is obtained. The preset algorithm scheduling model is trained using all the training samples to obtain a trained algorithm scheduling model. Inputting the acquired target basic information of the target camera into the trained algorithm scheduling model to predict the scheduling algorithm, and obtaining a target scheduling solution corresponding to the target camera; The algorithm in the target camera is configured as the scheduling algorithm in the target scheduling scheme, and the working time and lens configuration of the target camera are updated according to the running time and focal length in the target scheduling scheme; The method of using all training samples to train the preset algorithm scheduling model to obtain a trained algorithm scheduling model includes: Inputting basic information in any training sample into the preset algorithm scheduling model to obtain a predicted sample plan; According to the sample scheme, the scheduling scheme in the training sample and a preset prediction loss function, a prediction sub-loss corresponding to the training sample is calculated; Traverse all training samples to obtain the prediction sub-loss of the corresponding training samples, add all the prediction sub-losses to obtain the prediction loss, and use the prediction loss as a basis to train the algorithm scheduling model using the gradient descent method until the prediction loss converges to meet the preset conditions, thereby obtaining the trained algorithm scheduling model.
2. The algorithm scheduling method according to claim 1, characterized in that: The basic information includes installation information, lens information, recognition area information, configured algorithm information and geographic location information; The acquisition The basic information of each camera includes: For any camera, stitching the installation information, lens information, configured algorithm information, recognition area information, and geographic location information of the camera acquired within at least one preset time period to obtain at least one first stitching result corresponding to the preset time period; Determine all the first stitching results as the basic information of the camera, and traverse the cameras, get the Basic information of the camera.
3. The algorithm scheduling method according to claim 2, characterized in that: After obtaining at least one splicing result corresponding to the preset time period, the method further includes: For any preset time period, obtain a scene image captured by the camera within the preset time period, input the scene image into a trained scene analysis model to perform camera information prediction, and obtain predicted lens information, predicted installation information, predicted recognition area information, and predicted geographic location information; Compare the predicted lens information, the predicted installation information, the predicted identification area information, and the predicted geographic location information with the lens information, installation information, identification area information, and geographic location information of the camera acquired during the preset time period, respectively, to obtain a comparison result; If the comparison result meets the preset condition, the first stitching result of the preset time period is used as the basic information of the camera, and all preset time periods are traversed to obtain the basic information of the camera.
4. The algorithm scheduling method according to claim 2, characterized in that: The scheduling scheme also includes an algorithm function and an algorithm type; Get The scheduling schemes used by the cameras include: For any camera, stitching the historical running time, historical focal length, historical scheduling algorithm, historical algorithm function and historical algorithm type of the camera obtained in the at least one preset time period to obtain at least one second stitching result corresponding to the preset time period; Determine all second stitching results as the scheduling scheme of the camera, traverse the cameras, and obtain at least one of the scheduling solutions.
5. The algorithm scheduling method according to claim 4, characterized in that: The traversal of cameras, respectively establish association relationships between basic information of the N cameras and the scheduling scheme, and obtain at least one association relationship, including: For any camera among the N cameras, associate the basic information of the camera in any preset time period with the scheduling scheme to obtain the corresponding association relationship of the camera in the preset time period, and traverse A preset time period is established, and the camera is set to The relationship between the preset time periods, is an integer greater than zero; In the Select a camera from the list of cameras and continue to establish the selected camera in the corresponding The association relationship of the preset time period is completed until the cameras to establish the Cameras in correspondence The association relationship of the preset time periods is obtained to obtain at least one association relationship.
6. The algorithm scheduling method according to any one of claims 1 to 5, characterized in that: After obtaining the target scheduling solution corresponding to the target camera, the method further includes: The target basic information and the target scheduling scheme are used to form a target sample; The algorithm scheduling model is retrained using all training samples and the target samples to obtain an updated algorithm scheduling model, and the updated algorithm scheduling model is used to perform algorithm scheduling prediction according to the updated target basic information.
7. An algorithm scheduling device for a camera, characterized in that: The algorithm scheduling device comprises: Information acquisition module, used to obtain The basic information of each camera and the scheduling scheme used, the scheduling scheme includes the running time, focal length, and scheduling algorithm, is an integer greater than zero; Relationship building module, used to traverse the cameras, respectively establishing association relationships between basic information of the N cameras and scheduling schemes to obtain at least one association relationship, where the association relationship refers to a relationship between a basic information and a scheduling scheme; A model training module is used to form a training sample from the basic information and the scheduling scheme that have an associated relationship, obtain at least one training sample, and use all the training samples to train the preset algorithm scheduling model to obtain a trained algorithm scheduling model; A scheme determination module is used to input the acquired target basic information of the target camera into the trained algorithm scheduling model to predict the scheduling algorithm, and obtain a target scheduling scheme corresponding to the target camera; An algorithm scheduling module, configured to configure the algorithm in the target camera as the scheduling algorithm in the target scheduling scheme, and update the working time and lens configuration of the target camera according to the running time and focal length in the target scheduling scheme; The model training module includes: A solution prediction submodule is used to input the basic information in any training sample into the preset algorithm scheduling model to obtain a predicted sample solution; A loss calculation submodule, used to calculate the prediction sub-loss corresponding to the training sample according to the sample scheme, the scheduling scheme in the training sample and a preset prediction loss function; The iterative training submodule is used to traverse all training samples, obtain the prediction sub-loss of the corresponding training samples, add all the prediction sub-losses to obtain the prediction loss, and train the algorithm scheduling model based on the prediction loss using the gradient descent method until the prediction loss converges to meet the preset conditions, thereby obtaining the trained algorithm scheduling model.
8. A computer device, characterized in that: The computer device includes a processor, a memory, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the algorithm scheduling method according to any one of claims 1 to 6 is implemented.
9. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the algorithm scheduling method according to any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
AI scheduling method and system of smart rod
CN114610471A
Modeless user interface incorporating automatic updates for developing and using bayesian belief networks
US20060020568A1