An AI inference scheduling method applied to a wearable device and a related device thereof
By optimizing the scheduling algorithm for wearable devices through pruning and feature matching algorithms, the limitations of computing power and memory in traditional methods are solved, enabling real-time AI inference for wearable devices.
Patent Information
- Application Number
- CN202310495194.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-05
- Publication Date
- 2026-11-27
- Estimated Expiration
- 2043-05-05
AI Technical Summary
Traditional real-time AI inference scheduling methods have failed to fully consider the limitations of wearable devices and system resources, resulting in limitations in computing power and memory, which cannot meet the needs of real-time AI inference.
By employing pruning optimization scheduling algorithm and feature matching algorithm, the system receives image frames from wearable devices, determines whether they are the first frame, obtains system status information, performs scheduling decision calculations, optimizes model inference task scheduling, and meets real-time requirements.
The scheduling decision, which minimizes inference time, is obtained in a short period of time, meeting the real-time AI inference needs of wearable devices and improving the accuracy and efficiency of AI inference.
Smart Images

Figure CN116541146B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of image processing technology, and in particular to an AI inference scheduling method, apparatus, computer device and storage medium for wearable devices. Background Technology
[0002] For real-time AI inference problems in wearable devices, recent technologies include the "mobile acceleration" method proposed by Zhao T et al., which reduces computation and memory requirements by decreasing the kernel size of deep residual networks and using mixed precision training, thus significantly improving the running efficiency of deep residual networks on mobile devices. Another approach is the face recognition system based on wearable cameras proposed by Yi J et al., which deploys deep learning models on an FPGA-based computing platform and can quickly achieve high accuracy in identifying people in densely populated urban areas.
[0003] However, the applicant found that traditional real-time AI inference scheduling methods all have drawbacks in real-time AI inference on wearable devices. Although the acceleration method proposed by Zhao T et al. can reduce the computational and memory requirements of the network, there may still be limitations in computational power and memory on some mobile terminal devices. Therefore, in practical applications, it is necessary to select appropriate network architecture and mobile devices according to specific circumstances. While Yi J et al. accelerated AI inference in their system, this system directly offloaded the deep learning model inference task to the FPGA computing platform, without considering the system situation in continuous scenarios, and without fully utilizing other system resources or studying the impact of network resources on the system. Therefore, the real-time AI inference problem for wearable devices needs to consider the limitations of wearable devices and fully consider system resources. Since Zhao T and Yi J et al. did not take both of these points into account, it is evident that traditional real-time AI inference scheduling methods have not adequately solved the real-time AI inference problem for wearable devices. Summary of the Invention
[0004] The purpose of this application is to propose an AI inference scheduling method, apparatus, computer device and storage medium for wearable devices, so as to solve the problem that traditional real-time AI inference scheduling methods do not well meet the real-time AI inference problem of wearable devices.
[0005] To address the aforementioned technical problems, this application provides an AI inference scheduling method for wearable devices, employing the following technical solution: Receive the current image frame sent by the wearable device; If the current image frame is the first image frame, then the current image frame is determined to be a PrFm frame; Obtain the first system status information; Based on the pruning optimization scheduling algorithm and the first system state information, a scheduling decision calculation operation is performed on the PrFm frame to obtain the first scheduling decision of the current image frame; Based on the first scheduling decision, perform model inference task scheduling operations to obtain the first inference result.
[0006] Furthermore, the feature is that, after the step of receiving the current image frame sent by the wearable device, the following step is also included: If the current image frame is not the first image frame, then the number of key point matches between the current image frame and the PrFm frame is calculated according to the feature matching scheduling algorithm; If the number of key point matches meets the preset matching number condition, then the first inference result is used as the inference result of the current image frame.
[0007] Furthermore, after the step of calculating the number of keypoint matches between the current image frame and the PrFm frame according to the feature matching scheduling algorithm if the current image frame is not the first image frame, the following step is also included: If the number of key point matches does not meet the matching number condition, then the current image frame is determined as the PrFm frame; Obtain the status information of the second system; Based on the pruning optimization scheduling algorithm and the second system state information, a scheduling decision calculation operation is performed on the PrFm frame to obtain the second scheduling decision of the current image frame; Based on the second scheduling decision, perform model inference task scheduling operations to obtain the second inference result.
[0008] Furthermore, the step of calculating the number of keypoint matches between the current image frame and the PrFm frame based on the feature matching scheduling algorithm specifically includes the following steps: Based on the ORB detector, key point detection and descriptor acquisition operations are performed on the current image frame to obtain the key points of the current frame and the key point descriptors of the current frame corresponding to the key points of the current frame. The initial number of keypoint matches between the current frame keypoint descriptor and the keypoint descriptor of the PrFm frame is obtained according to the knnMatch function. The number of keypoint matches is obtained by filtering the initial number of keypoint matches based on Lowe's data.
[0009] Furthermore, the first system status information includes real-time network bandwidth, network latency, and system computing resources. The step of performing scheduling decision calculations on the PrFm frame based on the pruning optimization scheduling algorithm and the first system status information to obtain the first scheduling decision for the current image frame specifically includes the following steps: Based on the real-time network bandwidth, the network latency, and the system computing resources, the network transmission time and model inference time are calculated according to the data scheduling model. The first scheduling decision is obtained by predicting the shortest inference time based on the network transmission time and the model inference time.
[0010] To address the aforementioned technical problems, this application also provides an AI inference scheduling device for wearable devices, employing the following technical solution: The image frame acquisition module is used to receive the current image frame sent by the wearable device; The first PrFm frame determination module is used to determine the current image frame as a PrFm frame if the current image frame is the first image frame. The first status information acquisition module is used to acquire the first system status information; The first decision calculation module is used to perform scheduling decision calculation operations on the PrFm frame according to the pruning optimization scheduling algorithm and the first system state information to obtain the first scheduling decision of the current image frame. The first task scheduling module is used to perform model inference task scheduling operations based on the first scheduling decision to obtain the first inference result.
[0011] Furthermore, the device also includes: The matching calculation module is used to calculate the number of key point matches between the current image frame and the PrFm frame according to the feature matching scheduling algorithm if the current image frame is not the first image frame. The inference result confirmation module is used to take the first inference result as the inference result of the current image frame if the number of key point matches meets a preset matching number condition.
[0012] Furthermore, the device also includes: The second PrFm frame determination module is used to determine the current image frame as the PrFm frame if the number of key point matches does not meet the matching number condition. The second status information acquisition module is used to acquire the second system status information; The second decision calculation module is used to perform scheduling decision calculation operations on the PrFm frame according to the pruning optimization scheduling algorithm and the second system state information to obtain the second scheduling decision of the current image frame. The second task scheduling module is used to perform model inference task scheduling operations based on the second scheduling decision to obtain the second inference result.
[0013] To address the aforementioned technical problems, this application also provides a computer device that employs the following technical solution: It includes a memory and a processor, wherein the memory stores computer-readable instructions, and the processor executes the computer-readable instructions to implement the steps of the AI inference scheduling method for wearable devices as described above.
[0014] To address the aforementioned technical problems, this application also provides a computer-readable storage medium, employing the technical solution described below: The computer-readable storage medium stores computer-readable instructions, which, when executed by a processor, implement the steps of the AI inference scheduling method for wearable devices as described above.
[0015] This application provides an AI inference scheduling method for wearable devices, comprising: receiving a current image frame sent by the wearable device; if the current image frame is the first image frame, then determining the current image frame as a PrFm frame; acquiring first system state information; performing scheduling decision calculation operations on the PrFm frame according to a pruning optimization scheduling algorithm and the first system state information to obtain a first scheduling decision for the current image frame; and performing model inference task scheduling operations according to the first scheduling decision to obtain a first inference result. Compared with the prior art, this application, after acquiring the current image frame sent by the wearable device, determines whether the wearable device has acquired an image frame. If the frame is the first frame, it directly records the frame as a PrFm frame, and then acquires the system real-time bandwidth, network latency, and system computing resource status. Finally, it executes a pruning optimization scheduling algorithm to obtain the scheduling decision of the frame in the system, which can meet the real-time requirements of AI inference for wearable devices. The pruning optimization scheduling algorithm can obtain the scheduling decision with the minimum inference time under the current system state in a short time, which can effectively solve the real-time AI inference problem of wearable devices. Attached Figure Description
[0016] To more clearly illustrate the solutions in this application, the accompanying drawings used in the description of the embodiments of this application will be briefly introduced below. Obviously, the accompanying drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0017] Figure 1 This is an exemplary system architecture diagram to which this application can be applied; Figure 2This is a flowchart illustrating the implementation of the AI inference scheduling method for wearable devices provided in Embodiment 1 of this application. Figure 3 yes Figure 2 A flowchart of a specific implementation method following step S201; Figure 4 yes Figure 3 A flowchart of a specific implementation method following step S301; Figure 5 yes Figure 3 A flowchart of a specific implementation of step S301; Figure 6 yes Figure 2 A flowchart of a specific implementation of step S204; Figure 7 This is a schematic diagram of the pruning optimization scheduling algorithm provided in Embodiment 1 of this application; Figure 8 This is a schematic diagram of the scheduling algorithm provided in Embodiment 1 of this application; Figure 9 This is a schematic diagram of the structure of the AI inference scheduling device for wearable devices provided in Embodiment 2 of this application; Figure 10 This is a schematic diagram of the structure of one embodiment of the computer device according to this application. Detailed Implementation
[0018] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application pertains; the terminology used herein in the specification of the application is for the purpose of describing particular embodiments only and is not intended to be limiting of the application; the terms "comprising" and "having," and any variations thereof, in the specification, claims, and foregoing drawings of this application, are intended to cover non-exclusive inclusion. The terms "first," "second," etc., in the specification, claims, or foregoing drawings of this application are used to distinguish different objects, not to describe a particular order.
[0019] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.
[0020] 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.
[0021] like Figure 1 As shown, system architecture 100 may include terminal devices 101, 102, and 103, a network 104, and a server 105. Network 104 serves as the medium for providing communication links between terminal devices 101, 102, and 103 and server 105. Network 104 may include various connection types, such as wired or wireless communication links, or fiber optic cables, etc.
[0022] Users can use terminal devices 101, 102, and 103 to interact with server 105 via network 104 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 101, 102, and 103, such as web browser applications, shopping applications, search applications, instant messaging tools, email clients, social media platform software, etc.
[0023] Terminal devices 101, 102, and 103 can be various electronic devices with displays and support web browsing, including but not limited to smartphones, tablets, e-book readers, MP3 players (Moving Picture Experts Group Audio Layer III), MP4 players (Moving Picture Experts Group Audio Layer IV), laptops, and desktop computers, etc.
[0024] Server 105 can be a server that provides various services, such as a backend server that supports the pages displayed on terminal devices 101, 102, and 103.
[0025] It should be noted that the AI inference scheduling method for wearable devices provided in this application embodiment is generally executed by a server / terminal device, and correspondingly, the AI inference scheduling device for wearable devices is generally set in the server / terminal device.
[0026] It should be understood that Figure 1 The number of terminal devices, networks, and servers shown is merely illustrative. Depending on implementation needs, any number of terminal devices, networks, and servers can be included.
[0027] Example 1 Continue to refer to Figure 2 The diagram shows the implementation flowchart of the AI inference scheduling method for wearable devices provided in Embodiment 1 of this application. For ease of explanation, only the parts related to this application are shown.
[0028] The above-mentioned AI inference scheduling method for wearable devices includes steps S201, S202, S203, S204 and S205.
[0029] In step S201, the current image frame sent by the wearable device is received.
[0030] In step S202, if the current image frame is the first image frame, then the current image frame is determined to be a PrFm frame.
[0031] In step S203, the first system status information is obtained.
[0032] In step S204, the scheduling decision calculation operation of the PrFm frame is performed according to the pruning optimization scheduling algorithm and the first system state information to obtain the first scheduling decision of the current image frame.
[0033] In step S205, the model inference task scheduling operation is performed according to the first scheduling decision to obtain the first inference result.
[0034] In this embodiment, the scheduling and management of model inference tasks in the system to minimize inference task execution time and maximize system utilization constitutes the system task scheduling process. Considering the differences in inference time for different models on different computing platforms within the system, as well as the impact of network latency and bandwidth, a scheduling problem arises for real-time AI inference on wearable devices.
[0035] definition 3 A matrix of 3 represents the model. The bandwidth between the computing platform of the scheduling and the computing platform of model j is assumed to be infinite when the computing platforms of the two models are the same. 3 A matrix of 3 represents the model. The model inference time scheduled at time xi.
[0036] Indicates xi and Network latency between xi and When they are equal, A value of 0 indicates that there is no network latency. It means from the model The network transmission time for the scheduled computing platform xi to send data to the scheduled computing platform xj is when the model... When the scheduling platform is consistent with that of model j, The value is 0. The network transmission time for data can be calculated using the following formula:
[0037] Since the Body model and the Context model are independent, therefore, we use... This represents the inference time for the Body model and the Context model. The value is the maximum of the sum of the network transmission time of the Body model and Context model from the wearable device to the model scheduling platform, the inference time of the model on the scheduling platform, and the network transmission time of the extracted feature data to the Emotic model scheduling platform. It can be calculated using the following formula:
[0038] The Emotic model, which receives inference features from the Body model and the Context model, uses its inference time... This means that it equals the inference time on the computing platform x3 scheduled by the Emotic model and the network transmission time from the x3 computing platform to x4 (i.e., the wearable device). The specific mathematical formula is expressed as follows:
[0039] Based on the above definitions and parameter descriptions, it can be described by the following formula:
[0040]
[0041] in and Calculate using formulas (2) and (3) respectively.
[0042] The problem to be solved in this application is the real-time problem of inference time described by formula (4).
[0043] In this embodiment, after obtaining the current image frame sent by the wearable device, it is first determined whether the image frame obtained by the wearable device is the first frame executed by the current algorithm. If the frame is the first frame, it is directly recorded as a PrFm frame. Then, the system real-time bandwidth, network latency, and system computing resource status are obtained. Finally, the pruning optimization scheduling algorithm is executed to obtain the scheduling decision of the frame in the system and the process returns to determining whether the wearable device has obtained a frame.
[0044] This application provides an AI inference scheduling method for wearable devices, comprising: receiving a current image frame sent by the wearable device; if the current image frame is a first image frame, then determining the current image frame as a PrFm frame; acquiring first system state information; performing scheduling decision calculation operations on the PrFm frame according to a pruning optimization scheduling algorithm and the first system state information to obtain a first scheduling decision for the current image frame; and performing model inference task scheduling operations according to the first scheduling decision to obtain a first inference result. Compared with the prior art, this application, after acquiring the current image frame sent by the wearable device, determines whether the wearable device has acquired an image frame. If the frame is the first frame, it directly records the frame as a PrFm frame, and then acquires the system real-time bandwidth, network latency, and system computing resource status. Finally, it executes a pruning optimization scheduling algorithm to obtain the scheduling decision of the frame in the system, which can meet the real-time requirements of AI inference for wearable devices. The pruning optimization scheduling algorithm can obtain the scheduling decision with the minimum inference time under the current system state in a short time, which can effectively solve the real-time AI inference problem of wearable devices.
[0045] Continue reading Figure 3 , showed Figure 2 The flowchart of a specific implementation after step S201 is shown. For ease of explanation, only the parts relevant to this application are shown.
[0046] In some optional implementations of this embodiment, after step S201, steps S301 and S302 are also included.
[0047] In step S301, if the current image frame is not the first image frame, the number of key point matches between the current image frame and the PrFm frame is calculated according to the feature matching scheduling algorithm. In step S302, if the number of key point matches meets the preset matching number condition, the first inference result is used as the inference result of the current image frame.
[0048] In this embodiment, calculating the number of keypoint matches between the current image frame and the PrFm frame can be achieved by performing keypoint detection and descriptor acquisition operations on the current image frame using an ORB detector to obtain the keypoints of the current frame and the corresponding keypoint descriptors of the current frame; obtaining the initial number of keypoint matches between the keypoint descriptors of the current frame and the keypoint descriptors of the PrFm frame using the knnMatch function; and filtering the initial number of keypoint matches using Lowe's algorithm to obtain the total number of keypoint matches.
[0049] In this embodiment, if the current image frame is not the first frame, a feature-matching-based scheduling algorithm is executed to determine the number of keypoint matches between the current frame and the PrFm frame. If the keypoint matching count relationship is satisfied (e.g., keypoint matching count ≥ 0.3), the algorithm will proceed accordingly. If the number of key points in the frame is used, the AI inference result of the PrFm frame is directly used to determine whether the wearable device has obtained a frame.
[0050] Continue reading Figure 4 , showed Figure 3 The flowchart of a specific implementation after step S301 is shown. For ease of explanation, only the parts relevant to this application are shown.
[0051] In some optional implementations of this embodiment, after step S301, the method further includes: step S401, step S402, step S403 and step S404.
[0052] In step S401, if the number of key point matches does not meet the matching number condition, the current image frame is determined as a PrFm frame. In step S402, the second system status information is obtained; In step S403, the scheduling decision calculation operation of the PrFm frame is performed according to the pruning optimization scheduling algorithm and the second system state information to obtain the second scheduling decision of the current image frame; In step S404, the model inference task scheduling operation is performed according to the second scheduling decision to obtain the second inference result.
[0053] In this embodiment, if the number of keypoint matches does not meet the matching quantity condition, the frame is set as a PrFm frame, and then the system's real-time network bandwidth, network latency, and system computing resource status are obtained. Finally, a pruning optimization scheduling algorithm is executed to obtain the scheduling policy for the frame, and the process returns to determining whether the wearable device has obtained a frame.
[0054] Continue reading Figure 5 , showed Figure 3 The flowchart of a specific embodiment of step S301 is shown. For ease of explanation, only the parts relevant to this application are shown.
[0055] In some optional implementations of this embodiment, step S301 specifically includes: step S501, step S502 and step S503.
[0056] In step S501, the ORB detector performs key point detection and descriptor acquisition operations on the current image frame to obtain the key points of the current frame and the key point descriptors of the current frame corresponding to the key points of the current frame. In step S502, the initial number of keypoint matches between the current frame keypoint descriptor and the keypoint descriptor of the PrFm frame is obtained according to the knnMatch function. In step S503, the initial number of keypoint matches is filtered according to Lowe to obtain the number of keypoint matches.
[0057] In this embodiment, the feature-matching-based scheduling algorithm uses OpenCV's ORB detector for keypoint detection and descriptor acquisition. Then, OpenCV's knnMatch function returns the two best matches between each keypoint descriptor in the current frame and the keypoints in the PrFm frame. Finally, Lowe filtering is used for keypoint matching. Lowe filtering is based on a simple mathematical principle. Since keypoint matching might be irrelevant to the actual match due to similar values for most variables within the descriptor, it's necessary to distinguish between the two best matches to ensure they are valid matches rather than coincidences. The formula used for Lowe filtering is: distance1 <distance2 `constant` is a constant value, where `distance1` represents the distance calculated from the best-matching descriptor, `distance2` represents the distance calculated from the second-best-matching descriptor, and `constant` is an empirically determined value of 0.7. When this formula is satisfied, Lowe considers the best-matching point to have a sufficient difference from the second-best-matching point, and thus considers the best-matching point to meet the matching requirements. Finally, if the number of matched keypoints reaches 30% of the total number of keypoints in the current frame, feature matching is considered satisfied, and the subsequent process is unnecessary; the system returns to whether a frame has been obtained from the wearable device.
[0058] Continue reading Figure 6 , showed Figure 2 The flowchart of a specific embodiment of step S204 is shown. For ease of explanation, only the parts relevant to this application are shown.
[0059] In some optional implementations of this embodiment, the first system status information includes real-time network bandwidth, network latency, and system computing resources. Step S204 specifically includes steps S601 and S602.
[0060] In step S601, the network transmission time and model inference time of the model scheduling are calculated based on the real-time network bandwidth, network latency, and system computing resources. In step S602, the scheduling decision with the shortest inference time is predicted based on the data network transmission time and the model inference time, and the first scheduling decision is obtained.
[0061] In this embodiment, the pruning optimization scheduling algorithm takes real-time network bandwidth, real-time network latency, and system computing resources as inputs, and then calculates the data network transmission time and model inference time when the model is scheduled to different computing platforms. Next, it iterates through and combines the AI inference times when the model is scheduled to different computing platforms to obtain a scheduling decision with the shortest prediction inference time. This scheduling decision is the return value of the pruning optimization scheduling algorithm. For example, it calculates the AI inference time under the scheduling of Body model to wearable devices, Context model to cloud servers, and Emotic model to edge servers. Pruning is possible because the maximum value of the sum of the network transmission time of Body model and Context model from the mobile terminal to the model scheduling platform, the model's inference time on the scheduling platform, and the network transmission time of the extracted feature data to the platform where the Emotic model is scheduled is already greater than the currently recorded minimum prediction inference time. Therefore, subsequent calculations can be avoided. Figure 7 The cross-representation in the Emotic model can avoid prediction inference time.
[0062] In practical applications, ① the wearable device acquires frame 1, which is the first frame in the current system, so it is set as a PrFm frame. Then, the bandwidth, latency, and computing resources of the current system are obtained. A pruning optimization scheduling algorithm is then used to calculate the scheduling strategy for frame 1 based on this data. Assume the Body model is scheduled to the edge server, the Context model to the cloud server, and the Emotic model to the edge server. The input data of the models must be transmitted to the Body and Context models, and the inference results of the models must be transmitted to the edge server where the Emotic model resides. The Emotic model receives the inference results of the other two models as input, outputs the AI inference result, and finally returns the result to the wearable device. The time when frame 1 acquires the AI inference result in the system is recorded. ② The wearable device acquires frame 2. Because frame 2 is not the first frame, after calculation by a feature-matching-based scheduling algorithm, frame 2 and frame 1 meet the algorithm's requirements. Therefore, frame 2 directly uses the model inference result of frame 1 without subsequent pruning optimization scheduling and the inference process after scheduling. The process of obtaining the AI inference result in frame 2 within the system is recorded, primarily focusing on the execution time of the feature-matching-based scheduling algorithm. ③ After the wearable device acquires frame 3, because frame 3 is not the first frame and, after the feature-matching-based scheduling algorithm calculation, it does not meet the feature matching requirements with the PrFm frame (which is frame 1 at this point), frame 3 is set as a PrFm frame. Then, the system's bandwidth, latency, and computing resources are obtained, and a pruning optimization scheduling algorithm is executed. Finally, the process returns to whether a frame was acquired from the wearable device in the flowchart. The time it takes for the AI inference result to be obtained in frame 3 within the system is recorded. ④ The execution process for frame 4 is the same as for frame 3. Frame 4 does not meet the feature-matching-based scheduling algorithm requirements with the PrFm frame, so frame 4 is set as a PrFm frame. Then, the system's bandwidth, latency, and computing resources are obtained, and a pruning optimization scheduling algorithm is executed. Finally, the process returns to whether a frame was acquired from the wearable device in the flowchart. The time it takes for the frame to obtain the AI inference result in the system is still recorded; ⑤ The algorithm process ends when the wearable device no longer acquires the frame image. Finally, we obtain the average inference time of the frame during this period and the scheduling decision for each frame.
[0063] In the embodiments of this application, the continuous scenarios on the system of this application are as follows: Figure 8As shown, the bold black dots on the timeline represent frame refresh times. Since the wearable device has a 30Hz camera, the timeline interval between the bold black dots represents 33.3ms. The left side represents frames in a continuous scene, which are refreshed and displayed sequentially after 33.3ms. The middle of the figure shows the components of the complete emotion inference time for each frame in the system, represented by feature matching time (including ORB detector, knnMatch function, and Lowe keypoint matching filtering), scheduling algorithm execution time, Body model inference time on the scheduled computing platform, Context model inference time on the scheduled computing platform, Emotic model inference time on the scheduled computing platform, data transmission time in the network, and idle time. The length of the squares represents the execution time of that part. For example, the square of frame4 (representing the scheduling algorithm execution time) is longer than the square of frame1, indicating that the scheduling algorithm execution time of frame4 is slightly longer than that of frame1.
[0064] In summary, this application proposes a real-time AI inference scheduling algorithm for wearable devices, which determines whether to proceed with the next scheduling step based on the number of keypoint matches in the current frame. If the keypoint matching requirements are met, subsequent pruning optimization scheduling algorithms are unnecessary, significantly reducing the AI inference time for that frame and saving network resources. Otherwise, real-time network bandwidth, network latency, and system computing resources are collected to schedule AI inference for that frame. The key technical aspect is the feature matching and pruning optimization scheduling algorithm. This algorithm meets the real-time requirements of AI inference in wearable devices. The pruning optimization scheduling algorithm can quickly obtain the scheduling decision with the minimum inference time under the current system state, while the feature matching and pruning optimization scheduling algorithm achieves good AI inference accuracy. Our scheduling algorithm is applied in the AI inference program of wearable devices to schedule model inference tasks to meet real-time requirements. For example, in wearable devices, emotion reasoning applications that consider scene context may include multiple AI models, and their inference time on cloud servers and edge servers is shorter. In this case, our proposed scheduling algorithm can be used. It schedules the key features of the analyzed frames and the model inference tasks by analyzing the system's real-time network bandwidth, network latency, and computer resources to meet the real-time requirements of emotion reasoning for frames.
[0065] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by instructing related hardware through computer-readable instructions. These computer-readable instructions can be stored in a computer-readable storage medium. When executed, the computer-readable instructions can include the processes of the embodiments of the above methods. The aforementioned storage medium can be a non-volatile storage medium such as a magnetic disk, optical disk, or read-only memory (ROM), or random access memory (RAM).
[0066] It should be understood that although the steps in the flowcharts of the accompanying figures are shown sequentially as indicated by the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the accompanying figures may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the sub-steps or stages of other steps.
[0067] Example 2 Further reference Figure 9 As a response to the above Figure 2 The implementation of the method shown in this application provides an embodiment of an AI inference scheduling device for wearable devices. This device embodiment is similar to... Figure 2 Corresponding to the method embodiments shown, this device can be specifically applied to various electronic devices.
[0068] like Figure 9 As shown, the AI inference scheduling device 200 applied to wearable devices in this embodiment includes: an image frame acquisition module 210, a first PrFm frame determination module 220, a first state information acquisition module 230, a first decision calculation module 240, and a first task scheduling module 250. Wherein: Image frame acquisition module 210 is used to receive the current image frame sent by the wearable device; The first PrFm frame determination module 220 is used to determine the current image frame as a PrFm frame if the current image frame is the first image frame. The first status information acquisition module 230 is used to acquire the first system status information; The first decision calculation module 240 is used to perform scheduling decision calculation operations on the PrFm frame according to the pruning optimization scheduling algorithm and the first system state information to obtain the first scheduling decision of the current image frame. The first task scheduling module 250 is used to perform model inference task scheduling operations based on the first scheduling decision to obtain the first inference result.
[0069] This application provides an AI inference scheduling device 200 for wearable devices, including: an image frame acquisition module 210, a first PrFm frame determination module 220, a first state information acquisition module 230, a first decision calculation module 240, and a first task scheduling module 250. Compared with the prior art, after acquiring the current image frame sent by the wearable device, this application determines whether the wearable device has acquired an image frame. If the frame is the first frame, it directly records the frame as a PrFm frame. Then, it acquires the system's real-time bandwidth, network latency, and system computing resource status. Finally, it executes a pruning optimization scheduling algorithm to obtain the scheduling decision of the frame in the system. This can meet the real-time requirements of AI inference for wearable devices. The pruning optimization scheduling algorithm can obtain the scheduling decision with the minimum inference time under the current system state in a short time, which can effectively solve the real-time AI inference problem of wearable devices.
[0070] In some optional implementations of this embodiment, the AI inference scheduling device 200 applied to wearable devices further includes: a matching calculation module and an inference result confirmation module, wherein: The matching calculation module is used to calculate the number of key point matches between the current image frame and the PrFm frame according to the feature matching scheduling algorithm if the current image frame is not the first image frame. The inference result confirmation module is used to take the first inference result as the inference result of the current image frame if the number of key point matches meets the preset matching number condition.
[0071] In some optional implementations of this embodiment, the AI inference scheduling device 200 applied to wearable devices further includes: a second PrFm frame determination module, a second state information acquisition module, a second decision calculation module, and a second task scheduling module, wherein: The second PrFm frame determination module is used to determine the current image frame as a PrFm frame if the number of key point matches does not meet the matching quantity condition. The second status information acquisition module is used to acquire the second system status information; The second decision calculation module is used to perform scheduling decision calculation operations on the PrFm frame according to the pruning optimization scheduling algorithm and the second system state information to obtain the second scheduling decision of the current image frame. The second task scheduling module is used to perform model inference task scheduling operations based on the second scheduling decision to obtain the second inference result.
[0072] In some optional implementations of this embodiment, the matching calculation module includes: a descriptor acquisition submodule, an initial matching quantity acquisition submodule, and a filtering submodule, wherein: The descriptor acquisition submodule is used to perform key point detection and descriptor acquisition operations on the current image frame based on the ORB detector, so as to obtain the key points of the current frame and the key point descriptors of the current frame corresponding to the key points of the current frame. The initial matching count acquisition submodule is used to obtain the initial keypoint matching count between the keypoint descriptor of the current frame and the keypoint descriptor of the PrFm frame according to the knnMatch function; The filtering submodule is used to perform filtering operations based on Lowe's initial number of keypoint matches to obtain the number of keypoint matches.
[0073] In some optional implementations of this embodiment, the first system state information includes real-time network bandwidth, network latency, and system computing resources. The first decision calculation module 240 includes a time calculation submodule and a scheduling decision prediction submodule, wherein: The time calculation submodule is used to calculate the network transmission time and model inference time of the model scheduling based on real-time network bandwidth, network latency, and system computing resources. The scheduling decision prediction submodule is used to predict the scheduling decision with the shortest inference time based on the data network transmission time and the model inference time, and obtain the first scheduling decision.
[0074] To address the aforementioned technical problems, embodiments of this application also provide a computer device. Please refer to [link / reference needed]. Figure 10 , Figure 10 This is a basic structural block diagram of the computer device in this embodiment.
[0075] The computer device 300 includes a memory 310, a processor 320, and a network interface 330 that are interconnected via a system bus. It should be noted that only the computer device 300 with components 310-330 is shown in the figures; however, it should be understood that it is not required to implement all the shown components, and more or fewer components can be implemented alternatively. Those skilled in the art will understand that the computer device described here is a device capable of automatically performing numerical calculations and / or information processing according to pre-set or stored instructions, and its hardware includes, but is not limited to, microprocessors, application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), digital signal processors (DSPs), embedded devices, etc.
[0076] The computer device can be a desktop computer, laptop, handheld computer, or cloud server, etc. The computer device can interact with the user via a keyboard, mouse, remote control, touchpad, or voice control.
[0077] The memory 310 includes at least one type of readable storage medium, including flash memory, hard disk, multimedia card, card-type memory (e.g., SD or DX memory), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the memory 310 may be an internal storage unit of the computer device 300, such as the hard disk or memory of the computer device 300. In other embodiments, the memory 310 may also be an external storage device of the computer device 300, such as a plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, etc. Of course, the memory 310 may also include both internal storage units and external storage devices of the computer device 300. In this embodiment, the memory 310 is typically used to store the operating system and various application software installed on the computer device 300, such as computer-readable instructions for AI inference scheduling methods applied to wearable devices. Furthermore, the memory 310 can also be used to temporarily store various types of data that have been output or will be output.
[0078] In some embodiments, the processor 320 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chip. The processor 320 is typically used to control the overall operation of the computer device 300. In this embodiment, the processor 320 is used to execute computer-readable instructions stored in the memory 310 or to process data, for example, to execute computer-readable instructions for the AI inference scheduling method applied to the wearable device.
[0079] The network interface 330 may include a wireless network interface or a wired network interface, which is typically used to establish communication connections between the computer device 300 and other electronic devices.
[0080] The computer device provided in this application, after acquiring the current image frame sent by the wearable device, determines whether the wearable device has acquired an image frame. If it is the first frame, it directly records the frame as a PrFm frame. Then, it acquires the system's real-time bandwidth, network latency, and system computing resource status. Finally, it executes a pruning optimization scheduling algorithm to obtain the scheduling decision for this frame in the system. This meets the real-time requirements of AI inference for wearable devices. The pruning optimization scheduling algorithm can obtain the scheduling decision with the minimum inference time under the current system state in a short time, effectively solving the real-time AI inference problem of wearable devices.
[0081] This application also provides another embodiment, namely, providing a computer-readable storage medium storing computer-readable instructions that can be executed by at least one processor to cause the at least one processor to perform the steps of the AI inference scheduling method for wearable devices as described above.
[0082] The computer-readable storage medium provided in this application, after acquiring the current image frame sent by the wearable device, determines whether the wearable device has acquired an image frame. If it is the first frame, it directly records the frame as a PrFm frame. Then, it acquires the system's real-time bandwidth, network latency, and system computing resource status. Finally, it executes a pruning optimization scheduling algorithm to obtain the scheduling decision for this frame in the system. This meets the real-time requirements of AI inference for wearable devices. The pruning optimization scheduling algorithm can obtain the scheduling decision with the minimum inference time under the current system state in a short time, effectively solving the real-time AI inference problem of wearable devices.
[0083] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0084] Obviously, the embodiments described above are only some embodiments of this application, not all embodiments. The accompanying drawings show preferred embodiments of this application, but do not limit the patent scope of this application. This application can be implemented in many different forms; rather, the purpose of providing these embodiments is to provide a more thorough and comprehensive understanding of the disclosure of this application. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art can still modify the technical solutions described in the foregoing specific embodiments, or make equivalent substitutions for some of the technical features. Any equivalent structures made using the content of this application's specification and drawings, directly or indirectly applied to other related technical fields, are similarly within the scope of patent protection of this application.
Claims
1. An AI inference scheduling method for wearable devices, characterized in that, Includes the following steps: Receive the current image frame sent by the wearable device; If the current image frame is the first image frame, then the current image frame is determined to be a PrFm frame; Obtain the first system status information; Based on the pruning optimization scheduling algorithm and the first system state information, a scheduling decision calculation operation is performed on the PrFm frame to obtain the first scheduling decision of the current image frame; Based on the first scheduling decision, perform model inference task scheduling operations to obtain the first inference result; Following the step of receiving the current image frame sent by the wearable device, the following steps are also included: If the current image frame is not the first image frame, then the number of key point matches between the current image frame and the PrFm frame is calculated according to the feature matching scheduling algorithm; If the number of key point matches meets the preset matching number condition, then the first inference result is used as the inference result of the current image frame. The first system status information includes real-time network bandwidth, network latency, and system computing resources. The step of performing scheduling decision calculations on the PrFm frame based on the pruning optimization scheduling algorithm and the first system status information to obtain the first scheduling decision for the current image frame specifically includes the following steps: Based on the real-time network bandwidth, the network latency, and the system computing resources, the data network transmission time and model inference time scheduled by the model are calculated. The first scheduling decision is obtained by predicting the shortest inference time based on the data network transmission time and the model inference time.
2. The AI inference scheduling method for wearable devices according to claim 1, characterized in that, After the step of calculating the number of keypoint matches between the current image frame and the PrFm frame according to the feature matching scheduling algorithm if the current image frame is not the first image frame, the following step is further included: If the number of key point matches does not meet the matching number condition, then the current image frame is determined as the PrFm frame; Obtain the status information of the second system; Based on the pruning optimization scheduling algorithm and the second system state information, a scheduling decision calculation operation is performed on the PrFm frame to obtain the second scheduling decision of the current image frame; Based on the second scheduling decision, perform model inference task scheduling operations to obtain the second inference result.
3. The AI inference scheduling method for wearable devices according to claim 1, characterized in that, The step of calculating the number of keypoint matches between the current image frame and the PrFm frame based on the feature matching scheduling algorithm specifically includes the following steps: Based on the ORB detector, key point detection and descriptor acquisition operations are performed on the current image frame to obtain the key points of the current frame and the key point descriptors of the current frame corresponding to the key points of the current frame. The initial number of keypoint matches between the current frame keypoint descriptor and the keypoint descriptor of the PrFm frame is obtained according to the knnMatch function. The number of keypoint matches is obtained by filtering the initial number of keypoint matches based on Lowe's data.
4. An AI inference scheduling device for wearable devices, characterized in that, include: The image frame acquisition module is used to receive the current image frame sent by the wearable device; The first PrFm frame determination module is used to determine the current image frame as a PrFm frame if the current image frame is the first image frame. The first status information acquisition module is used to acquire the first system status information; The first decision calculation module is used to perform scheduling decision calculation operations on the PrFm frame according to the pruning optimization scheduling algorithm and the first system state information to obtain the first scheduling decision of the current image frame. The first task scheduling module is used to perform model inference task scheduling operations based on the first scheduling decision to obtain the first inference result. The device further includes: a matching calculation module and a reasoning result confirmation module, wherein: The matching calculation module is used to calculate the number of key point matches between the current image frame and the PrFm frame according to the feature matching scheduling algorithm if the current image frame is not the first image frame. The inference result confirmation module is used to take the first inference result as the inference result of the current image frame if the number of key point matches meets the preset matching number condition. The first system status information includes real-time network bandwidth, network latency, and system computing resources. The first decision calculation module includes a time calculation submodule and a scheduling decision prediction submodule, wherein: The time calculation submodule is used to calculate the data network transmission time and model inference time of the model scheduling based on the real-time network bandwidth, the network latency, and the system computing resources. The scheduling decision prediction submodule is used to predict the scheduling decision with the shortest inference time based on the data network transmission time and the model inference time, and obtain the first scheduling decision.
5. The AI inference scheduling device for wearable devices according to claim 4, characterized in that, The device further includes: The second PrFm frame determination module is used to determine the current image frame as the PrFm frame if the number of key point matches does not meet the matching number condition. The second status information acquisition module is used to acquire the second system status information; The second decision calculation module is used to perform scheduling decision calculation operations on the PrFm frame according to the pruning optimization scheduling algorithm and the second system state information to obtain the second scheduling decision of the current image frame. The second task scheduling module is used to perform model inference task scheduling operations based on the second scheduling decision to obtain the second inference result.
6. A computer device, characterized in that, The device includes a memory and a processor, wherein the memory stores computer-readable instructions, and the processor executes the computer-readable instructions to implement the steps of the AI inference scheduling method for wearable devices as described in any one of claims 1 to 3.
7. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-readable instructions, which, when executed by a processor, implement the steps of the AI inference scheduling method for wearable devices as described in any one of claims 1 to 3.
Citation Information
Patent Citations
Distributed training and reasoning method, system and device based on artificial intelligence, and readable storage medium
CN114035937A
Systems and methods for network scheduling and re-transmission buffering
US20200145345A1
