Bounding box adjustment method for object detection algorithm, device, and storage medium
By obtaining the image characteristics of the historical frame and the current frame in the object detection algorithm, the comparison results are used to adjust the detection box, which solves the instability problem of the object detection box in non-stationary images, improves the stability and continuity of the detection box, and improves the effect and computing power efficiency of computer vision applications.
Patent Information
- Application Number
- PCT/CN2024/120642
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-09-28
- Filing Date
- 2024-09-24
- Publication Date
- 2025-04-03
AI Technical Summary
In non-stable images, the instability of the object detection box leads to excessive differences in image features, affecting the effect of computer vision applications and computing power overhead.
By obtaining the image characteristics of the object detection algorithm in the historical frame and the current frame, the comparison results are used to adjust the detection box to make its transition in the box-selected area of the current frame smoother, and avoiding excessive changes in the image characteristics.
It improves the stability and continuity of the detection frame, reduces the negative impact on subsequent computer vision applications, and improves the final effect and computing power efficiency.
Smart Images

Figure CN2024120642_03042025_PF_FP_ABST
Abstract
Description
Detection frame adjustment method, device and storage medium for target detection algorithm
[0001] Cross-references
[0002] This application claims priority to a Chinese patent application filed with the Patent Office of China on September 28, 2023, with application number 202311282716.0 and invention name “Detection frame adjustment method, device and storage medium for target detection algorithm”. The entire contents of the application are incorporated into this application by reference. Technical Field
[0003] The present application relates to the technical field, and in particular to a detection frame adjustment method, device and storage medium for a target detection algorithm. Background Art
[0004] The object detection algorithm is used to find objects in images and is the core technology of computer vision applications such as face recognition and vehicle recognition.
[0005] Object detection algorithms use bounding boxes to select the target area in an image, facilitating subsequent computer vision applications to extract image features. Currently, mainstream object detection algorithms all have the ability to lock onto a target, meaning the detection box follows the target's position. However, when performing object detection in non-static images (such as videos), it's difficult to maintain the target's position within the image, causing the detection box to jitter and jump around. Once the detection box becomes unstable, the difference in image features extracted from previous and subsequent frames can significantly impact subsequent computer vision applications, generating significant computational overhead and potentially affecting the final results of the application.
[0006] Therefore, how to improve the stability of the detection frame of the target detection algorithm and thus improve the negative impact on subsequent computer vision applications is a technical problem that needs to be solved urgently.
[0007] Summary of the Invention
[0008] The purpose of this application is to provide a detection frame adjustment method, device and storage medium for a target detection algorithm.
[0009] In a first aspect, a detection frame adjustment method for a target detection algorithm is provided, characterized in that it includes: when performing target detection based on the target detection algorithm, obtaining a first image feature of the detection frame of the target detection algorithm corresponding to a historical frame and a second image feature corresponding to a current frame; wherein the number of frames between the historical frame and the current frame is not greater than a preset frame value; determining a comparison result between the first image feature and the second image feature; and taking a first frame selection area corresponding to the historical frame as a reference, adjusting the detection frame in a second frame selection area corresponding to the current frame based on an adjustment degree adapted to the comparison result.
[0010] In a second aspect, an embodiment of the present application provides an electronic device, comprising: a processor; and a memory configured to store computer-executable instructions, wherein the computer-executable instructions, when executed, cause the processor to execute the method described in the first aspect.
[0011] According to a third aspect, a computer-readable storage medium is provided, wherein the computer-readable storage medium is used to store computer-executable instructions, and the computer-executable instructions implement the method described in the first aspect when executed by a processor. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments recorded in the embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0013] FIG1 is a flow chart of a method for adjusting a detection frame of a target detection algorithm according to an embodiment of the present application.
[0014] FIG2 is a schematic diagram showing the changes in the detection frame corresponding to the transition from the historical frame to the current frame.
[0015] FIG3 is a flow chart of a detection frame adjustment method according to an embodiment of the present application in a specific application.
[0016] FIG4 is a schematic structural diagram of a detection frame adjustment device for a target detection algorithm according to an embodiment of the present application.
[0017] FIG5 is a schematic structural diagram of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0018] As mentioned earlier, object detection algorithms use bounding boxes to select the target area within an image, facilitating subsequent feature extraction in computer vision applications. Currently, mainstream object detection algorithms all have the ability to lock onto the target, meaning the detection box follows the target's position. However, when performing object detection in non-static images, the target's position within the image is difficult to maintain, resulting in jittery and irregular movements of the detection box.
[0019] Here, we take a computer vision application involving face recognition as an example. When a user initiates image acquisition on their device, the object detection algorithm locates the user's face region within multiple frames of captured imagery. During normal acquisition, the user may experience some physical movement, which causes the face region in the acquisition interface to shift, causing the detection frame to twitch and jump around. This can lead to significant variations in selected image features (such as texture and grayscale), significantly impacting computer vision applications (such as face beautification and face replacement).
[0020] To this end, this application aims to propose a detection frame adjustment scheme for the target detection algorithm, which can improve the stability of the detection frame during the target detection process, thereby improving the impact of detection frame jumping on subsequent computer vision applications.
[0021] In order to enable those skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments of this application will be clearly and completely described below in conjunction with the drawings in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this specification, not all of the embodiments. Based on the embodiments in this specification, all other embodiments obtained by ordinary technicians in this field without making creative efforts should fall within the scope of protection of this specification.
[0022] On the one hand, an embodiment of the present application provides a detection frame adjustment method for an object detection algorithm. FIG1 is a flow chart of the detection frame adjustment method, which includes the following steps:
[0023] Step S102, when performing target detection based on the target detection algorithm, obtain the first image feature of the detection frame of the target detection algorithm corresponding to the historical frame and the second image feature corresponding to the current frame; wherein the number of frames between the historical frame and the current frame is not greater than the preset frame value.
[0024] This embodiment uses the detection frame of the historical frame as a reference to adjust the detection frame of the current frame. Therefore, the number of frames between the historical frame and the current frame should not be too large, and is preferably less than or equal to a preset frame value (e.g., 3 frames). As a preferred solution, the historical frame and the current frame can be two adjacent consecutive frames.
[0025] Among them, the image features (first image features and second image features) selected by the detection frame can be, but are not limited to, image-related texture features, color features, deep learning features, and grayscale features, etc. These are commonly used input parameters in computer vision applications and are not specifically limited in this article.
[0026] Step S104: Determine a comparison result between the first image feature and the second image feature.
[0027] In this embodiment, the first image feature and the second image feature can be first vectorized and encoded to obtain a first feature vector corresponding to the first image feature and a second feature vector corresponding to the second image feature; then, the similarity between the first feature vector and the second feature vector is calculated to obtain a comparison result between the first image feature and the second image feature.
[0028] Specifically, the similarity algorithm may be a cosine similarity algorithm, a variance similarity algorithm, etc., which is not specifically limited herein.
[0029] Step S106 , using the first framed area corresponding to the historical frame as a reference, and based on an adjustment degree adapted to the comparison result, adjusting the second framed area corresponding to the detection frame in the current frame.
[0030] It should be understood that the similarity between the first image feature and the second image feature can reflect the changes in the detection frame between the historical frame and the current frame extracted image.
[0031] If the change is minor, meaning the comparison result indicates the similarity between the first and second image features reaches the first threshold, then the primary portion of the target's image features remains within the first selected region. In this case, the detection frame should remain unchanged, and the parameters corresponding to the second selected region should be adjusted to those corresponding to the first. This means that the detection frame remains within the first selected region after transitioning from the previous frame to the current frame.
[0032] If this change is too large, that is, the comparison result indicates that the similarity between the first image feature and the second image feature does not reach the second threshold (the second threshold is less than or equal to the first threshold), it means that the main part of the target presenting the image feature is already outside the first framed area. In this case, it is no longer appropriate to use the first framed area for the detection frame. In order to avoid the detection frame abruptly jumping from the first framed area to the second framed area, it is necessary to adjust the area parameters corresponding to the second framed area to values close to the area parameters of the first framed area to achieve a smooth transition.
[0033] As an exemplary introduction, this embodiment can perform weighted averaging on the area parameters (such as center coordinates, width, and height) corresponding to the first framed area and the second framed area, and adjust the area parameters corresponding to the second framed area to the area parameters after weighted averaging to achieve a smooth transition.
[0034] The similarity between the first image feature and the second image feature is negatively correlated with the weight of the regional parameters corresponding to the second framed area when performing weighted averaging. That is, a high similarity indicates that the jitter of the detection frame when transitioning from the historical frame to the current frame is small. In this case, in order to reduce the computing power overhead of subsequent computer vision applications for the detection frame change, it is not advisable to make excessive changes to the detection frame's selection area. Therefore, the weight of the regional parameters corresponding to the second framed area in the weighted average is appropriately reduced. Conversely, a low similarity indicates that the jitter of the detection frame when transitioning from the historical frame to the current frame is large, and the target in the image has moved away from the first framed area. At this time, it is not advisable to adjust the second framed area too much with reference to the first framed area. Therefore, the weight of the regional parameters corresponding to the second framed area in the weighted average is increased to ensure that the adjusted second framed area can frame the main part of the target presenting the image features.
[0035] For easier understanding, refer to the application scenario based on face recognition shown in Figure 2. Here, the transition of the detection frame from the historical frame to the current frame is divided into the following two scenarios:
[0036] Scenario 1 is that the difference in image features between the original detection frame (historical frame) and the current detection frame (current frame) is relatively small; that is, after the face position changes, the original detection frame can still select the user's facial features in the current frame. At this time, the area parameters of the current detection frame can be adjusted to the area parameters of the original detection frame, so that the current frame still uses the original detection frame.
[0037] Scenario 2 is that the image features selected by the original detection frame and the current detection frame differ greatly. That is, after the face position changes, the original detection frame can no longer select the user's facial features in the current frame. In this case, the area parameters of the current detection frame can be adjusted to be close to the area parameters of the original detection frame, so that the adjusted current detection frame is closer to the original detection frame than the current detection frame before adjustment, to avoid the change being too abrupt.
[0038] In summary, when the method of this embodiment performs target detection based on the target detection algorithm, the image features selected by the detection frame in the historical frame and the current frame are compared to evaluate the difference in changes in the detection frame from the historical frame to the current frame. Afterwards, with the first selected area corresponding to the historical frame as a reference, the second selected area of the detection frame corresponding to the current frame is adjusted based on the degree of adjustment that matches the comparison result, so that the transition of the second selected area of the current frame relative to the first selected area of the historical frame is smoother, avoiding excessive changes in the selected image features that affect subsequent computer vision applications. Based on the method of this embodiment, when performing target detection in multi-frame images, the stability and continuity between detection frame frames can be improved, providing better support for subsequent computer vision applications.
[0039] The specific implementation of the method of this embodiment is introduced below.
[0040] The method of this embodiment uses the selected area of the detection frame corresponding to the previous frame as a reference to adjust the selected area of the detection frame corresponding to the current frame. The corresponding process includes:
[0041] Step S1, set the initialization parameters of the target detection algorithm, including the area parameters of the detection box of the previous frame (center coordinates, width and height), the image data address of the previous frame, the first frame flag, the feature matching threshold and the weighting coefficient alpha, etc.
[0042] The feature matching threshold and weighting coefficient alpha will be flexibly set according to actual conditions, and the value range of alpha is [0,1].
[0043] Step S2, using the target detection algorithm to try to detect targets in the input frame image; if the number of detected targets is 0, re-execute step S2; if the number of targets is greater than 0, output the initial area parameters of the detection box, including the center coordinates, width and height.
[0044] Step S3, determine the first frame flag of the initial regional parameters of the detection frame; if the first frame flag is 0 (not marked), it means that the regional parameters corresponding to the detection frame in the previous frame are not available at this time, and the initial regional parameters of the detection frame are used as the regional parameters corresponding to the current frame, and then jump to step S4; if the first frame flag is 1 (marked), enter the next frame and jump to step S5.
[0045] The result detection frame refers to the detection frame of the selected area that is no longer adjusted. After entering the next frame, the next frame becomes the new current frame.
[0046] Step S4, updating the regional parameters of the result detection frame to the regional parameters of the detection frame of the previous frame; then, entering the next frame to execute step S5.
[0047] Step S5: extracting image features of the current frame and the previous frame based on the area parameters of the detection frames corresponding to the current frame and the previous frame.
[0048] Step S6, calculate the similarity of the image features of the current frame and the previous frame to determine the comparison result; if the similarity sim indicated by the comparison result reaches the feature matching threshold, jump to step S7, otherwise jump to step S8.
[0049] Among them, if there are multiple types of image features, such as texture features, color features, deep learning features and grayscale features, similarity calculation can be performed separately for each type of image feature, and finally the calculation results can be weighted to determine an overall similarity.
[0050] Step S7: Use the detection frame of the previous frame as the result detection frame of the current frame; then jump to step S4.
[0051] Step S8: perform weighted averaging of the initial regional parameters of the detection frame of the previous frame and the detection frame of the current frame to obtain the result detection frame of the current frame; then jump to step S4.
[0052] The calculation formula for weighted average is:
[0053] The area information of the result detection frame of the current frame = alpha × the area information of the detection frame of the previous frame + (1-alpha) × the initial area information of the detection frame of the current frame.
[0054] In addition, based on the above, if the negative correlation between similarity and (1-alpha) is introduced, the calculation formula of weighted average can be:
[0055] The area information of the result detection frame of the current frame = alpha × the area information of the detection frame of the previous frame + (1-alpha) × beta × the initial area information of the detection frame of the current frame.
[0056] Among them, beta is used to correct (1-alpha), beta = a-b / similarity; a and b are custom coefficients.
[0057] The following is an exemplary introduction to the process shown in FIG3 in combination with different business scenarios.
[0058] Business Scenario 1
[0059] This business scenario is a computer vision application based on face detection. The corresponding process includes:
[0060] Step S1, set the system initialization parameters to 0, including the region information preRect of the face detection box in the previous frame, the image data preData of the previous frame, the first frame flag bit isNotFirstFrame, the feature matching threshold thresh is 4.0, and the weighting coefficient alpha is 0.5.
[0061] Step S2, based on the object detection algorithm of Single Shot MultiBox Detector (SSD), perform face detection on the input frame image; if the number of detected objects is 0, then re - execute Step S2; if the number of objects is greater than 0, obtain the initial region information curRect of the face detection box, including the center coordinates and width and height of the face detection box (in pixels).
[0062] Step S3, determine isNotFirstFrame of curRect; if isNotFirstFrame is 0, then take curRect as the region information resultRect of the face detection box in the current frame result, and then jump to Step S4; if isNotFirstFrame is 1, then enter the next frame and jump to Step S5.
[0063] Step S4, update the region parameters curRec of the result detection box to the region parameters preRect of the detection box in the previous frame, that is, isNotFirstFrame is 1, and at the same time save the image data preData of the current frame; then, enter the next frame and execute Step S5.
[0064] Step S5, read the region information preRect of the face detection box in the previous frame, crop and extract the image gray - scale feature vectors curFea and preFea at the same position of the face detection box for the current frame image data curData and the previous frame image data preData respectively.
[0065] Step S6, calculate the mean - square error similarity mse between the two groups of image feature vectors curFea and preFea, if mse < thresh, jump to Step S7, otherwise jump to Step S8.
[0066] Among them, N is the length of the feature vector.
[0067] Step S7, use the face detection box preRect in the previous frame as the face detection box result resultRect in the current frame and jump to Step S4.
[0068] Step S8: perform weighted average on the center and width and height parameters of the previous frame face detection frame preRect and the current frame initial face detection frame curRect to obtain the current frame face detection frame result resultRect and jump to step S4.
[0069] The calculation formula for weighted average is:
[0070] resultRect.center=alpha×preRect.center+(1-alpha)×curRect.center;
[0071] resultRect.height=alpha×preRect.height+(1-alpha)×curRect.height;
[0072] resultRect.width=alpha×preRect.width+(1-alpha)×curRect.width.
[0073] Based on the above, if the negative correlation between MSE and (1-alpha) is introduced, the calculation formula of weighted average can be:
[0074] resultRect.center=alpha×preRect.center+(1-alpha)×beta×curRect.center;
[0075] resultRect.height=alpha×preRect.height+(1-alpha)×beta×curRect.height;
[0076] resultRect.width=alpha×preRect.width+(1-alpha)×beta×curRect.width.
[0077] Where beta = a - b / mse; a and b are user-defined coefficients.
[0078] Business Scenario 2
[0079] This business scenario is a computer vision application related to vehicle detection. The process includes:
[0080] Step S1, set the system initialization parameters to 0, including the area information preRect of the vehicle detection frame of the previous frame, the image data preData of the previous frame, the first frame flag isNotFirstFrame, the feature matching threshold thresh to 0.95, and the weighting coefficient alpha to 0.5.
[0081] In step S2, vehicle detection is performed on the input frame image based on the Yolov7 target detection algorithm. If the number of detected vehicle targets is 0, step S2 is executed again. If the number of targets is greater than 0, the initial region information curRect of the vehicle detection frame is obtained, including the center coordinates and width and height (in pixels) of the vehicle detection frame.
[0082] Step S3, determine isNotFirstFrame of curRect; if isNotFirstFrame is 0, use curRect as the area information resultRect of the vehicle detection frame of the current frame, and then jump to step S4; if isNotFirstFrame is 1, enter the next frame and jump to step S5.
[0083] Step S4, update the region parameter curRec of the result detection frame to the region parameter preRect of the detection frame of the previous frame, that is, isNotFirstFrame is 1, and save the current frame image data preData; then, enter the next frame to execute step S5.
[0084] Step S5, read the region information preRect of the vehicle detection frame of the previous frame, crop the same detection frame position of the current frame image data curData and the previous frame image data preData, and extract the RGB normalized histogram feature vectors curFea and preFea, respectively, as follows:
[0085] Assume that the width and height of the input image are W and H, and the RGB pixel value range is [0-GrayLevel]. Traverse the image and count the R, G, and B component histograms as histR, histG, and histB respectively. The length of each histogram is GrayLevel+1.
[0086] Next, calculate the normalized histogram: histR = histR / (W*H), histG = histG / (W*H), histB = histB / (W*H);
[0087] Afterwards, the normalized histograms are concatenated into a histogram histogram with a length of 3*(GrayLevel+1) as the feature of the cropped image.
[0088] Step S6, calculate the cosine similarity cos between the two sets of image feature vectors curFea and preFea, if cos>thresh, jump to step S7, otherwise jump to step S8.
[0089] Among them, the calculation formula of cosine similarity cos is:
[0090] x and y represent curFea and preFea respectively, and N=3×(GrayLevel+1)-1.
[0091] Step S7, use the vehicle detection frame preRect of the previous frame as the vehicle detection frame result resultRect of the current frame and jump to S4.
[0092] Step S8: Perform weighted processing on the center and width and height parameters of the vehicle detection frame preRect of the previous frame and the initial vehicle detection frame curRect of the current frame to obtain the vehicle detection frame result resultRect of the current frame and jump to step S4.
[0093] Among them, the calculation formula of weighted average is:
[0094] resultRect.center=alpha×preRect.center+(1-alpha)×curRect.center;
[0095] resultRect.height=alpha×preRect.height+(1-alpha)×curRect.height;
[0096] resultRect.width=alpha×preRect.width+(1-alpha)×curRect.width.
[0097] On the other hand, an embodiment of the present application further provides a detection frame adjustment device for a target detection algorithm. FIG4 is a schematic diagram of the structure of the detection frame adjustment device, comprising:
[0098] The feature acquisition module 410 is used to obtain the first image feature of the detection frame of the target detection algorithm corresponding to the historical frame and the second image feature corresponding to the current frame when performing target detection based on the target detection algorithm; wherein the number of frames between the historical frame and the current frame is not greater than the preset frame value.
[0099] The feature comparison module 420 is configured to determine a comparison result between the first image feature and the second image feature.
[0100] The detection frame adjustment module 430 is used to adjust the detection frame in the second frame selection area corresponding to the current frame based on an adjustment degree adapted to the comparison result, with reference to the first frame selection area corresponding to the historical frame.
[0101] When the device of this embodiment performs target detection based on the target detection algorithm, it compares the image features of the detection frame in the historical frame and the current frame to evaluate the difference in changes in the detection frame from the historical frame to the current frame. Afterwards, with the first framed area corresponding to the historical frame as a reference, the second framed area corresponding to the detection frame in the current frame is adjusted based on the degree of adjustment that matches the comparison result, so that the second framed area of the current frame transitions more smoothly relative to the first framed area of the historical frame, avoiding excessive changes in the image features of the frame that affect subsequent computer vision applications. Based on the device of this embodiment, when performing target detection in multiple frames of images, it is possible to improve the stability and continuity between detection frame frames, thereby providing better support for subsequent computer vision applications.
[0102] In one embodiment, the detection frame adjustment module 430 uses the first framed area corresponding to the historical frame as a reference and adjusts the second framed area corresponding to the current frame based on an adjustment degree that matches the comparison result, including: when the comparison result indicates that the similarity between the first image feature and the second image feature reaches a first threshold, directly adjusting the regional parameters corresponding to the second framed area to the regional parameters corresponding to the first framed area.
[0103] In one embodiment, the detection frame adjustment module 430 uses the first framed area corresponding to the historical frame as a reference and adjusts the detection frame in the second framed area corresponding to the current frame based on an adjustment degree that matches the comparison result, including: when the comparison result indicates that the similarity between the first image feature and the second image feature does not reach a second threshold, adjusting the regional parameters corresponding to the second framed area to values close to the regional parameters of the first framed area.
[0104] In one embodiment, the detection frame adjustment module 430 adjusts the area parameters corresponding to the second frame selection area to be close to the area parameters of the first frame selection area, including: performing weighted averaging on the area parameters corresponding to the first frame selection area and the second frame selection area to obtain the weighted average area parameters; and adjusting the area parameters corresponding to the second frame selection area to the weighted average area parameters.
[0105] In one embodiment, the similarity between the first image feature and the second image feature is negatively correlated with the weight of the region parameter corresponding to the second framed region when performing the weighted averaging.
[0106] In one embodiment, determining the comparison result between the first image feature and the second image feature includes: vectorizing and encoding the first image feature and the second image feature to obtain a first feature vector corresponding to the first image feature and a second feature vector corresponding to the second image feature; and performing similarity calculation on the first feature vector and the second feature vector to obtain the comparison result between the first image feature and the second image feature.
[0107] In one embodiment, the area parameters include: the center coordinates of the detection frame in the detection image, and the width and height of the detection frame.
[0108] In one embodiment, the image feature includes at least one of a texture feature, a color feature, a deep learning feature, and a grayscale feature.
[0109] It should be understood that the detection frame adjustment device shown in FIG4 can be used as the execution body of the method shown in FIG1, and thus can implement the steps and corresponding functions of the method shown in FIG1. Since the principles are the same, they will not be described in detail herein.
[0110] FIG5 is a schematic diagram of the structure of an electronic device according to an embodiment of the present specification. Referring to FIG5 , at the hardware level, the electronic device includes a processor and, in one embodiment, an internal bus, a network interface, and a memory. The memory may include internal memory, such as high-speed random access memory (RAM), and may also include non-volatile memory, such as at least one disk storage device. Of course, the electronic device may also include hardware required for other services.
[0111] The processor, network interface, and memory can be interconnected via an internal bus, such as an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect) bus, or an EISA (Extended Industry Standard Architecture) bus. These buses can be categorized as address buses, data buses, and control buses. For ease of illustration, FIG5 shows only one bidirectional arrow, but this does not imply that there is only one bus or only one type of bus.
[0112] The memory is used to store programs. Specifically, the program may include program code, which includes computer operating instructions. The memory may include internal memory and non-volatile memory, and provides instructions and data to the processor.
[0113] In one embodiment, the processor reads the corresponding computer program from the non-volatile memory into the internal memory and then runs it, forming the detection frame adjustment device shown in Figure 4 above at the logical level. Correspondingly, the processor executes the program stored in the memory and is specifically configured to perform the following operations:
[0114] When performing target detection based on a target detection algorithm, a first image feature of a detection frame of the target detection algorithm corresponding to a historical frame and a second image feature corresponding to a current frame are obtained; wherein the number of frames between the historical frame and the current frame is not greater than a preset frame value.
[0115] A comparison result between the first image feature and the second image feature is determined.
[0116] With reference to the first framed area corresponding to the historical frame, the detection frame is adjusted in the second framed area corresponding to the current frame based on an adjustment degree that matches the comparison result.
[0117] When the electronic device of this embodiment performs target detection based on the target detection algorithm, it compares the image features of the detection frame in the historical frame and the current frame to evaluate the difference in changes in the detection frame from the historical frame to the current frame. Afterwards, with the first framed area corresponding to the historical frame as a reference, the second framed area corresponding to the detection frame in the current frame is adjusted based on the degree of adjustment that matches the comparison result, so that the second framed area of the current frame transitions more smoothly relative to the first framed area of the historical frame, avoiding excessive changes in the image features of the frame that affect subsequent computer vision applications. Based on the electronic device of this embodiment, when performing target detection in multiple frames of images, it is possible to improve the stability and continuity between detection frame frames, thereby providing better support for subsequent computer vision applications.
[0118] The detection frame adjustment method disclosed in the embodiments shown in this specification can be applied to a processor and implemented by the processor. The processor may be an integrated circuit chip with signal processing capabilities. During implementation, each step of the above method can be completed by hardware integrated logic circuits in the processor or software instructions. The above processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. The various methods, steps and logic block diagrams disclosed in the embodiments of this application can be implemented or executed. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in the embodiments of this application can be directly embodied as being executed by a hardware decoding processor, or can be executed by a combination of hardware and software modules in the decoding processor. The software module can be located in a storage medium well-known in the art, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, etc. The storage medium is located in the memory, and the processor reads the information in the memory and, in conjunction with its hardware, completes the steps of the above method.
[0119] Of course, in addition to software implementation, the electronic device in this specification does not exclude other implementation methods, such as logic devices or a combination of software and hardware, etc. That is to say, the execution subject of the following processing flow is not limited to each logic unit, but can also be hardware or logic devices.
[0120] In addition, an embodiment of the present application also proposes a computer-readable storage medium, which stores one or more programs, and the one or more programs include instructions.
[0121] When the above instructions are executed by a portable electronic device including multiple applications, the portable electronic device can execute the steps of the method shown in FIG1 , including:
[0122] When performing target detection based on a target detection algorithm, a first image feature of a detection frame of the target detection algorithm corresponding to a historical frame and a second image feature corresponding to a current frame are obtained; wherein the number of frames between the historical frame and the current frame is not greater than a preset frame value.
[0123] A comparison result between the first image feature and the second image feature is determined.
[0124] With reference to the first framed area corresponding to the historical frame, the detection frame is adjusted in the second framed area corresponding to the current frame based on an adjustment degree that matches the comparison result.
[0125] Those skilled in the art will appreciate that the embodiments of this specification may be provided as methods, systems, or computer program products. Thus, this specification may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware. Furthermore, this specification may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0126] The foregoing description of this specification describes specific embodiments. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims can be performed in an order different from that described in the embodiments and still achieve the desired results. Furthermore, the processes depicted in the accompanying drawings do not necessarily require the specific order shown or the sequential order to achieve the desired results. In certain embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0127] The above are merely examples of the present invention and are not intended to limit this specification. For those skilled in the art, various modifications and variations of this specification are possible. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of this specification shall be included within the scope of the claims of this specification. In addition, all other embodiments obtained by those of ordinary skill in the art without creative effort shall fall within the scope of protection of this document.
Claims
1. A detection frame adjustment method for a target detection algorithm, wherein: include: When performing target detection based on a target detection algorithm, obtaining a first image feature corresponding to a detection frame of the target detection algorithm in a historical frame and a second image feature corresponding to a current frame; wherein the number of frames between the historical frame and the current frame is not greater than a preset frame value; determining a comparison result between the first image feature and the second image feature; With reference to the first framed area corresponding to the historical frame, and based on an adjustment degree that matches the comparison result, the detection frame is adjusted in the second framed area corresponding to the current frame.
2. The method according to claim 1, wherein: The adjusting the detection frame in the second frame selection area corresponding to the current frame based on the adjustment degree adapted to the comparison result with the first frame selection area corresponding to the historical frame as a reference includes: When the comparison result indicates that the similarity between the first image feature and the second image feature reaches a first threshold, the region parameters corresponding to the second framed region are directly adjusted to the region parameters corresponding to the first framed region.
3. The method according to claim 1, wherein: The adjusting the detection frame in the second frame selection area corresponding to the current frame based on the adjustment degree adapted to the comparison result with the first frame selection area corresponding to the historical frame as a reference includes: When the comparison result indicates that the similarity between the first image feature and the second image feature does not reach a second threshold, the region parameters corresponding to the second framed region are adjusted to values close to the region parameters of the first framed region.
4. The method according to claim 3, wherein: The adjusting the area parameters corresponding to the second frame selection area to be close to the area parameters of the first frame selection area includes: Performing weighted averaging on the area parameters corresponding to the first framed area and the second framed area to obtain weighted average area parameters; The region parameters corresponding to the second framed region are adjusted to the region parameters after the weighted average.
5. The method according to claim 4, wherein: The similarity between the first image feature and the second image feature is negatively correlated with the weight of the area parameter corresponding to the second framed area when performing the weighted averaging.
6. The method according to any one of claims 1 to 5, wherein: The determining a comparison result between the first image feature and the second image feature includes: The first image feature and the second image feature are vectorized and encoded to obtain the first a first feature vector corresponding to the first image feature and a second feature vector corresponding to the second image feature; A similarity calculation is performed on the first feature vector and the second feature vector to obtain a comparison result between the first image feature and the second image feature.
7. The method according to any one of claims 1 to 5, wherein: The area parameters include: the center coordinates of the detection frame in the detection image, and the width and height of the detection frame.
8. The method according to any one of claims 1 to 5, wherein: The image features include: at least one of texture features, color features, deep learning features and grayscale features.
9. An electronic device, comprising a processor; and a memory configured to store computer executable instructions, wherein when the computer executable instructions are executed, the processor executes the method according to any one of claims 1 to 8.
10. A computer-readable storage medium, wherein the computer-readable storage medium is used to store computer-executable instructions, wherein the computer-executable instructions implement the method according to any one of claims 1 to 8 when executed by a processor.
Citation Information
Patent Citations
Target tracking method and device
CN109671103A
Target tracking method, device and equipment and storage medium
CN110853076A
Object detection method, device and apparatus and computer storage medium
CN112949785A
Vehicle tracking method and device, equipment and storage medium
CN113221750A
Multi-target tracking identification method and device, electronic equipment and medium
CN116385933A