Task frame extraction scheduling method and device and electronic equipment
By setting a unified execution cycle and resource availability verification method in the video stream frame extraction task, the problem of low resource utilization under the traditional fixed frequency frame extraction strategy is solved, and more efficient resource allocation and task scheduling are achieved.
Patent Information
- Application Number
- CN202511771530.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-27
- Publication Date
- 2026-03-31
AI Technical Summary
Traditional fixed-frequency frame skipping strategies are difficult to adapt to complex and ever-changing task requirements, resulting in low resource utilization.
By obtaining the target frame-skipping task with the preset frame-skipping interval and the set of frame-skipping intervals of the scheduled frame-skipping tasks, the greatest common divisor is determined to set a unified execution cycle, and resource availability is verified to schedule tasks.
It enables dynamic adaptation to multi-task requirements, optimizes resource allocation, improves resource utilization and system efficiency, and avoids resource waste and conflicts.
Smart Images

Figure CN121764658A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer application technology, and more specifically, to a task frame-skipping scheduling method, apparatus, and electronic device. Background Technology
[0002] In AI applications of video stream frame extraction analysis, both edge-side algorithm deployment and cloud-side service operation require parallel processing of multiple tasks. On the edge, multiple algorithms often run simultaneously on the same device; while in the cloud, servers must handle concurrent requests from multiple devices and various tasks. Different algorithms have different requirements for video frame extraction frequency; some require high-frequency extraction to meet real-time requirements, while others only require low-frequency extraction to reduce resource consumption. Therefore, traditional fixed-frequency frame extraction strategies are no longer suitable for complex and ever-changing task requirements, resulting in low resource utilization.
[0003] There is currently no effective solution to the above problems. Summary of the Invention
[0004] This application provides a task frame-skipping scheduling method, apparatus, and electronic device to at least solve the technical problem that traditional fixed-frequency frame-skipping strategies are difficult to adapt to complex and ever-changing task requirements and have low resource utilization.
[0005] According to one aspect of the embodiments of this application, a task frame extraction scheduling method is provided, comprising: obtaining a target frame extraction task with a preset frame extraction interval, and obtaining a set of frame extraction intervals for all scheduled frame extraction tasks in a server, wherein the task start point corresponding to the target frame extraction task is the target task start execution time point; determining the greatest common divisor corresponding to all frame extraction intervals in the set of frame extraction intervals, and determining a unified execution period for the scheduled frame extraction tasks based on the greatest common divisor; determining all theoretical execution time points of the target frame extraction task within the unified execution period, wherein the theoretical execution time points are determined based on the preset frame extraction interval and the target task start execution time point; verifying the resource availability of all theoretical execution time points, and scheduling the target frame extraction task based on the verification results of resource availability.
[0006] Optionally, the starting execution time of the target task is determined by the following methods: obtaining the display time corresponding to the server, wherein the display time is used to represent the current time; obtaining multiple discrete time points within the first preset frame extraction interval; determining the potential task starting execution time of the target frame extraction task based on the discrete time points and the display time; verifying the potential task starting execution time points, and determining the verified potential task starting execution time points as the target task starting execution time points.
[0007] Optionally, verifying the start execution time of potential tasks and determining the verified start execution time of potential tasks as the start execution time of target tasks includes: obtaining a first potential task start execution time, wherein the first potential task start execution time is any potential task start execution time; determining the server's load at the first potential task start execution time to obtain a first determination result; and, if the first determination result indicates that the server has spare resources required to execute the target frame extraction task at the first potential task start execution time, determining that the first potential task start execution time has been verified and determining the first potential task start execution time as the start execution time of target tasks.
[0008] Optionally, the method further includes: if the first judgment result indicates that the server has no spare resources at the start execution time of the first potential task, obtaining the start execution time of the second potential task, wherein the start execution time of the second potential task is the next potential task start execution time of the first potential task; judging the load of the server at the start execution time of the second potential task to obtain a second judgment result; if the second judgment result indicates that the server has spare resources required to execute the target frame extraction task at the start execution time of the second potential task, determining that the start execution time of the second potential task has been verified and determining the start execution time of the second potential task as the start execution time of the target task; if the second judgment result indicates that the server has no spare resources required to execute the target frame extraction task at the start execution time of the second potential task, repeating the steps of obtaining the next potential task start execution time and judging the load of the server at the next potential task start execution time until a target potential task start execution time with spare resources required to execute the target frame extraction task is found, and determining the target potential task start execution time as the start execution time of the target task.
[0009] Optionally, verify the resource availability at all theoretical execution time points, and schedule the target frame extraction task based on the verification results of resource availability, including: when the server has spare resources required to execute the target frame extraction task at all theoretical execution time points, determine that the verification result is passed, and schedule the target frame extraction task to the server for execution according to the theoretical execution time points.
[0010] Optionally, the method further includes: if the server does not have the spare resources required to execute the target frame extraction task at any theoretical execution time point, determine that the verification result is a verification failure, and redetermine the target task start execution time point of the target frame extraction task.
[0011] Optionally, the method further includes: when the server does not have any spare resources required to execute the target frame extraction task at any theoretical execution time point, switching the target frame extraction task to other servers for scheduling.
[0012] According to another aspect of the embodiments of this application, a task frame extraction scheduling device is also provided, comprising: an acquisition module, configured to acquire a target frame extraction task with a preset frame extraction interval, and acquire a set of frame extraction intervals for all scheduled frame extraction tasks in a server, wherein the task start point corresponding to the target frame extraction task is the target task start execution time point; a first determination module, configured to determine the greatest common divisor corresponding to all frame extraction intervals in the set of frame extraction intervals, and determine a unified execution period for the scheduled frame extraction tasks based on the greatest common divisor; a second determination module, configured to determine all theoretical execution time points of the target frame extraction task within the unified execution period, wherein the theoretical execution time points are determined based on the preset frame extraction interval and the target task start execution time point; and a verification module, configured to verify the resource availability of all theoretical execution time points, and schedule the target frame extraction task based on the verification results of resource availability.
[0013] According to another aspect of the embodiments of this application, an electronic device is also provided, including: a memory for storing program instructions; and a processor connected to the memory for executing program instructions to perform the following functions: obtaining a target frame-skipping task with a preset frame-skipping interval, and obtaining a set of frame-skipping intervals for all scheduled frame-skipping tasks in a server, wherein the task start point corresponding to the target frame-skipping task is the target task start execution time point; determining the greatest common divisor corresponding to all frame-skipping intervals in the frame-skipping interval set, and determining a unified execution period for the scheduled frame-skipping tasks based on the greatest common divisor; determining all theoretical execution time points of the target frame-skipping task within the unified execution period, wherein the theoretical execution time points are determined based on the preset frame-skipping interval and the target task start execution time point; verifying the resource availability of all theoretical execution time points, and scheduling the target frame-skipping task based on the verification results of resource availability.
[0014] According to another aspect of the embodiments of this application, a non-volatile storage medium is also provided, the non-volatile storage medium including a stored computer program, wherein the device where the non-volatile storage medium is located executes the above-mentioned task frame-skipping scheduling method by running the computer program.
[0015] According to another aspect of the embodiments of this application, a computer program product is also provided, including computer instructions that, when executed by a processor, implement the above-described task frame-skipping scheduling method.
[0016] In this embodiment, by obtaining a target frame-skipping task with a preset frame-skipping interval and obtaining a set of frame-skipping intervals for all scheduled frame-skipping tasks in the server, wherein the task start point corresponding to the target frame-skipping task is the target task start execution time point; determining the greatest common divisor of all frame-skipping intervals in the frame-skipping interval set, and determining the unified execution period of the scheduled frame-skipping tasks based on the greatest common divisor; determining all theoretical execution time points of the target frame-skipping task within the unified execution period, wherein the theoretical execution time points are determined based on the preset frame-skipping interval and the target task start execution time point; verifying the resource availability of all theoretical execution time points, and scheduling the target frame-skipping task based on the verification results of resource availability, the purpose of dynamically adapting to multi-task requirements is achieved, thereby realizing the technical effect of optimizing resource allocation and improving efficiency, and thus solving the technical problem that the traditional fixed-frequency frame-skipping strategy is difficult to adapt to complex and ever-changing task requirements and has low resource utilization. Attached Figure Description
[0017] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings:
[0018] Figure 1 This is a hardware structure block diagram of a computer terminal for implementing a task frame-skipping scheduling method according to an embodiment of this application;
[0019] Figure 2 This is a flowchart of a task frame-skipping scheduling method according to an embodiment of this application;
[0020] Figure 3 This is a structural diagram of a task frame-skipping scheduling device according to an embodiment of this application. Detailed Implementation
[0021] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.
[0022] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0023] First, some nouns or terms that appear in the explanation of the embodiments of this application shall be interpreted as follows:
[0024] Video streaming: Video streaming is a technology that allows users to watch online video content via an internet connection without first downloading the media file. Video streaming specifically refers to online video content, such as movies, TV series, live streams, etc., generally online videos created by content creators.
[0025] Frame extraction refers to the process of extracting specific frames from a continuous video data stream. This technique involves selectively extracting key frames or frames at regular time intervals from the video stream without decoding the entire video stream, for various purposes such as video analysis, content summarization, fast preview, storage optimization, and video editing. Frame extraction can significantly reduce the amount of data, facilitate fast browsing of video content, improve processing speed, and reduce the burden on storage and transmission while preserving important visual information.
[0026] Task scheduling is a core concept in computer science and operating system management, involving how to effectively arrange and execute various tasks in a computer system. Specifically, task scheduling refers to the process by which the system automatically determines which task runs on which resources, when, and on which time. This process aims to optimize resource usage (such as CPU time and memory), improve system efficiency and responsiveness, and ensure that tasks are executed in an orderly manner according to their priorities and dependencies.
[0027] Pre-programming: refers to the process of designing, organizing, and arranging a series of tasks, processes, content, or data before actual execution, to ensure that the system reaches the expected working state before formal operation, reduce errors and delays in real-time operation, and improve efficiency and reliability.
[0028] In practical applications, system resources are limited, and there is an upper limit to the number of frame extraction tasks that can be processed per unit of time. Without a unified and efficient scheduling and orchestration mechanism, not only will resource contention occur between different tasks, but overall resource utilization efficiency will also be significantly reduced. Especially when high- and low-frequency tasks are triggered simultaneously, the system load may rise sharply in a short period, leading to resource overload risks, performance bottlenecks, and even affecting the timeliness and stability of algorithm inference.
[0029] Currently, mainstream frame-skipping scheduling schemes typically employ a frequency-based grouping approach, grouping tasks with the same frame-skipping frequency together and managing and scheduling them through independent services. For example, frame-skipping tasks can be divided into groups 1, 2, ..., n based on the same frame-skipping frequency. Group 1 corresponds to a frame-skipping frequency of f1, group 2 to f2, ..., group n to fn. Group 1 is scheduled through independent service resource 1, group 2 through independent service resource 2, ..., group n through independent service resource n. While this strategy is simple to implement and maintain, it suffers from poor flexibility and low resource utilization. Especially for tasks with extremely low frame-skipping frequencies (e.g., only one frame needs to be skimmed every few minutes), this method easily leads to related services remaining idle for extended periods, resulting in resource waste. Faced with the increasing demands of multitasking and limited system resources, a more efficient and flexible frame-skipping scheduling mechanism is urgently needed to achieve dynamic collaboration between tasks, improve resource utilization efficiency, and ensure stable system operation.
[0030] To address the problems existing in related technologies, embodiments of this application provide a task frame-skipping scheduling method, which can run in... Figure 1 The computer terminal shown is explained below.
[0031] The task frame-skipping scheduling method embodiments provided in this application can be executed on mobile terminals, computer terminals, or similar computing devices. Figure 1 A hardware block diagram of a computer terminal for implementing a task frame-skipping scheduling method is shown. Figure 1As shown, the computer terminal 10 may include one or more processors (shown as 102a, 102b, ..., 102n in the figure) (the processor may include, but is not limited to, a microprocessor MCU or a programmable logic device FPGA, etc.), a memory 104 for storing data, and a transmission module 106 for communication functions connected via wired and / or wireless networks. In addition, it may also include: a display, a keyboard, a cursor control device, an input / output interface (I / O interface), a universal serial bus (USB) port (which may be included as one of the ports of the I / O interface), a network interface, and a BUS bus. Those skilled in the art will understand that... Figure 1 The structure shown is for illustrative purposes only and does not limit the structure of the aforementioned electronic device. For example, computer terminal 10 may also include... Figure 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown.
[0032] It should be noted that the aforementioned one or more processors and / or other data processing circuits are generally referred to herein as "data processing circuits". These data processing circuits may be embodied, in whole or in part, in software, hardware, firmware, or any other combination thereof. Furthermore, the data processing circuits may be a single, independent processing module, or may be integrated, in whole or in part, into any other element within the computer terminal 10. As involved in the embodiments of this application, the data processing circuits serve as a processor control mechanism (e.g., selection of a variable resistor termination path connected to an interface).
[0033] The memory 104 can be used to store software programs and modules of application software, such as the program instruction / data storage device corresponding to the task frame-skipping scheduling method in this embodiment. The processor executes various functional applications and data processing by running the software programs and modules stored in the memory 104, thereby implementing the above-mentioned task frame-skipping scheduling method. The memory 104 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include memory remotely located relative to the processor, and these remote memories can be connected to the computer terminal 10 via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0034] The transmission module 106 is used to receive or send data via a network. Specific examples of the network described above may include a wireless network provided by the communication provider of the computer terminal 10. In one example, the transmission module 106 includes a network interface controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the transmission module 106 may be a radio frequency (RF) module, used for wireless communication with the Internet.
[0035] The display can be, for example, a touchscreen liquid crystal display (LCD) that allows the user to interact with the user interface of the computer terminal 10.
[0036] It should be noted here that, in some optional embodiments, the above... Figure 1 The computer terminal shown may include hardware elements (including circuitry), software elements (including computer code stored on a computer-readable medium), or a combination of both hardware and software elements. It should be noted that... Figure 1 This is only one instance of a specific particular instance, and is intended to illustrate the types of components that may exist in the aforementioned computer terminal.
[0037] In the above operating environment, this application provides an embodiment of a task frame-skipping scheduling method. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Also, although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in a different order than that shown here.
[0038] Figure 2 This is a flowchart of a task frame-skipping scheduling method according to an embodiment of this application, such as... Figure 2 As shown, the method includes the following steps:
[0039] Step S202: Obtain the target frame-skipping task with a preset frame-skipping interval, and obtain the set of frame-skipping intervals for all scheduled frame-skipping tasks in the server, wherein the task start point corresponding to the target frame-skipping task is the target task start execution time point.
[0040] In step S202 above, the target frame extraction task is defined to extract image frames from the video stream at a preset frame extraction interval. The preset frame extraction interval is x. For example, the target frame extraction task needs to extract a video frame every 3 seconds for motion detection analysis, where 3 seconds is the preset frame extraction interval.
[0041] Obtaining the frame extraction interval set of all scheduled frame extraction tasks in the server refers to collecting the frame extraction frequency information of all currently running frame extraction tasks, forming a set containing the frame extraction frequencies of all tasks. For example, the frame extraction interval set includes tasks that extract one frame per second, tasks that extract one frame every 5 seconds, and tasks that extract one frame every 10 seconds, etc. In this embodiment, the frame extraction interval set can be represented as... .
[0042] The starting point of the target frame extraction task, i.e., the starting execution time of the target task, refers to the theoretical time when the target frame extraction task should begin execution. The selection of this time point needs to consider the current state of the server and the resource availability verification in subsequent steps to ensure that the target frame extraction task can start execution at the appropriate time and at the correct frequency, while coordinating with other running tasks to avoid resource conflicts.
[0043] Step S204: Determine the greatest common divisor of all frame-sampling intervals in the frame-sampling interval set, and determine the unified execution cycle of the scheduled frame-sampling tasks based on the greatest common divisor.
[0044] In step S204 above, the greatest common divisor (GCD) of all frame-slicing intervals in the frame-slicing interval set is determined. That is, it is necessary to find the largest common divisor among the frame-slicing intervals of all scheduled frame-slicing tasks on the server. For example, if there are two scheduled frame-slicing tasks on the server, one that slices a frame every 6 seconds and the other that slices a frame every 10 seconds, then the greatest common divisor of the frame-slicing intervals of these two tasks is 2 seconds.
[0045] Based on the calculated greatest common divisor, a unified execution cycle can be determined. This refers to the frequency at which all frame-skipping tasks will be executed synchronously within this unified execution period. For example, if the greatest common divisor is 2 seconds, then the unified execution period will also be set to 2 seconds. This means that the original tasks, which skimmed frames at frequencies of 6 seconds and 10 seconds respectively, will now work together within a 2-second period, each triggering a frame-skipping action at a specific point within its period.
[0046] By establishing a unified execution cycle, we can better control and coordinate the execution of all tasks, ensure the effective allocation of resources, achieve time alignment between multiple tasks and avoid resource conflicts, and improve overall resource utilization efficiency and task processing capabilities.
[0047] Step S206: Determine all theoretical execution time points of the target frame extraction task within a unified execution cycle, wherein the theoretical execution time points are determined based on the preset frame extraction interval and the target task start execution time point.
[0048] In step S206 above, the target task start execution time point determined in step S202 is used. Based on this, within a unified execution cycle Within this unified execution cycle, calculate all theoretical execution time points of the target frame extraction task, i.e. N is a natural number.
[0049] Step S208: Verify the resource availability at all theoretical execution time points, and schedule the target frame extraction task based on the verification results of resource availability.
[0050] In step S208 above, verifying the resource availability at all theoretical execution time points means whether the server has sufficient resources (such as CPU, memory, I / O, etc.) to support the execution of the target frame extraction task at each theoretical execution time point.
[0051] For example, obtain the server's resource usage at each theoretical execution time point, compare the server's resource usage at each theoretical execution time point with the amount of resources required by the target frame extraction task, determine whether there are idle resources that meet the requirements, obtain the verification results, and schedule the target frame extraction task based on the verification results.
[0052] Through steps S202 to S208, the goal of dynamically adapting to multi-task requirements is achieved, thereby optimizing resource allocation and improving efficiency. This solves the problem that traditional fixed-frequency frame skipping strategies are difficult to adapt to complex and ever-changing task requirements, resulting in low resource utilization. The following is a further explanation.
[0053] In the above task frame-skipping scheduling method, the starting execution time of the target task is determined in the following way: obtaining the display time corresponding to the server, wherein the display time is used to represent the current time; obtaining multiple discrete time points within the first preset frame-skipping interval; determining the potential task starting execution time of the target frame-skipping task based on the discrete time points and the display time; verifying the potential task starting execution time points, and determining the verified potential task starting execution time points as the target task starting execution time points.
[0054] In some embodiments of this application, the current real time point is obtained, i.e., the display time of the aforementioned server, and this display time is used as the time base. During the first preset frame skipping interval... Within this range, each discrete time point is denoted as... If the preset frame extraction interval is 3 seconds, each discrete time point can be 1 second, 2 seconds, or 3 seconds. The potential task start execution time point of the target frame extraction task is determined based on the display time and discrete time points, such as display time + 1 second, display time + 2 seconds, and display time + 3 seconds. The potential task start execution time points in these three cases are verified, and the verified potential task start execution time point is determined as the target task start execution time point.
[0055] In the above steps, verifying the start execution time of potential tasks and determining the verified start execution time of potential tasks as the start execution time of target tasks includes: obtaining a first potential task start execution time, wherein the first potential task start execution time is any potential task start execution time; determining the server's load at the first potential task start execution time to obtain a first determination result; and if the first determination result indicates that the server has spare resources required to execute the target frame extraction task at the first potential task start execution time, determining that the first potential task start execution time has been verified and determining the first potential task start execution time as the start execution time of target tasks.
[0056] In some embodiments of this application, the first potential task start execution time point can be any potential task start execution time point, or it can be the first discrete time point within a preset frame extraction interval, i.e., the first potential task start execution time point. By analyzing the resource load of the server at the first potential task start execution time point, a first judgment result is obtained, such as judging the server's CPU utilization, memory usage, network bandwidth, and the status of other key resources, to assess whether the server has sufficient spare resources to support the start and execution of the target frame extraction task. If the first judgment result indicates that the server has spare resources required to execute the target frame extraction task at the first potential task start execution time point, then the verification result of the first potential task start execution time point is verified as successful, and the first potential task start execution time point is determined as the target task start execution time point. That is, starting from the first potential task start execution time point, the target frame extraction task can be executed on the server according to its preset frame extraction interval without conflicting with the resource requirements of other tasks.
[0057] In the above steps, the method further includes: if the first judgment result indicates that the server has no spare resources at the first potential task start execution time point, obtaining the second potential task start execution time point, wherein the second potential task start execution time point is the next potential task start execution time point after the first potential task start execution time point; judging the server's load at the second potential task start execution time point to obtain a second judgment result; if the second judgment result indicates that the server has spare resources required to execute the target frame extraction task at the second potential task start execution time point, determining that the second potential task start execution time point has passed verification, and determining the second potential task start execution time point as the target task start execution time point; if the second judgment result indicates that the server has no spare resources required to execute the target frame extraction task at the second potential task start execution time point, repeating the steps of obtaining the next potential task start execution time point and judging the server's load at the next potential task start execution time point, until a target potential task start execution time point with spare resources required to execute the target frame extraction task is found, and determining the target potential task start execution time point as the target task start execution time point.
[0058] In some embodiments of this application, the verification process is an iterative screening process, which involves sequentially checking each potential task start execution time point until a suitable potential task start execution time point is found. If the verification at the first potential task start execution time point fails, i.e., the server does not have sufficient spare resources to execute the target frame extraction task at that first potential task start execution time point, the system automatically searches for and verifies subsequent time points to determine a suitable start execution time point. The specific process is as follows:
[0059] 1. Take the start time of the second potential task as a new candidate start time. The start time of the second potential task is the next discrete time point within the first frame extraction interval that immediately follows the start time of the first potential task.
[0060] 2. Evaluate the server's resource load at the start time of the second potential task to check the feasibility of starting the target frame extraction task at that time. If the server's resources at that time meet the requirements of the target frame extraction task, i.e., there are sufficient spare resources, a second judgment result is obtained that passes the verification. Passing the verification indicates that the target frame extraction task can be scheduled and executed from the start time of the second potential task without encountering resource conflicts, and the start time of the second potential task is determined as the start time of the target task.
[0061] 3. If the verification of the second potential task start execution time point still fails, that is, the second judgment result indicates that the server does not have enough resources to execute the target frame extraction task at the second potential task start execution time point, then the same process will be followed to continuously search for the next potential task start execution time point and repeatedly perform resource load judgment until a potential time point with sufficient resources is found. This time point is then determined as the start execution time point of the target task.
[0062] In this way, the system can ensure that the target frame extraction task finds an optimal start execution time within the first frame extraction interval. This time not only meets the frequency requirements of the task itself, but also takes into account the resource status of the server, avoiding resource waste and conflicts, and improving the overall scheduling efficiency and system performance.
[0063] In step S208 of the above task frame extraction scheduling method, the resource availability at all theoretical execution time points is verified, and the target frame extraction task is scheduled according to the verification results of resource availability. This includes: when the server has spare resources required to execute the target frame extraction task at all theoretical execution time points, the verification result is determined to be verified as passed, and the target frame extraction task is scheduled to be executed on the server according to the theoretical execution time points.
[0064] In some embodiments of this application, it is checked one by one whether the server has the spare resources required to execute the target frame extraction task at each theoretical execution time point. If the server has sufficient spare resources to execute the target frame extraction task at all calculated theoretical execution time points, the verification result is considered successful. The target frame extraction task is added to the server's scheduler and scheduled to be executed on the server according to the sequence of theoretical execution time points.
[0065] Through the above verification and scheduling process, it is ensured that even with multiple frame-skipping tasks and various frequency requirements, each task has its own dedicated resource allocation at its own execution time, avoiding resource conflicts and improving the server's resource utilization efficiency and task processing capabilities.
[0066] When there are multiple target frame extraction tasks, if the first target frame extraction task has already been scheduled on the server according to the above process, then the first target frame extraction task is included in the frame extraction tasks already scheduled on the server. In determining whether the next target frame extraction task can be scheduled by the server, the frame extraction interval of the first target frame extraction task needs to be considered.
[0067] In step S208 of the above task frame extraction scheduling method, the method further includes: when the server does not have any spare resources required to execute the target frame extraction task at any theoretical execution time point, the verification result is determined to be a verification failure, and the target task start execution time point of the target frame extraction task is re-determined.
[0068] In some embodiments of this application, in the event of verification failure, the process reverts to the initial potential task start execution time point selection stage and searches for a new potential task start execution time point. For example, the verification process can be performed on the unverified potential task start execution time points according to the time sequence, and a new target task start execution time point can be determined. Based on the new target task start execution time point, a new theoretical execution time point can be determined, and the resource availability verification steps can be repeated to check whether the server has the spare resources required to execute the target frame extraction task at the new theoretical execution time point.
[0069] If the verification still fails at the newly determined theoretical execution time point, meaning that the server still lacks resources at a new theoretical execution time point, the system will continue to iterate the above process, constantly trying the next potential task start execution time point, until a time point that can meet the resource requirements of all theoretical execution time points is found.
[0070] In step S208 of the above task frame extraction scheduling method, the method further includes: when the server does not have any spare resources required to execute the target frame extraction task at any theoretical execution time point, the target frame extraction task is switched to other servers for scheduling.
[0071] In some embodiments of this application, the server cannot provide the necessary spare resources for the target frame extraction task at any of the theoretical execution times, meaning that the server's resources are already fully occupied by other tasks and there is insufficient space to support the execution of a new task. In this case, to ensure that the target frame extraction task can be processed in a timely manner, the system will automatically switch the target frame extraction task from the currently resource-constrained server to another server with sufficient resources. This switching process can be based on the server cluster's resource monitoring and management mechanism to ensure that the target frame extraction task can be rescheduled in a timely and efficient manner.
[0072] After finding another server with sufficient resources, the system will reschedule the target frame extraction task on the new server. This includes resetting the start execution time and verifying the resource availability of all theoretical execution time points on the new server. If the resource availability verification for all theoretical execution time points of the target frame extraction task passes on the new server, the system will officially schedule the target frame extraction task to the new server and begin executing the frame extraction operation. In this way, the target frame extraction task can be processed according to the preset frame extraction interval in an environment without resource constraints.
[0073] The task frame-skipping scheduling method provided in this application establishes a unified execution cycle constraint on the task frequency structure by constructing a periodic coordination mechanism. It also introduces a starting-point load prediction and periodic load mapping strategy to achieve frame-skipping scheduling under time alignment and resource allocation constraints, thereby improving the system's concurrency control capability and resource utilization efficiency. This not only optimizes resource utilization and reduces resource waste caused by prolonged service idleness, but also effectively avoids resource overload when handling mixed tasks with both high-frequency and low-frequency frame-skipping requirements. This ensures system stability and algorithm execution timeliness, and allows for flexible adaptation to various task requirements, maximizing overall resource utilization efficiency while guaranteeing stable and efficient system operation.
[0074] In urban governance AI platforms involving the parallel deployment of multiple project algorithms, video stream frame extraction tasks often exhibit diverse and complex characteristics. Each project requires a different frame extraction frequency based on its business needs and algorithm characteristics. For example, area intrusion detection requires high-frequency frame extraction to achieve real-time monitoring of dynamic events, while trash can overflow detection only requires low-frequency frame extraction to meet business objectives. Deploying tasks of different frequencies as independent services not only incurs significant resource overhead but also leads to drastic fluctuations in system load due to uncontrollable task execution times. The task frame extraction scheduling method provided in this application uniformly orchestrates the frame extraction times of all tasks, achieving orderly task execution rhythm and balanced resource utilization.
[0075] Figure 3 This is a structural diagram of a task frame-skipping scheduling device according to an embodiment of this application, as shown below. Figure 3 As shown, the device includes:
[0076] The acquisition module 30 is used to acquire the target frame-picking task with a preset frame-picking interval, and to acquire the set of frame-picking intervals of all scheduled frame-picking tasks in the server, wherein the task start point corresponding to the target frame-picking task is the start execution time point of the target task.
[0077] The first determining module 32 is used to determine the greatest common divisor of all frame-sampling intervals in the frame-sampling interval set, and to determine the unified execution cycle of the scheduled frame-sampling tasks based on the greatest common divisor.
[0078] The second determining module 34 is used to determine all theoretical execution time points of the target frame extraction task within a unified execution cycle, wherein the theoretical execution time points are determined based on the preset frame extraction interval and the target task start execution time point;
[0079] Verification module 36 is used to verify the resource availability at all theoretical execution time points and schedule the target frame extraction task based on the verification results of resource availability.
[0080] By using the acquisition module, the first determination module, the second determination module, and the verification module in the above-mentioned task frame extraction scheduling device, the goal of dynamically adapting to the needs of multiple tasks is achieved, thereby realizing the technical effects of optimizing resource allocation and improving efficiency. This solves the technical problem that the traditional fixed-frequency frame extraction strategy is difficult to adapt to complex and ever-changing task requirements and has low resource utilization.
[0081] In the acquisition module of the aforementioned task frame extraction scheduling device, the acquisition module is used to determine the starting execution time of the target task. Specifically, the starting execution time of the target task is determined in the following ways: acquiring the display time corresponding to the server, wherein the display time is used to represent the current time; acquiring multiple discrete time points within the first preset frame extraction interval; determining the potential task starting execution time of the target frame extraction task based on the discrete time points and the display time; verifying the potential task starting execution time points, and determining the verified potential task starting execution time points as the starting execution time of the target task.
[0082] In the acquisition module of the aforementioned task frame extraction scheduling device, the acquisition module is further used to acquire the start execution time point of the first potential task, wherein the start execution time point of the first potential task is any potential task start execution time point; determine the load status of the server at the start execution time point of the first potential task, and obtain a first determination result; if the first determination result indicates that the server has spare resources required to execute the target frame extraction task at the start execution time point of the first potential task, determine that the start execution time point of the first potential task has been verified, and determine the start execution time point of the first potential task as the start execution time point of the target task.
[0083] In the acquisition module of the aforementioned task frame extraction scheduling device, the acquisition module is further configured to: 1) acquire a second potential task start execution time point when the first judgment result indicates that the server has no spare resources at the start execution time point of the first potential task, wherein the second potential task start execution time point is the next potential task start execution time point after the start execution time point of the first potential task; 2) determine the server's load at the second potential task start execution time point to obtain a second judgment result; 3) determine that the second potential task start execution time point has been verified as valid when the second judgment result indicates that the server has spare resources required to execute the target frame extraction task at the start execution time point of the second potential task, and determine the second potential task start execution time point as the target task start execution time point; 4) repeat the steps of acquiring the next potential task start execution time point and determining the server's load at the next potential task start execution time point when the second judgment result indicates that the server does not have spare resources required to execute the target frame extraction task at the start execution time point of the second potential task, until a target potential task start execution time point with spare resources required to execute the target frame extraction task is found, and the target potential task start execution time point is determined as the target task start execution time point.
[0084] In the verification module of the aforementioned task frame extraction scheduling device, the verification module is also used to determine that the verification result is passed when the server has spare resources required to execute the target frame extraction task at all theoretical execution time points, and to schedule the target frame extraction task to be executed on the server according to the theoretical execution time points.
[0085] In the verification module of the aforementioned task frame extraction scheduling device, the verification module is also used to determine the verification result as verification failure and re-determine the target task start execution time point of the target frame extraction task when the server does not have the spare resources required to execute the target frame extraction task at any theoretical execution time point.
[0086] In the verification module of the aforementioned task frame extraction scheduling device, the verification module is also used to switch the target frame extraction task to other servers for scheduling when the server does not have any spare resources required to execute the target frame extraction task at any theoretical execution time point.
[0087] It should be noted that, Figure 3 The task frame-skipping scheduling device shown is used to perform Figure 2 The task frame-skipping scheduling method shown above is also applicable to this task frame-skipping scheduling device, and will not be repeated here.
[0088] This application also provides an electronic device, which includes a memory and a processor. The memory stores program instructions, and the processor is connected to the memory and executes program instructions to perform the following functions: obtaining a target frame-skipping task with a preset frame-skipping interval, and obtaining a set of frame-skipping intervals for all scheduled frame-skipping tasks in a server, wherein the task start point corresponding to the target frame-skipping task is the target task start execution time point; determining the greatest common divisor of all frame-skipping intervals in the frame-skipping interval set, and determining a unified execution period for the scheduled frame-skipping tasks based on the greatest common divisor; determining all theoretical execution time points of the target frame-skipping task within the unified execution period, wherein the theoretical execution time points are determined based on the preset frame-skipping interval and the target task start execution time point; verifying the resource availability of all theoretical execution time points, and scheduling the target frame-skipping task based on the resource availability verification results.
[0089] It should be noted that the aforementioned electronic equipment is used to perform Figure 2 The task frame-skipping scheduling method shown above is also applicable to this electronic device, and will not be repeated here.
[0090] This application embodiment also provides a non-volatile storage medium, which includes a stored computer program. The device containing the non-volatile storage medium executes the following task frame-skipping scheduling method by running the computer program: obtaining a target frame-skipping task with a preset frame-skipping interval, and obtaining a set of frame-skipping intervals for all scheduled frame-skipping tasks in a server, wherein the task start point corresponding to the target frame-skipping task is the target task's start execution time point; determining the greatest common divisor (GCD) of all frame-skipping intervals in the frame-skipping interval set, and determining a unified execution period for the scheduled frame-skipping tasks based on the GCD; determining all theoretical execution time points of the target frame-skipping task within the unified execution period, wherein the theoretical execution time points are determined based on the preset frame-skipping interval and the target task's start execution time point; verifying the resource availability of all theoretical execution time points, and scheduling the target frame-skipping task based on the resource availability verification results.
[0091] It should be noted that the aforementioned non-volatile storage media is used for execution. Figure 2 The task frame-skipping scheduling method shown above is also applicable to this non-volatile storage medium, and will not be repeated here.
[0092] This application also provides a computer program product, including computer instructions that, when executed by a processor, implement the steps of the task frame-skipping scheduling method in various embodiments of this application.
[0093] This application also provides a computer program that, when executed by a processor, implements the steps of the task frame-skipping scheduling method in various embodiments of this application.
[0094] The sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.
[0095] In the above embodiments of this application, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0096] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. The device embodiments described above are merely illustrative; for example, the division of units can be a logical functional division, and in actual implementation, there may be other division methods. For instance, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the displayed or discussed mutual coupling, direct coupling, or communication connection may be through some interfaces; the indirect coupling or communication connection between units or modules may be electrical or other forms.
[0097] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0098] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0099] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard drive, magnetic disk, or optical disk.
[0100] The above description is only a preferred embodiment of this application. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of this application, and these improvements and modifications should also be considered within the scope of protection of this application.
Claims
1. A task frame-skipping scheduling method, characterized in that, include: Obtain the target frame-skipping task with a preset frame-skipping interval, and obtain the set of frame-skipping intervals for all scheduled frame-skipping tasks in the server, wherein the task start point corresponding to the target frame-skipping task is the target task start execution time point. Determine the greatest common divisor of all frame-sampling intervals in the frame-sampling interval set, and determine the unified execution cycle of the scheduled frame-sampling task based on the greatest common divisor; Determine all theoretical execution time points of the target frame extraction task within the unified execution cycle, wherein the theoretical execution time points are determined based on the preset frame extraction interval and the starting execution time point of the target task; Verify the resource availability at all theoretical execution time points, and schedule the target frame extraction task based on the verification results of the resource availability.
2. The method according to claim 1, characterized in that, The start time of the target task is determined in the following way: Obtain the display time corresponding to the server, wherein the display time is used to represent the current time; Obtain multiple discrete time points within the first preset frame extraction interval; Based on the discrete time points and the display time, determine the potential task start execution time points for the target frame extraction task; The start time of the potential task is verified, and the start time of the verified potential task is determined as the start time of the target task.
3. The method according to claim 2, characterized in that, Verifying the start time of the potential task and determining the verified start time of the potential task as the start time of the target task includes: Obtain the start execution time of the first potential task, wherein the start execution time of the first potential task can be any start execution time of any potential task; Determine the load status of the server at the start execution time of the first potential task to obtain a first determination result; If the first judgment result indicates that the server has spare resources required to execute the target frame extraction task at the first potential task start execution time point, the first potential task start execution time point is determined to be verified as the target task start execution time point.
4. The method according to claim 3, characterized in that, The method further includes: If the first judgment result indicates that the server has no spare resources at the first potential task start execution time point, the server obtains the second potential task start execution time point, wherein the second potential task start execution time point is the next potential task start execution time point after the first potential task start execution time point; Determine the load status of the server at the start execution time of the second potential task to obtain a second determination result; If the second judgment result indicates that the server has spare resources required to execute the target frame extraction task at the second potential task start execution time point, the second potential task start execution time point is determined to be verified as the target task start execution time point; If the second judgment result indicates that the server does not have the spare resources required to execute the target frame extraction task at the second potential task start execution time point, the steps of obtaining the next potential task start execution time point and judging the server's load at the next potential task start execution time point are repeated until a target potential task start execution time point with spare resources required to execute the target frame extraction task is found, and the target potential task start execution time point is determined as the target task start execution time point.
5. The method according to claim 1, characterized in that, Verify resource availability at all theoretical execution time points, and schedule the target frame extraction task based on the verification results of resource availability, including: If the server has spare resources required to execute the target frame extraction task at all theoretical execution time points, the verification result is determined to be successful, and the target frame extraction task is scheduled to be executed on the server according to the theoretical execution time points.
6. The method according to claim 5, characterized in that, The method further includes: If the server does not have the spare resources required to execute the target frame extraction task at any theoretical execution time point, the verification result is determined to be a verification failure, and the target task start execution time point of the target frame extraction task is re-determined.
7. The method according to claim 1, characterized in that, The method further includes: If the server does not have any spare resources required to execute the target frame extraction task at any theoretical execution time point, the target frame extraction task will be switched to another server for scheduling.
8. A task frame-skipping scheduling device, characterized in that, include: The acquisition module is used to acquire the target frame-picking task with a preset frame-picking interval, and to acquire the set of frame-picking intervals of all scheduled frame-picking tasks in the server, wherein the task start point corresponding to the target frame-picking task is the target task start execution time point. The first determining module is used to determine the greatest common divisor of all frame-sampling intervals in the frame-sampling interval set, and to determine the unified execution cycle of the scheduled frame-sampling task based on the greatest common divisor. The second determining module is used to determine all theoretical execution time points of the target frame extraction task within the unified execution cycle, wherein the theoretical execution time points are determined based on the preset frame extraction interval and the starting execution time point of the target task; The verification module is used to verify the resource availability at all theoretical execution time points and schedule the target frame extraction task based on the verification results of the resource availability.
9. An electronic device, characterized in that, include: Memory, used to store program instructions; A processor, connected to the memory, is configured to execute program instructions to perform the following functions: obtaining a target frame-skipping task with a preset frame-skipping interval, and obtaining a set of frame-skipping intervals for all scheduled frame-skipping tasks in the server, wherein the task start point corresponding to the target frame-skipping task is the target task start execution time point; determining the greatest common divisor (GCD) of all frame-skipping intervals in the set of frame-skipping intervals, and determining a unified execution period for the scheduled frame-skipping tasks based on the GCD; determining all theoretical execution time points for the target frame-skipping task within the unified execution period, wherein the theoretical execution time points are determined based on the preset frame-skipping interval and the target task start execution time point; verifying the resource availability of all theoretical execution time points, and scheduling the target frame-skipping task based on the verification results of the resource availability.
10. A non-volatile storage medium, characterized in that, The non-volatile storage medium includes a stored computer program, wherein the device containing the non-volatile storage medium executes the task frame scheduling method according to any one of claims 1 to 7 by running the computer program.
11. A computer program product comprising computer instructions, characterized in that, When the computer instructions are executed by the processor, they implement the task frame-skipping scheduling method according to any one of claims 1 to 7.