A target tracking method, system and electronic device based on recurrent neural network
By dynamically adjusting the optical flow point matching threshold and the method based on the recurrent neural network, the problem of inaccurate target tracking caused by inaccurate optical flow point matching threshold is solved, the accuracy and stability of target tracking are improved, and the target tracking is achieved in different situations. Efficient tracking effect.
Patent Information
- Application Number
- CN202410815952.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-24
- Publication Date
- 2024-09-13
- Estimated Expiration
- 2044-06-24
AI Technical Summary
In the existing technology, the inaccurate setting of the optical flow point matching threshold results in inaccurate target tracking, which makes it impossible to effectively distinguish the target from the background, affecting the tracking effect.
By obtaining the target video training data, combined with optical flow analysis, the matching optical flow points are screened, the matching density coefficient, optical flow interference coefficient and rotation threshold suppression coefficient are calculated, the matching threshold is dynamically adjusted to screen the matching optical flow points, and the goal is achieved based on the recurrent neural network Continuous tracking.
The accuracy and stability of target tracking are improved, ensuring that the algorithm maintains high accuracy under different circumstances. By adaptively obtaining accurate matching thresholds for optical flow points, the accuracy of target positioning and tracking is enhanced.
Smart Images

Figure CN118397047B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image motion analysis, and in particular to a target tracking method, system and electronic equipment based on a recurrent neural network. Background Art
[0002] With the rapid development of computer vision and deep learning technology, target tracking has broad application prospects in video surveillance, autonomous driving, intelligent transportation and other fields; recurrent neural network RNN can capture the temporal dependency in sequence data, has excellent sequence modeling capabilities, and combined with target detection and tracking technology, it can accurately track the target object in continuous frame images. Therefore, it is widely used in target tracking tasks in video sequences.
[0003] Considering the influence of factors such as the movement of the target itself, the change of the camera's perspective, and the change of the target's distance from the camera when using the recurrent neural network target tracking technology, the scale of target tracking will change significantly and dynamically, which greatly increases the difficulty of tracking and may even cause tracking failure. In the prior art, an optical flow field is constructed to obtain the optical flow points of the video sequence for target tracking. However, the inaccurate setting of the optical flow point matching threshold affects the effectiveness of the matching optical flow points. That is, if the threshold is set too high, some valid optical flow points may be mistakenly excluded, thereby reducing the accuracy of tracking; on the contrary, if the threshold is set too low, too many noise points may be introduced, which will also affect the accuracy of tracking; resulting in the inability to effectively distinguish the target from the background, and the target tracking effect is poor. Summary of the invention
[0004] In order to solve the technical problem of inaccurate target tracking caused by inaccurate optical flow point matching threshold, the purpose of the present invention is to provide a target tracking method, system and electronic device based on a recurrent neural network. The technical solution adopted is as follows:
[0005] An embodiment of the present invention provides a target tracking method based on a recurrent neural network, the method comprising:
[0006] Obtain target video training data containing moving objects;
[0007] The initial frame image of the target video training data is used as the frame image to be tested, and the image area of the moving target in the frame image to be tested is obtained as the target area; according to the grayscale distribution and position characteristics of the pixel points between each target area on the frame image to be tested and other subsequent frame images, the matching optical flow points are screened out in combination with optical flow analysis;
[0008] According to the number of matching optical flow points corresponding to each target area between frame images and the relative distance between the matching optical flow points on each frame image, the matching density coefficient corresponding to each target area on each frame image between frame images is obtained; according to the change difference of the matching density coefficient between the frame image to be tested and the next frame image to be tested and the next two frames, the optical flow interference coefficient of each target area on the next frame image to be tested is obtained; according to the volatility of the distribution change difference of the matching optical flow points between adjacent frame images, the rotation threshold suppression coefficient is obtained; according to the optical flow interference coefficient, the rotation threshold suppression coefficient and the position distribution of the matching optical flow points of each target area between adjacent frame images, the preset matching threshold is adjusted to obtain the adjusted matching threshold;
[0009] According to the adjustment of the matching threshold, the matching optical flow points are screened and adjusted to obtain the target area in the next frame image; based on the recurrent neural network, the next frame image is used as a new frame image to be tested to achieve continuous tracking of the target.
[0010] Furthermore, the method for obtaining the matching optical flow points includes:
[0011] Obtain the optical flow matching distance according to the grayscale distribution and position characteristics of the pixels between each target area on the frame image to be tested and other subsequent frame images;
[0012] If the optical flow matching distance between the pixel points of each target area on the frame image to be tested and other subsequent frame images is less than or equal to the preset matching threshold, the corresponding pixel point is a matching optical flow point.
[0013] Furthermore, the method for obtaining the optical flow matching distance includes:
[0014] For each frame of image, the neighborhood grayscale feature of each pixel is obtained according to the ratio of the grayscale fluctuation degree and grayscale level of the pixel within the neighborhood of each pixel;
[0015] Calculate the sum of the squares of the position coordinates of each pixel as the regional position feature; obtain the group feature of each pixel based on the distribution number of the grayscale value corresponding to each pixel;
[0016] According to the neighborhood grayscale features, regional location features and group features of each pixel, a feature set of each pixel is obtained;
[0017] The optical flow field of the target video training data is constructed, and the optical flow matching distance is obtained according to the degree of change of the feature set of corresponding pixels between each target area on the frame image to be tested and other subsequent frame images in the optical flow field.
[0018] Furthermore, the method for obtaining the matching density coefficient includes:
[0019] Calculate the Euclidean distance between the matching optical flow points on each frame image as the relative distance;
[0020] The matching density coefficient is obtained according to the calculation formula of the matching density coefficient. The calculation formula of the matching density coefficient is:
[0021] ;in, Indicates the number of frames between images The corresponding frame image The matching density coefficient of the target area; Indicates the correspondence between frame images The number of matching optical flow points in the target area; Indicates the number of frames between images The corresponding frame image The target area Matching optical flow points; Indicates the number of frames between images The corresponding frame image The target area Matching optical flow points; Indicates the Euclidean distance; represents the Gaussian kernel function; Indicates the bandwidth parameter.
[0022] Furthermore, the method for obtaining the optical flow interference coefficient includes:
[0023] According to the difference of the matching density coefficients of each target area between the two frame images, the density change degree of each target area between the two frame images is obtained;
[0024] According to the difference in density variation of each target area between the frame image to be tested and the next two frames of the frame to be tested and the next frame of the frame to be tested, the optical flow interference coefficient of each target area on the next frame of the frame to be tested is obtained.
[0025] Furthermore, the method for obtaining the rotation threshold suppression coefficient includes:
[0026] The relative distance between the matching optical flow points of each target area in each frame image is used as the distribution feature;
[0027] The rotation threshold suppression coefficient is obtained according to the fluctuation degree of the difference in distribution characteristics of the matching optical flow points corresponding to each target area between different frame images.
[0028] Furthermore, the method for obtaining the adjusted matching threshold includes:
[0029] The area expansion coefficient is obtained according to the position distribution of the matching optical flow points between adjacent frame images of each target area;
[0030] The adjusted matching threshold is obtained according to the optical flow interference coefficient, the rotation threshold suppression coefficient, the area expansion coefficient and the preset matching threshold; the optical flow interference coefficient, the area expansion coefficient and the preset matching threshold are all positively correlated with the adjusted matching threshold; the rotation threshold suppression coefficient is negatively correlated with the adjusted matching threshold.
[0031] Furthermore, the method for obtaining the area expansion coefficient includes:
[0032] Constructing the minimum bounding rectangle of each target area matching the optical flow points between the frames to be tested as the first target area; constructing the minimum bounding rectangle of each target area matching the optical flow points between the next frames as the second target area;
[0033] Multiplying the length and width of the first target area by the density change degree respectively to obtain the length and width of the predicted target area; constructing the minimum circumscribed rectangle of the second target area and the predicted target area as the overall target area;
[0034] The difference between the overall target area and the second target area and the ratio of the second target area are calculated, and the ratio result and a preset constant are added to obtain the area expansion coefficient.
[0035] An embodiment of the present invention further provides a target tracking system based on a recurrent neural network, the system comprising:
[0036] Data acquisition module: acquires target video training data containing moving targets;
[0037] Optical flow matching module: The initial frame image of the target video training data is used as the frame image to be tested, and the image area of the moving target in the frame image to be tested is obtained as the target area; the matching optical flow points are selected based on the grayscale distribution and position characteristics of the pixels between each target area on the frame image to be tested and other subsequent frame images, combined with optical flow analysis;
[0038] Threshold adjustment module: according to the number of matching optical flow points corresponding to each target area between frame images and the relative distance between the matching optical flow points on each frame image, obtain the matching density coefficient corresponding to each target area on each frame image between frame images; according to the change difference of the matching density coefficient between the frame image to be tested and the next frame image of the frame to be tested and the next two frames, obtain the optical flow interference coefficient of each target area on the next frame image of the frame to be tested; according to the volatility of the distribution change difference of the matching optical flow points between adjacent frame images, obtain the rotation threshold suppression coefficient; according to the optical flow interference coefficient, the rotation threshold suppression coefficient and the position distribution of the matching optical flow points of each target area between adjacent frame images, adjust the preset matching threshold to obtain the adjusted matching threshold;
[0039] Target tracking module: According to the adjustment of matching threshold, the matching optical flow points are screened and adjusted to obtain the target area in the next frame image; based on the recurrent neural network, the next frame image is used as the new frame image to be tested to achieve continuous tracking of the target.
[0040] The present invention also proposes an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements any one of the steps of a target tracking method based on a recurrent neural network.
[0041] The present invention has the following beneficial effects:
[0042] The present invention uses the initial frame image of the target video training data as the frame image to be tested, and obtains the image area of the moving target in the frame image to be tested as the target area. The target tracking algorithm usually starts from an initial frame and determines the image area of the moving target in the frame, which is the basis for subsequent tracking; according to the grayscale distribution and position characteristics of the pixel points between each target area on the frame image to be tested and other subsequent frame images, the matching optical flow points are screened out in combination with the optical flow analysis, and the movement of the target between consecutive frame images is evaluated. Through screening, invalid optical flow points can be removed to improve the accuracy and stability of target tracking; according to the number of matching optical flow points corresponding to each target area between frame images, and the relative distance between the matching optical flow points on each frame image, the matching density coefficient corresponding to each target area on each frame image between frame images is obtained, reflecting the change of the target area between consecutive frames; in practical applications, due to factors such as background noise and illumination changes, interference may be caused to the optical flow matching, and according to the matching density coefficient between the frame image to be tested and the next frame image and the next two frame images of the frame to be tested, the matching density coefficient between the target area and the moving target area is obtained, reflecting the change of the target area between consecutive frames; in practical applications, due to factors such as background noise and illumination changes, interference may be caused to the optical flow matching, and according to the matching density coefficient between the frame image to be tested and the next frame image and the next two frame images of the frame to be tested, the matching density coefficient between the target area and the moving target area is obtained, reflecting the change of the target area between consecutive frames. The optical flow interference coefficient of each target area on the next frame image of the frame to be tested is obtained by the change difference of the matching density coefficient between adjacent frames, and the degree of interference can be evaluated; the rotation of the target will cause the distribution of the optical flow points to change. The rotation threshold suppression coefficient is obtained according to the volatility of the distribution change difference of the matching optical flow points between adjacent frames, and the target change is quantified by calculating the rotation threshold suppression coefficient; the preset matching threshold is adjusted according to the optical flow interference coefficient, the rotation threshold suppression coefficient and the position distribution of the matching optical flow points of each target area between adjacent frames, and the adjusted matching threshold is obtained. By dynamically adjusting the matching threshold, it can be ensured that the algorithm can maintain high accuracy and stability under different circumstances; according to the adjustment matching threshold, the matching optical flow points are screened and adjusted, and the target area in the next frame image is obtained, and the new position of the target in the next frame can be determined; based on the recurrent neural network, the next frame image is used as the new frame image to be tested to achieve continuous tracking of the target. Through the recurrent neural network, the target's motion pattern can be learned and the target's position can be predicted in the new frame. The present invention improves the accuracy of target positioning and tracking by adaptively obtaining the accurate matching threshold of the optical flow points. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] In order to more clearly illustrate the technical solutions and advantages in the embodiments of the present invention or the prior art, the drawings required for use in the embodiments or the prior art descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0044] Figure 1 A flow chart of a target tracking method based on a recurrent neural network provided by an embodiment of the present invention;
[0045] Figure 2 A structural block diagram of a target tracking system based on a recurrent neural network provided by an embodiment of the present invention;
[0046] Figure 3 The present invention is a block diagram of an electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0047] In order to further explain the technical means and effects adopted by the present invention to achieve the predetermined invention purpose, the following is a detailed description of the target tracking method, system and electronic device based on a recurrent neural network proposed by the present invention, its specific implementation, structure, features and effects, in combination with the accompanying drawings and preferred embodiments. In the following description, different "one embodiment" or "another embodiment" does not necessarily refer to the same embodiment. In addition, specific features, structures or characteristics in one or more embodiments may be combined in any suitable form.
[0048] Unless defined otherwise, 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 invention belongs.
[0049] The following is a detailed description of a target tracking method, system and electronic device based on a recurrent neural network provided by the present invention in conjunction with the accompanying drawings.
[0050] See also Figure 1 , which shows a flow chart of a target tracking method based on a recurrent neural network provided by an embodiment of the present invention, and the specific method includes:
[0051] Step S1: Obtain target video training data containing a moving target.
[0052] In an embodiment of the present invention, due to factors such as the movement of the target itself, the change in the camera's viewing angle, and the change in the target's distance from the camera, the scale of the target changes during the target detection process, increasing the difficulty of target tracking; in order to accurately track the target's changing trend, first, the various acquisition cameras on the mobile target collect real-time information about the environment of the mobile target during operation, and the collected video information will be sent to the central control unit ECU of the mobile target in real time, and the road target will be calculated and tracked, so as to subsequently analyze the tracking information of the mobile target; therefore, target video training data containing the mobile target is obtained; in one embodiment of the present invention, the mobile target refers to a vehicle, and the video training data refers to video data of vehicle target tracking information collected when the vehicle is running.
[0053] Step S2: Using the initial frame image of the target video training data as the frame image to be tested, obtaining the image area of the moving target in the frame image to be tested as the target area; based on the grayscale distribution and position characteristics of the pixel points between each target area on the frame image to be tested and other subsequent frame images, combined with optical flow analysis, screen out matching optical flow points.
[0054] In video target tracking, the initial frame is usually the beginning of the video. The state and position of the target are relatively stable, providing a clear starting point so that the target to be tracked or analyzed can be accurately understood. Using the initial frame image as the frame image to be tested can ensure the stability and accuracy of the target area. Therefore, the initial frame image of the target video training data is used as the frame image to be tested, and the image area of the moving target in the frame image to be tested is obtained as the target area.
[0055] It should be noted that the position and range of a moving target can usually be determined by manual annotation or using an annotation tool. In one embodiment of the present invention, a YOLO neural network model can be used in the target video training data to mark the target, and the image area of the moving target in the frame image to be tested is obtained as the target area. The specific YOLO neural network model is a technical means well known to those skilled in the art, and will not be described in detail here.
[0056] The specific optical flow field is a technical means well known to those skilled in the art and will not be described in detail here.
[0057] In the relevant target video training data, there are multiple collected moving targets. The collected targets will move relative to the detected and tracked targets in consecutive frames, and the scale of the same target will change in consecutive frames. There will also be relative occlusion, which will cause the size of the target's tracking frame to change in consecutive frames. Optical flow analysis can match and track the pixels in consecutive video frame images, describing the dynamic trend of the grayscale change of each pixel between consecutive frames. By obtaining matching optical flow points, the movement of the same target in consecutive frames is represented. Therefore, according to the grayscale distribution and position characteristics of the pixels between each target area in the frame image to be tested and the subsequent frame images, the matching optical flow points are selected in combination with optical flow analysis.
[0058] Preferably, in one embodiment of the present invention, the method for obtaining matching optical flow points includes:
[0059] Obtain the optical flow matching distance according to the grayscale distribution and position characteristics of the pixels between each target area on the frame image to be tested and other subsequent frame images;
[0060] If the optical flow matching distance between the pixel points of each target area on the frame image to be tested and other frame images is less than or equal to the preset matching threshold, the corresponding pixel point is a matching optical flow point.
[0061] The goal of optical flow matching is to minimize the pixel differences between frames to obtain accurate motion estimation. By matching optical flow points, the algorithm can track the motion trajectory of pixels or feature points in the image, thereby more accurately understanding the motion pattern of the target. It should be noted that in one embodiment of the present invention, the preset matching threshold is 5; in other embodiments of the present invention, the size of the preset matching threshold can be set according to specific circumstances, which is not limited or elaborated here.
[0062] Optical flow matching distance is a key indicator to measure the similarity of pixel or feature point motion between frame images. By calculating the optical flow matching distance, we can determine the pixel points that maintain consistency between different frame images, effectively search and match related feature points in continuous frame images, and more accurately estimate the target's motion trajectory and speed. Therefore, we obtain the optical flow matching distance for screening.
[0063] Preferably, in an embodiment of the present invention, the method for obtaining the optical flow matching distance includes:
[0064] For each frame of the image, the neighborhood grayscale features of each pixel are obtained based on the ratio of the grayscale fluctuation degree and grayscale level of the pixel within the neighborhood of each pixel; the sum of the squares of the position coordinates of each pixel is calculated as the regional position feature; the group features of each pixel are obtained based on the distribution number of the corresponding grayscale values of each pixel;
[0065] The feature set of each pixel is obtained based on the neighborhood grayscale features, regional position features and group features of each pixel; the optical flow field of the target video training data is constructed, and the optical flow matching distance is obtained based on the degree of change in the feature set of corresponding pixels between each target area on the frame image to be tested and other subsequent frame images in the optical flow field.
[0066] It should be noted that, in one embodiment of the present invention, the grayscale fluctuation degree is obtained by calculating the variance of all grayscale values within the neighborhood of the pixel point; the grayscale level is obtained by calculating the mean of the grayscale within the neighborhood of the pixel point. In other embodiments of the present invention, the degree of fluctuation may also be characterized by calculating the extreme difference or the average deviation; the grayscale level may also be represented by selecting the median or mode of the grayscale value of the pixel point. The specific means are well known to those skilled in the art and will not be elaborated here.
[0067] It should be noted that, in one embodiment of the present invention, the degree of change can be analyzed by calculating the Euclidean distance of the pixel points between each target area on the frame image to be tested and the next frame image in the feature set. The larger the Euclidean distance, the greater the degree of change. In other embodiments of the present invention, the DTW distance can also be used to construct a relationship in which the larger the DTW distance, the greater the degree of change. The specific means are technical means well known to those skilled in the art and will not be elaborated here.
[0068] It should be noted that, in one embodiment of the present invention, the neighborhood range is a range centered on a pixel point and composed of eight neighboring pixel points of the pixel point; in other embodiments of the present invention, the size of the neighborhood range can be set according to specific circumstances, and is not limited or elaborated here.
[0069] Step S3: According to the number of matching optical flow points corresponding to each target area between frame images and the relative distance between the matching optical flow points on each frame image, obtain the matching density coefficient corresponding to each target area on each frame image between frame images; according to the change difference of the matching density coefficient between the frame image to be tested and the next frame image of the frame to be tested and between the next two frames, obtain the optical flow interference coefficient of each target area on the next frame image of the frame to be tested; according to the volatility of the distribution change difference of the matching optical flow points between adjacent frame images, obtain the rotation threshold suppression coefficient; according to the optical flow interference coefficient, the rotation threshold suppression coefficient and the position distribution of the matching optical flow points of each target area between adjacent frame images, adjust the preset matching threshold to obtain the adjusted matching threshold.
[0070] The number of matching optical flow points reflects the activeness of the target area's movement between frame images. More optical flow points usually mean that the target area has experienced a greater displacement or deformation between frame images. The relative distance between matching optical flow points reflects the degree of dispersion between them. If the distance is close, it means that the optical flow points are concentrated in a smaller area, indicating that the target area moves less between frames or has a more stable shape, and the density is greater. The movement of the target area between frame images can be analyzed more comprehensively. Therefore, according to the number of matching optical flow points corresponding to each target area between frame images, and the relative distance between matching optical flow points on each frame image, the matching density coefficient corresponding to each target area on each frame image between frame images is obtained.
[0071] Preferably, in one embodiment of the present invention, the method for obtaining the matching density coefficient includes:
[0072] Calculate the Euclidean distance between the matching optical flow points on each frame image as the relative distance;
[0073] The matching density coefficient is obtained according to the calculation formula of the matching density coefficient. The calculation formula of the matching density coefficient is:
[0074] ;
[0075] in, Indicates the number of frames between images The corresponding frame image The matching density coefficient of the target area; Indicates the correspondence between frame images The number of matching optical flow points in the target area; Indicates the number of frames between images The corresponding frame image The target area Matching optical flow points; Indicates the number of frames between images The corresponding frame image The target area Matching optical flow points; Indicates the Euclidean distance; represents the Gaussian kernel function; Represents the bandwidth parameter in the Gaussian kernel function.
[0076] In the formula for matching density coefficient, Indicates the number of frames between images The corresponding frame image The target area Matching optical flow points with The ratio of the Euclidean distance between the matching optical flow points and the bandwidth parameter; Measure the distance between frames The frame image corresponds to The target area Matching optical flow points with The similarity between the matching optical flow points. When the Euclidean distance is smaller, the number of matching optical flow points is greater. The smaller it is, the larger the Gaussian kernel function is, the greater the similarity is, and the larger the matching density coefficient is in the target area; Calculate the The cumulative sum of the Gaussian kernels between the matching optical flow points and other matching optical flow points is averaged to obtain the The average similarity of the matching optical flow point with all other matching optical flow points, that is, The corresponding frame image The target area The kernel density of the matching optical flow points. The greater the average similarity, the larger the Gaussian kernel function and the greater the kernel density.
[0077] For the same target area, the change of matching density coefficient between the frame image to be tested and its adjacent frames and interval frames should maintain its gradual change, and the density change should be relatively gentle; however, if there is an abnormal situation that the density of the corresponding target area between adjacent frame images is significantly reduced, while the density of the corresponding target area between the interval frame images is increased, it may be because of the illumination change or image quality problem of the frame image, which leads to the decrease of the matching optical flow point density and the larger optical flow interference coefficient. Therefore, according to the difference in the change of matching density coefficient between the frame image to be tested and the next frame image of the frame to be tested and the next two frames, the optical flow interference coefficient of each target area on the next frame image of the frame to be tested is obtained.
[0078] Preferably, in one embodiment of the present invention, the method for obtaining the optical flow interference coefficient includes:
[0079] According to the difference of the matching density coefficients of each target area between the two frame images, the density change degree of each target area between the two frame images is obtained;
[0080] According to the difference in density variation of each target area between the frame image to be tested and the next two frames of the frame to be tested and the next frame of the frame to be tested, the optical flow interference coefficient of each target area of the next frame of the frame to be tested is obtained.
[0081] In one embodiment of the present invention, the formula of the optical flow interference coefficient is expressed as:
[0082] ;
[0083] ;
[0084] in, Indicates The target area is in the frame after the frame to be tested. The optical flow interference coefficient on the image; Indicates the frame to be tested Image and the frame after the frame to be tested The corresponding images The degree of density change in the target area; Indicates the frame to be tested Image and the next two frames after the frame to be tested The corresponding images The degree of density change in the target area; Indicates Frame image and The corresponding frames The degree of density change in the target area; Indicates the number of frames between images The corresponding frame image The matching density coefficient of the target area; Indicates the number of frames between images The corresponding frame image The matching density coefficient of the target area.
[0085] In the formula of the optical flow interference coefficient, Indicates the frame to be tested Image and the next two frames after the frame to be tested Image and next frame The difference in density change between the images corresponding to each target area, the larger the difference, the higher the density of the frame to be tested. Image and the frame after the frame to be tested The lower the density variation between images, the smaller the number of frames to be tested. Image and the next two frames after the frame to be tested The greater the density variation between images, the greater the The more discrete the distribution of matching optical flow points on the image, the more likely it is that there will be lighting changes or image quality problems. The larger the lighting interference coefficient, the more optical flow points need to be obtained in the corresponding target area for accurate tracking.
[0086] It should be noted that, in other embodiments of the present invention, , Other basic mathematical operations can also be used to construct the The frame image corresponds to The larger the matching density coefficient of the target area, the smaller the density change. The frame image corresponds to The larger the matching density coefficient of the target area, the greater the density change; Frame images correspond to adjacent The smaller the density variation of each target area between frame images, the Frame image corresponding interval The greater the density change of each target area between frame images, the greater the positive and negative correlation of the optical flow interference coefficient; among them, the positive correlation means that the dependent variable will increase as the independent variable increases, and the dependent variable will decrease as the independent variable decreases. The specific relationship can be a multiplication relationship, an addition relationship, or the power of an exponential function, which is determined by actual applications; the negative correlation means that the dependent variable will decrease as the independent variable increases, and the dependent variable will increase as the independent variable decreases. It can be a subtraction relationship, a division relationship, etc., which is determined by actual applications. For example, calculate the difference between the two to normalize and calculate , The specific means are well known to those skilled in the art and will not be elaborated here.
[0087] It should be noted that when implementing negative correlation processing, if the ratio is adopted, it is necessary to add an artificial threshold to the denominator of the fraction, such as a value of 0.01, to avoid the situation where the denominator of the fraction is 0.
[0088] Since the optical flow method relies on the similarity between adjacent frames for motion estimation, when the correlation between frames changes, the distribution of optical flow points will also change accordingly. By performing fluctuation detection on the distribution change difference of matching optical flow points between adjacent frame images, the optical flow periodic anomaly caused by the weakening of inter-frame correlation can be identified. This fluctuation detection helps to identify unstable areas or abnormal frames that may exist in the video; the rotation threshold suppression coefficient is adaptively adjusted according to the strength of the distribution change difference of matching optical flow points between frames, so as to better adapt to the changes in video content in the optical flow calculation; therefore, the rotation threshold suppression coefficient is obtained according to the fluctuation of the distribution change difference of matching optical flow points between adjacent frame images.
[0089] Preferably, in one embodiment of the present invention, the method for obtaining the rotation threshold suppression coefficient includes:
[0090] The relative distance between the matching optical flow points of each target area in each frame image is used as the distribution feature;
[0091] The rotation threshold suppression coefficient is obtained according to the fluctuation degree of the difference in distribution characteristics of the matching optical flow points corresponding to each target area between different frame images.
[0092] In one embodiment of the present invention, the formula of the rotation threshold suppression coefficient is expressed as:
[0093] ;
[0094] ;
[0095] in, Indicates The target area is in the frame to be tested Image and the frame after the frame to be tested The rotation threshold suppression coefficient of the image; Indicates The target area is in the frame to be tested Image and the frame after the frame to be tested The image Matching optical flow points with The ratio of matching optical flow points, that is, the difference in distribution characteristics; Indicates the frame to be tested between frame images The image corresponds to The target area Matching optical flow points; Indicates the frame to be tested between frame images The image corresponds to The target area Matching optical flow points; Indicates the next frame after the frame to be tested between frame images The image corresponds to The target area Matching optical flow points; Indicates the next frame after the frame to be tested between frame images The image corresponds to The target area Matching optical flow points; Indicates The target area is in the frame to be tested Image and the frame after the frame to be tested The variance of the differences in the distribution characteristics of all matching optical flow points between images; Indicates the Euclidean distance; Represents the normalization function.
[0096] In the formula for the rotation threshold suppression coefficient, Indicates the frame to be tested between frame images The image corresponds to The target area The matching optical flow points and The Euclidean distance between matching optical flow points; Indicates the next frame after the frame to be tested between frame images The image corresponds to The target area Matching optical flow points with The Euclidean distance between matching optical flow points; Indicates the correspondence between frame images Target area Matching optical flow points with The ratio of the Euclidean distances between the matching optical flow points, that is, the difference in distribution characteristics; the smaller the variance, the more consistent the distribution differences of the matching optical flow points, and the smaller the possibility of self-rotation; the larger the variance, the more inconsistent the distribution differences of the matching optical flow points, the more likely it is to be caused by self-motion or rotation, and the larger the rotation threshold suppression coefficient.
[0097] It should be noted that, in one embodiment of the present invention, the degree of fluctuation can be achieved by calculating the variance. The larger the variance, the greater the degree of fluctuation. The specific means are technical means well known to those skilled in the art and will not be elaborated here.
[0098] In the process of target tracking, the target may undergo dynamic changes such as scale change and rotation; the optical flow interference coefficient reflects the scale change of the target area between adjacent frames. When the target area undergoes a large scale change, the originally set matching threshold may no longer be applicable, so it needs to be adjusted based on the optical flow interference coefficient; the rotation threshold suppression coefficient measures the rotation of the target area between adjacent frames. When the target rotates, the position distribution of the matching optical flow points will change, which may lead to mismatching or missed matching. By introducing the rotation threshold suppression coefficient, the matching threshold can be adjusted according to the rotation of the target, reducing mismatching and missed matching, and improving the accuracy of target tracking; due to the movement of the target in the scene, its position in the continuous frame images will change. By analyzing the position distribution of these optical flow points, the matching threshold can be adjusted more accurately to adapt to the actual movement of the target. Therefore, the preset matching threshold is adjusted according to the optical flow interference coefficient, the rotation threshold suppression coefficient, and the position distribution of the matching optical flow points of each target area between adjacent frame images to obtain the adjusted matching threshold.
[0099] Preferably, in one embodiment of the present invention, the method for adjusting the matching threshold value includes:
[0100] The area expansion coefficient is obtained according to the position distribution of the matching optical flow points between adjacent frame images of each target area;
[0101] According to the optical flow interference coefficient, the rotation threshold suppression coefficient, the area expansion coefficient and the preset matching threshold, the adjustment matching threshold is obtained; the optical flow interference coefficient, the area expansion coefficient and the preset matching threshold are all positively correlated with the adjustment matching threshold; the rotation threshold suppression coefficient is negatively correlated with the adjustment matching threshold. Among them, the positive correlation relationship means that the dependent variable will increase with the increase of the independent variable, and the dependent variable will decrease with the decrease of the independent variable. The specific relationship can be a multiplication relationship, an addition relationship, and the power of an exponential function, which is determined by actual applications; the negative correlation relationship means that the dependent variable will decrease with the increase of the independent variable, and the dependent variable will increase with the decrease of the independent variable. It can be a subtraction relationship, a division relationship, etc., which is determined by actual applications.
[0102] When the target moves in the image sequence, the corresponding pixel position will change. By analyzing the position distribution of matching optical flow points between adjacent frame images, the size change of the target between adjacent frames can be estimated more accurately and the target position information can be updated. Therefore, the area expansion coefficient is obtained according to the position distribution of matching optical flow points between adjacent frame images for each target area.
[0103] Preferably, in one embodiment of the present invention, the method for obtaining the area expansion coefficient includes:
[0104] Constructing the minimum bounding rectangle of each target area matching the optical flow points between the frames to be tested as the first target area; constructing the minimum bounding rectangle of each target area matching the optical flow points between the next frames as the second target area;
[0105] The length and width of the first target area are multiplied by the density change degree respectively to obtain the length and width of the predicted target area; the minimum circumscribed rectangle of the second target area and the predicted target area is constructed as the overall target area;
[0106] The difference between the overall target area and the second target area and the ratio of the second target area are calculated, and the ratio result and a preset constant are added to obtain the area expansion coefficient.
[0107] In one embodiment of the present invention, the formula for adjusting the matching threshold is expressed as:
[0108] ;
[0109] ;
[0110] in, Indicates The target area is in the frame to be tested Image and the frame after the frame to be tested Adjust matching threshold of the image; represents the area expansion coefficient; represents the area of the overall target region D; Indicates the next frame after the frame to be tested The minimum bounding rectangle of matching optical flow points on the image The area of the second target area; Indicates The target area is in the frame to be tested Image and the frame after the frame to be tested The rotation threshold suppression coefficient of the image; Indicates The optical flow interference coefficient of the target area in the next frame image; Indicates the preset matching threshold.
[0111] In the formula for adjusting the matching threshold, Indicates The optical flow interference coefficient of the target area in the next frame image and the The target area is in the frame to be tested Image and the frame after the frame to be tested The ratio of the rotation threshold suppression coefficient of the target rotation obtained by the image; the larger the optical flow interference coefficient, the higher the threshold needs to be adjusted to obtain more abundant matching optical flow points, the larger the rotation threshold suppression coefficient, and the threshold needs to be lowered to reduce its threshold size to suppress the misalignment matching between the target optical flow points and the surrounding environment; therefore, the larger the optical flow interference coefficient, the smaller the rotation threshold suppression coefficient, the more the threshold needs to be increased, the larger the ratio, the larger the corresponding matching threshold; Represents the area of the overall target region D minus the frame after the frame to be measured The area of the minimum circumscribed rectangle C of the matching optical flow point on the image and the frame after the frame to be tested The ratio of the area of the minimum circumscribed rectangle C of the matching optical flow points on the image is expressed as the ratio of the area on the target where the optical flow matching is not obtained to the area where the optical flow matching is obtained. That is, the area expansion coefficient; the smaller the ratio, the larger the optical flow matching area, the less need to increase the matching threshold, and the smaller the area expansion coefficient; the larger the ratio, the smaller the optical flow matching area, the larger the optical flow matching area, the larger the area expansion coefficient, and the more need to increase the matching threshold.
[0112] It should be noted that, in other embodiments of the present invention, a positive correlation may also be constructed by other basic mathematical operations such as partial addition. The specific means are well known to those skilled in the art and will not be elaborated herein.
[0113] Step S4: According to the adjusted matching threshold, the matching optical flow points are screened and adjusted to obtain a new target area in the next frame image; based on the recurrent neural network, the next frame image is used as a new frame image to be tested to achieve continuous tracking of the target.
[0114] Setting the matching threshold can filter the matching optical flow points and exclude those optical flow points that deviate greatly from the expected motion trajectory, which can improve the accuracy of target area extraction, reduce mismatching and misdetection, and more accurately extract the target area in the next frame of image. Therefore, according to adjusting the matching threshold, the matching optical flow points are filtered and adjusted to obtain the new target area in the next frame of image.
[0115] It should be noted that, in one embodiment of the present invention, the optical flow matching distance between each target area on the frame image to be tested and the pixel points of other subsequent frame images is less than or equal to the adjustment matching threshold, which corresponds to the adjustment matching optical flow point; then, the minimum circumscribed rectangle is constructed on the subsequent frame image with these adjustment matching optical flow points as the new target area in the subsequent frame image.
[0116] Recurrent neural networks introduce the concept of time into neural networks, enabling them to process sequential data. In target tracking, recurrent neural networks have memory and can retain and transmit previous information. They can adapt to changes by learning target features in historical frames and track targets more accurately.
[0117] It should be noted that the specific recurrent neural network is a technical means well known to those skilled in the art and will not be described in detail here.
[0118] In summary, the present invention selects matching optical flow points based on the grayscale distribution and position characteristics of the pixel points between each target area on the frame image to be tested and the subsequent other frame images in combination with optical flow analysis; obtains the matching density coefficient corresponding to each target area on each frame image between the frame images according to the number of matching optical flow points corresponding to each target area between the frame images and the relative distance between the matching optical flow points on each frame image; then obtains the optical flow interference coefficient of each target area on the subsequent frame image of the frame to be tested; obtains the rotation threshold suppression coefficient based on the volatility of the distribution change difference of the matching optical flow points between adjacent frame images; obtains the adjustment matching threshold in combination with the position distribution of the matching optical flow points of each target area between adjacent frame images; selects and adjusts the matching optical flow points to obtain a new target area in the subsequent frame image; based on the recurrent neural network, the subsequent frame image is used as the new frame image to be tested to achieve continuous tracking of the target. The present invention improves the accuracy of target positioning and tracking by adaptively obtaining the accurate matching threshold of the optical flow points.
[0119] Based on the same application concept as the target tracking method based on a recurrent neural network provided in the embodiment of the present application, the present embodiment also proposes a target tracking system based on a recurrent neural network, such as Figure 2 As shown, the system includes: a data acquisition module 201, an optical flow matching module 202, a threshold adjustment module 203 and a target tracking module 204:
[0120] Data acquisition module 201: acquiring target video training data containing a moving target;
[0121] Optical flow matching module 202: using the initial frame image of the target video training data as the frame image to be tested, obtaining the image area of the moving target in the frame image to be tested as the target area; filtering out matching optical flow points based on the grayscale distribution and position characteristics of the pixels between each target area on the frame image to be tested and other subsequent frame images in combination with optical flow analysis;
[0122] Threshold adjustment module 203: according to the number of matching optical flow points corresponding to each target area between frame images and the relative distance between the matching optical flow points on each frame image, obtain the matching density coefficient corresponding to each target area on each frame image between frame images; according to the change difference of the matching density coefficient between the frame image to be tested and the next frame image of the frame to be tested and the next two frames, obtain the optical flow interference coefficient of each target area on the next frame image of the frame to be tested; according to the volatility of the distribution change difference of the matching optical flow points between adjacent frame images, obtain the rotation threshold suppression coefficient; according to the optical flow interference coefficient, the rotation threshold suppression coefficient and the position distribution of the matching optical flow points of each target area between adjacent frame images, adjust the preset matching threshold to obtain the adjusted matching threshold;
[0123] Target tracking module 204: Filter and adjust the matching optical flow points according to the adjusted matching threshold value to obtain the target area in the next frame image; based on the recurrent neural network, use the next frame image as a new frame image to be tested to achieve continuous tracking of the target.
[0124] It should be noted that the system provided in the above embodiment is only illustrated by the division of the above functional modules. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the computer device can be divided into different functional modules to complete all or part of the functions described above.
[0125] It should be understood that the system provided in this embodiment is used to execute the above-mentioned target tracking method based on recurrent neural network, and therefore has the same beneficial effects as the method adopted, run or implemented by the application program stored therein.
[0126] The present invention also provides an electronic device, such as Figure 3 , including a memory 301, a processor 302, and a computer program 303 stored in the memory and executable on the processor. When the processor 302 executes the computer program 303, any one of the steps of a target tracking method based on a recurrent neural network is implemented.
[0127] It should be noted that the sequence of the above embodiments of the present invention is only for description and does not represent the advantages and disadvantages of the embodiments. The processes depicted in the accompanying drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0128] The various embodiments in this specification are described in a progressive manner, and the same or similar parts between the various embodiments can be referenced to each other, and each embodiment focuses on the differences from other embodiments.
Claims
1. A target tracking method based on recurrent neural network, characterized in that: The method comprises: Obtain target video training data containing moving objects; The initial frame image of the target video training data is used as the frame image to be tested, and the image area of the moving target in the frame image to be tested is obtained as the target area; according to the grayscale distribution and position characteristics of the pixel points between each target area on the frame image to be tested and other subsequent frame images, the matching optical flow points are screened out in combination with optical flow analysis; According to the number of matching optical flow points corresponding to each target area between frame images and the relative distance between the matching optical flow points on each frame image, the matching density coefficient corresponding to each target area on each frame image between frame images is obtained; according to the change difference of the matching density coefficient between the frame image to be tested and the next frame image to be tested and the next two frames, the optical flow interference coefficient of each target area on the next frame image to be tested is obtained; according to the volatility of the distribution change difference of the matching optical flow points between adjacent frame images, the rotation threshold suppression coefficient is obtained; according to the optical flow interference coefficient, the rotation threshold suppression coefficient and the position distribution of the matching optical flow points of each target area between adjacent frame images, the preset matching threshold is adjusted to obtain the adjusted matching threshold; According to the adjustment matching threshold, the matching optical flow points are screened and adjusted to obtain the target area in the next frame image; based on the recurrent neural network, the next frame image is used as a new frame image to be tested to achieve continuous tracking of the target; The method for obtaining the matching density coefficient includes: Calculate the Euclidean distance between the matching optical flow points on each frame image as the relative distance; The matching density coefficient is obtained according to the calculation formula of the matching density coefficient. The calculation formula of the matching density coefficient is: in, N represents the matching density coefficient of the i-th target area on the t-th frame image between frame images; i Indicates the number of matching optical flow points in the i-th target area between frame images; Represents the nth matching optical flow point corresponding to the i-th target area on the t-th frame image between frame images; represents the mth matching optical flow point corresponding to the i-th target area on the t-th frame image between frame images; || || represents the Euclidean distance; K() represents the Gaussian kernel function; h represents the bandwidth parameter in the Gaussian kernel function; The method for obtaining the optical flow interference coefficient includes: According to the difference of the matching density coefficients of each target area between the two frame images, the density change degree of each target area between the two frame images is obtained; Obtaining an optical flow interference coefficient of each target area of the next frame image of the frame to be tested according to the difference in density change degree of each target area between the frame image to be tested and the next two frames image and the next frame image of the frame to be tested; The method for obtaining the rotation threshold suppression coefficient includes: The relative distance between the matching optical flow points of each target area in each frame image is used as the distribution feature; According to the fluctuation degree of the distribution characteristic difference of the matching optical flow points corresponding to each target area between different frame images, the rotation threshold suppression coefficient is obtained; The method for obtaining the adjusted matching threshold comprises: The area expansion coefficient is obtained according to the position distribution of the matching optical flow points between adjacent frame images of each target area; The adjusted matching threshold is obtained according to the optical flow interference coefficient, the rotation threshold suppression coefficient, the area expansion coefficient and the preset matching threshold; the optical flow interference coefficient, the area expansion coefficient and the preset matching threshold are all positively correlated with the adjusted matching threshold; the rotation threshold suppression coefficient is negatively correlated with the adjusted matching threshold.
2. A target tracking method based on a recurrent neural network according to claim 1, characterized in that: The method for obtaining the matching optical flow points includes: Obtain the optical flow matching distance according to the grayscale distribution and position characteristics of the pixels between each target area on the frame image to be tested and other subsequent frame images; If the optical flow matching distance between the pixel points of each target area on the frame image to be tested and other subsequent frame images is less than or equal to the preset matching threshold, the corresponding pixel point is a matching optical flow point.
3. A target tracking method based on recurrent neural network according to claim 2, characterized in that: The method for obtaining the optical flow matching distance includes: For each frame of image, the neighborhood grayscale feature of each pixel is obtained according to the ratio of the grayscale fluctuation degree and grayscale level of the pixel within the neighborhood of each pixel; Calculate the sum of the squares of the position coordinates of each pixel as the regional position feature; obtain the group feature of each pixel based on the distribution number of the grayscale value corresponding to each pixel; According to the neighborhood grayscale features, regional location features and group features of each pixel, a feature set of each pixel is obtained; The optical flow field of the target video training data is constructed, and the optical flow matching distance is obtained according to the degree of change of the feature set of corresponding pixels between each target area on the frame image to be tested and other subsequent frame images in the optical flow field.
4. The target tracking method based on recurrent neural network according to claim 1, characterized in that: The method for obtaining the area expansion coefficient includes: Constructing the minimum bounding rectangle of each target area matching the optical flow points between the frames to be tested as the first target area; constructing the minimum bounding rectangle of each target area matching the optical flow points between the next frames as the second target area; Multiplying the length and width of the first target area by the density change degree respectively to obtain the length and width of the predicted target area; constructing the minimum circumscribed rectangle of the second target area and the predicted target area as the overall target area; The difference between the overall target area and the second target area and the ratio of the second target area are calculated, and the ratio result and a preset constant are added to obtain the area expansion coefficient.
5. A target tracking system based on recurrent neural network, characterized in that: The system comprises: Data acquisition module: acquires target video training data containing moving targets; Optical flow matching module: The initial frame image of the target video training data is used as the frame image to be tested, and the image area of the moving target in the frame image to be tested is obtained as the target area; the matching optical flow points are selected based on the grayscale distribution and position characteristics of the pixels between each target area on the frame image to be tested and other subsequent frame images, combined with optical flow analysis; Threshold adjustment module: according to the number of matching optical flow points corresponding to each target area between frame images and the relative distance between the matching optical flow points on each frame image, obtain the matching density coefficient corresponding to each target area on each frame image between frame images; according to the change difference of the matching density coefficient between the frame image to be tested and the next frame image of the frame to be tested and the next two frames, obtain the optical flow interference coefficient of each target area on the next frame image of the frame to be tested; according to the volatility of the distribution change difference of the matching optical flow points between adjacent frame images, obtain the rotation threshold suppression coefficient; according to the optical flow interference coefficient, the rotation threshold suppression coefficient and the position distribution of the matching optical flow points of each target area between adjacent frame images, adjust the preset matching threshold to obtain the adjusted matching threshold; The method for obtaining the matching density coefficient includes: Calculate the Euclidean distance between the matching optical flow points on each frame image as the relative distance; The matching density coefficient is obtained according to the calculation formula of the matching density coefficient. The calculation formula of the matching density coefficient is: in, N represents the matching density coefficient of the i-th target area on the t-th frame image between frame images; i Indicates the number of matching optical flow points in the i-th target area between frame images; Represents the nth matching optical flow point corresponding to the i-th target area on the t-th frame image between frame images; represents the mth matching optical flow point corresponding to the i-th target area on the t-th frame image between frame images; || || represents the Euclidean distance; K() represents the Gaussian kernel function; h represents the bandwidth parameter in the Gaussian kernel function; The method for obtaining the optical flow interference coefficient includes: According to the difference of the matching density coefficients of each target area between the two frame images, the density change degree of each target area between the two frame images is obtained; Obtaining an optical flow interference coefficient of each target area of the next frame image of the frame to be tested according to the difference in density change degree of each target area between the frame image to be tested and the next two frames image and the next frame image of the frame to be tested; The method for obtaining the rotation threshold suppression coefficient includes: The relative distance between the matching optical flow points of each target area in each frame image is used as the distribution feature; According to the fluctuation degree of the distribution characteristic difference of the matching optical flow points corresponding to each target area between different frame images, the rotation threshold suppression coefficient is obtained; The method for obtaining the adjusted matching threshold comprises: The area expansion coefficient is obtained according to the position distribution of the matching optical flow points between adjacent frame images of each target area; According to the optical flow interference coefficient, the rotation threshold suppression coefficient, the area expansion coefficient and the preset matching threshold, the adjustment matching threshold is obtained; the optical flow interference coefficient, the area expansion coefficient and the preset matching threshold are all positively correlated with the adjustment matching threshold; the rotation threshold suppression coefficient is negatively correlated with the adjustment matching threshold; Target tracking module: According to the adjustment of matching threshold, the matching optical flow points are screened and adjusted to obtain the target area in the next frame image; based on the recurrent neural network, the next frame image is used as the new frame image to be tested to achieve continuous tracking of the target.
6. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the steps of a target tracking method based on a recurrent neural network as described in any one of claims 1 to 4 are implemented.
