A target detection method and device based on inter-frame information
By using inter-frame information matching and motion compensation technology in target detection, the problem in the existing technology that single frame information is difficult to accurately detect targets similar to the background is solved, the detection accuracy is improved and real-time target detection is achieved.
Patent Information
- Application Number
- CN202111018575.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-01
- Publication Date
- 2024-10-29
- Estimated Expiration
- 2041-09-01
AI Technical Summary
Existing target detection methods only use single frame information, which makes it difficult to accurately detect targets similar to the background and cannot effectively solve the problem of difficult positive example location in real-time target detection.
By obtaining the current frame and the previous frame of the video, extract key point features for matching, calculate the background motion vector and absolute optical flow vector, perform motion compensation, obtain the relative optical flow field map, superimpose it with the current frame, and input the target Detection networks to improve detection accuracy.
By combining inter-frame motion information, the detection accuracy of moving objects is improved, the ability to detect targets similar to the background is enhanced, and real-time target detection is achieved.
Smart Images

Figure CN113870307B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of computer vision, and in particular relates to a target detection method and device based on inter-frame information. Background Art
[0002] Object detection is a computer technology related to computer vision and image processing. It is used to detect semantic objects of specific categories (such as people, buildings or cars) in digital images and videos. It has broad application prospects in video security, autonomous driving, traffic monitoring, drone scene analysis and robot vision.
[0003] In recent years, due to the development of convolutional neural networks and the improvement of hardware computing power, object detection based on deep learning has made breakthrough progress. At present, deep learning algorithms have been widely adopted in the entire field of computer vision. The current mainstream object detection methods can be roughly divided into two categories: one is region-based methods, and the other is regression-based methods.
[0004] The region-based method is also called a two-stage algorithm. In 2014, Grishick et al. used a candidate region network to replace sliding windows and manually designed features, and designed the RCNN framework, providing a new solution for target detection. Subsequently, based on RCNN, algorithms such as Fast-RCNN, Faster-RCNN, and SPP-Net appeared one after another, improving both speed and accuracy. However, since the algorithm is still divided into two stages, it is difficult to detect in real time.
[0005] Regression-based methods are also called one-stage algorithms. In 2016, Redmon et al. proposed the YOLO algorithm, which greatly accelerated the detection speed by using the idea of regression. Liu et al. proposed SSD, which integrated the anchor box idea in Faster-RCNN into YOLO and solved the problem of YOLO positioning accuracy. On this basis, algorithms such as YOLOV2 and YOLOV3 appeared one after another, which improved the detection accuracy of the one-stage algorithm while maintaining the speed advantage.
[0006] Therefore, the two-stage algorithm pursues the detection accuracy of the target more, while the one-stage algorithm makes an effective trade-off between accuracy and speed. For real-time target detection, the detection speed requirement is often higher, so the one-stage algorithm is preferred as the basic algorithm. However, common target detection algorithms only use single-frame information and cannot accurately locate the target when the target is similar to the background. Summary of the invention
[0007] In order to solve the above technical problems, the present invention proposes a target detection method and device based on inter-frame information. The method and device are used to solve the technical problem that the target detection method in the prior art only uses single-frame image information and cannot accurately detect difficult positive examples.
[0008] According to a first aspect of the present invention, a target detection method based on inter-frame information is provided, the method comprising the following steps:
[0009] Step S101: obtaining a current frame of a video and an image frame of the previous frame, extracting key point features of the current frame and the key point features of the previous frame respectively, matching the key point features of the two frames to obtain a plurality of matching pairs; the key point is a pixel point in the image that represents a feature;
[0010] Step S102: based on the plurality of matching pairs, obtaining a background motion vector and an absolute optical flow vector; the absolute optical flow vector refers to a motion vector generated by the target in the camera device when both the target and the camera device shooting the video are in motion;
[0011] Step S103: Calculating the motion parameters of the camera device based on the background motion vector;
[0012] Step S104: Calculating a compensation vector of the absolute optical flow vector based on the motion parameter;
[0013] Step S105: compensating the absolute optical flow vector based on the compensation vector to obtain a relative optical flow vector of the key point; the relative optical flow vector is a motion vector of the target relative to itself;
[0014] Step S106: based on the relative optical flow vector of the key point, obtaining the relative optical flow vector of all the pixels, and splitting the relative optical flow vector of all the pixels into two relative optical flow field maps;
[0015] Step S107: superimposing the two relative optical flow field images on the current frame, and inputting the superimposed current frame into the target detection network;
[0016] Step S108: the target detection network outputs the target detection result of the current frame;
[0017] Step S109: If the current frame is the last frame of the video, the method ends; otherwise, the next frame of the current frame is set as the current frame and the process goes to step S101.
[0018] According to a second aspect of the present invention, a target detection device based on inter-frame information is provided, the device comprising:
[0019] Matching module: configured to obtain the current frame of the video and the previous frame of the current frame, respectively extract the key point features of the current frame and the key point features of the previous frame, match the key point features of the two frames of images, and obtain a number of matching pairs; the key point is a pixel point in the image that represents the feature;
[0020] An absolute optical flow vector acquisition module: configured to acquire a background motion vector and an absolute optical flow vector based on the plurality of matching pairs; the absolute optical flow vector refers to a motion vector generated by the target in the camera device when both the target and the camera device shooting the video are in motion;
[0021] A motion parameter acquisition module: configured to calculate the motion parameter of the camera device based on the background motion vector;
[0022] A compensation vector acquisition module: configured to calculate a compensation vector of the absolute optical flow vector based on the motion parameter;
[0023] Motion vector acquisition module: configured to compensate the absolute optical flow vector based on the compensation vector to obtain a relative optical flow vector of a key point; the relative optical flow vector is a motion vector of the target relative to itself;
[0024] A splitting module: configured to obtain the relative optical flow vectors of all pixels based on the relative optical flow vectors of the key points, and split the relative optical flow vectors of all pixels into two relative optical flow field maps;
[0025] A superposition module: configured to superimpose the two relative optical flow field images on the current frame, and input the superimposed current frame into the target detection network;
[0026] Detection module: configured to output the target detection result of the current frame to the target detection network;
[0027] Determination module: configured to determine whether the current frame is the last frame of the video.
[0028] According to a third aspect of the present invention, there is provided a target detection system based on inter-frame information, comprising:
[0029] A processor, which is used to execute multiple instructions;
[0030] A memory for storing a plurality of instructions;
[0031] The plurality of instructions are used to be stored by the memory, and loaded and executed by the processor to implement the target detection method based on inter-frame information as described above.
[0032] According to a fourth aspect of the present invention, a computer-readable storage medium is provided, wherein a plurality of instructions are stored in the storage medium; the plurality of instructions are used for a processor to load and execute the target detection method based on inter-frame information as described above.
[0033] According to the above scheme of the present invention, an optical flow vector is obtained by matching the key point features of the current frame and the previous frame, and a motion compensation vector is obtained by calculating the camera model parameters. The relative motion optical flow field obtained by superimposing the two is used as a motion feature and the current frame image as a lightweight target detection model input. By combining the target motion information between frames, the detection network's attention to moving objects is improved, thereby effectively improving the accuracy of difficult positive examples similar to the background. The motion compensation vector is obtained by calculating the camera motion parameters, and the optical flow vector is compensated to obtain more accurate target motion information with relative motion; by superimposing the motion information with the picture, the target motion feature is integrated into the picture feature, and the detection accuracy is effectively improved by combining the motion information for target detection; by using a lightweight target detection model as a detection model, the target detection speed is improved, and a real-time target detection effect is achieved.
[0034] The above description is only an overview of the technical solution of the present invention. In order to more clearly understand the technical means of the present invention and implement it according to the contents of the specification, the following is a detailed description of the preferred embodiments of the present invention in conjunction with the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] The accompanying drawings constituting a part of the present invention are used to provide a further understanding of the present invention, and the present invention is described by providing the following accompanying drawings. In the accompanying drawings:
[0036] Figure 1 A flow chart of a target detection method based on inter-frame information according to an embodiment of the present invention;
[0037] Figure 2 A flowchart showing the details of a target detection method based on inter-frame information according to an embodiment of the present invention;
[0038] Figure 3 A schematic diagram of a target detection network structure according to an embodiment of the present invention;
[0039] Figure 4 This is a structural block diagram of a target detection device based on inter-frame information according to an embodiment of the present invention; DETAILED DESCRIPTION
[0040] First combine Figure 1-2 The flow of a target detection method based on inter-frame information according to an embodiment of the present invention is described. The method comprises the following steps:
[0041] Step S101: obtaining a current frame of a video and an image frame of the previous frame, extracting key point features of the current frame and the key point features of the previous frame respectively, matching the key point features of the two frames to obtain a plurality of matching pairs; the key point is a pixel point in the image that represents a feature;
[0042] In this embodiment, the key points are points with obvious features in the image, such as edge points, corner points, etc. in the image.
[0043] Step S102: based on the plurality of matching pairs, obtaining a background motion vector and an absolute optical flow vector; the absolute optical flow vector refers to a motion vector generated by the target in the camera device when both the target and the camera device shooting the video are in motion;
[0044] Step S103: Calculating the motion parameters of the camera device based on the background motion vector;
[0045] Step S104: Calculating a compensation vector of the absolute optical flow vector based on the motion parameter;
[0046] Step S105: compensating the absolute optical flow vector based on the compensation vector to obtain a relative optical flow vector of the key point; the relative optical flow vector is a motion vector of the target relative to itself;
[0047] That is, the motion vector of the target when the camera device is stationary.
[0048] Step S106: based on the relative optical flow vector of the key point, obtaining the relative optical flow vector of all the pixels, and splitting the relative optical flow vector of all the pixels into two relative optical flow field maps;
[0049] Step S107: superimposing the two relative optical flow field images on the current frame, and inputting the superimposed current frame into the target detection network;
[0050] Step S108: the target detection network outputs the target detection result of the current frame;
[0051] Step S109: If the current frame is the last frame of the video, the method ends; otherwise, the next frame of the current frame is set as the current frame and the process goes to step S101.
[0052] The step S101: obtaining a current frame of the video and a previous frame of the current frame, respectively extracting key point features of the current frame and the previous frame of the video, matching the key point features of the two frames of the video to obtain a plurality of matching pairs, wherein:
[0053] In this embodiment, the ORB algorithm is used to extract key points, and the key point feature matching uses the Hamming distance as the basis for measuring the similarity of the feature points. In this embodiment, the upper limit of the number of key points extracted is 500, the scale parameter between the pyramid images is 1.2, and the number of layers of the Gaussian pyramid is 8.
[0054] Furthermore, the key points also include the following pixel points: based on the grayscale value of the image, each pixel point in the image is selected as a candidate feature point, the pixel value of the area around the candidate feature point is detected, and the key point is determined; the key point is a candidate feature point in the surrounding neighborhood with a candidate feature point as the center point, the pixel grayscale value of the key point is greater than a preset first threshold, and the difference in grayscale value between the key point and the center point is greater than a preset second threshold.
[0055] The step S102: based on the plurality of matching pairs, obtaining a background motion vector and an absolute optical flow vector; the absolute optical flow vector refers to a motion vector generated by the target in the camera device when both the target and the camera device shooting the video are in motion, including:
[0056] The RANSAC algorithm is used to remove key points, that is, in all matching pairs, an iterative method is used to find the optimal parameter model, and the key points corresponding to the matching pairs that do not conform to the optimal parameter model are removed. By presetting the third threshold, the points on the moving target in the matching pair are removed to obtain the background motion vector, which is the remaining matching vector after removing the moving target key point matching vector on the basis of all key point matching vectors in the current frame and the previous frame, and the background motion vector is used to describe the background movement that occurs with the movement of the camera device shooting the video; the fourth threshold is pre-set to remove the wrongly matched key points, and the absolute optical flow vector is obtained. The absolute optical flow vector refers to the remaining matching vector after only removing the wrongly matched key points on the basis of all key point matching vectors in the current frame and the previous frame, and the absolute motion vector is used to characterize the motion vector generated in the camera by the background and the moving target when the camera device shooting the video moves.
[0057] The step S103: calculating the motion parameters of the camera device based on the background motion vector, wherein:
[0058] The model parameters of the camera device can be calculated according to the background motion vector. The model of the camera device is a six-parameter affine transformation model. The six-parameter affine transformation model can handle the translation, rotation, and scaling of the camera device. The six-parameter affine transformation model is expressed as:
[0059]
[0060] Among them, x k ,y kis the transformed target imaging coordinate, x k-1 ,y k-1 is the transformed target imaging coordinate, a, b, c, d are the camera rotation parameters, e, f are the camera displacement parameters, θ is the camera rotation angle, γ is the camera scaling factor, (e, f) T is the translation amount of the camera device in the X-axis and Y-axis directions. The motion parameters that need to be solved in the six-parameter affine transformation can be estimated by using the least square method to find the optimal solution of the matrix vector.
[0061] The step S104: calculating a compensation vector of the absolute optical flow vector based on the motion parameter, wherein:
[0062] In this embodiment, the motion parameters are used to calculate the current frame coordinates corresponding to the key point coordinates of the previous frame to obtain the motion compensation vector; based on the key point coordinates corresponding to each motion compensation vector in the current frame, the key points in the motion compensation vector are matched one by one with the key points of the absolute optical flow vector to obtain the vector compensation vector corresponding to the absolute optical flow.
[0063] The step S105: compensating the absolute optical flow vector based on the compensation vector to obtain a relative optical flow vector of the key point; the relative optical flow vector is a motion vector of the target relative to itself, wherein:
[0064] The compensation vector is superimposed one by one with the absolute optical flow vector generated by the actual adjacent frames, and the calculation formula is as follows:
[0065]
[0066]
[0067] in, is the key point p i The relative optical flow vector is projected in the X-axis direction of the coordinate system. is the key point p i The absolute optical flow vector is projected in the X-axis direction. is the key point p i The motion compensation vector is projected in the X-axis direction of the coordinate system. is the key point p i The relative optical flow vector is projected in the Y-axis direction of the coordinate system. is the key point p i The absolute optical flow vector is projected in the Y-axis direction of the coordinate system. is the key point p i The motion compensation vector is projected in the Y-axis direction.
[0068] The step S106: based on the relative optical flow vector of the key point, the relative optical flow vector of all the pixels is obtained, and the relative optical flow vector of all the pixels is split into two relative optical flow field maps, wherein:
[0069] For the current frame image, bilinear interpolation is used to obtain the relative optical flow vector of the non-keypoint area. The calculation formula is as follows:
[0070]
[0071] Among them, (x, y) is the coordinate of a non-keypoint, (x1, y1) is the coordinate of the keypoint closest to the lower left corner of (x, y), (x1, y2) is the coordinate of the keypoint closest to the upper left corner of (x, y), (x2, y1) is the coordinate of the keypoint closest to the lower right corner of (x, y), (x2, y2) is the coordinate of the keypoint closest to the upper right corner of (x, y), and f() represents the relative optical flow vector value at the coordinate point.
[0072] The relative optical flow vector of all pixels is expressed as: T = (Tx i ,Ty i ), i∈N, where N is the total number of pixels in the current frame; Tx is the projection value of the vector in the X-axis direction of the coordinate system, and Ty is the projection value of the vector in the Y-axis direction of the coordinate system. i is the projection of the relative optical flow vector of pixel i on the X-axis of the coordinate system, Ty i is the projection of the relative optical flow vector of pixel i on the Y axis of the coordinate system;
[0073] It is split into two relative optical flow field maps, including: The optical flow field map in the X-axis direction is represented as I X ,I X The pixel value of each position in is the projection value of the relative optical flow vector corresponding to the current position in the X-axis direction; the optical flow field diagram in the Y-axis direction is represented by I Y ,I Y The pixel value at each position in is the projection value of the relative optical flow vector corresponding to the current position in the Y-axis direction.
[0074] The step S107: superimposing the two relative optical flow field images on the current frame, and inputting the superimposed current frame into the target detection network, wherein:
[0075] I X and I Y It has the same size as the current frame image and can represent the motion characteristics of the target. Therefore, it is used as a motion attention map, superimposed on the fourth and fifth channels after the three-channel image, and input into the detection model together with the actual image as the input of the target detection model.
[0076] Step S108: The target detection network outputs the target detection result of the current frame, where:
[0077] Through the convolutional neural network model regression algorithm, the target detection result of the current frame is output. Figure 3 As shown, this embodiment uses the lightweight target detection model yolov3-tiny for target detection. The backbone network uses a 7-layer network to extract features. The network structure is simple and the calculation amount is small.
[0078] The embodiment of the present invention further provides a target detection device based on inter-frame information, such as Figure 4 As shown, the device comprises:
[0079] Matching module: configured to obtain the current frame of the video and the previous frame of the current frame, respectively extract the key point features of the current frame and the key point features of the previous frame, match the key point features of the two frames of images, and obtain a number of matching pairs; the key point is a pixel point in the image that represents the feature;
[0080] An absolute optical flow vector acquisition module: configured to acquire a background motion vector and an absolute optical flow vector based on the plurality of matching pairs; the absolute optical flow vector refers to a motion vector generated by the target in the camera device when both the target and the camera device shooting the video are in motion;
[0081] A motion parameter acquisition module: configured to calculate the motion parameter of the camera device based on the background motion vector;
[0082] A compensation vector acquisition module: configured to calculate a compensation vector of the absolute optical flow vector based on the motion parameter;
[0083] Motion vector acquisition module: configured to compensate the absolute optical flow vector based on the compensation vector to obtain a relative optical flow vector of a key point; the relative optical flow vector is a motion vector of the target relative to itself;
[0084] A splitting module: configured to obtain the relative optical flow vectors of all pixels based on the relative optical flow vectors of the key points, and split the relative optical flow vectors of all pixels into two relative optical flow field maps;
[0085] A superposition module: configured to superimpose the two relative optical flow field images on the current frame, and input the superimposed current frame into the target detection network;
[0086] Detection module: configured to output the target detection result of the current frame to the target detection network;
[0087] Determination module: configured to determine whether the current frame is the last frame of the video.
[0088] The embodiment of the present invention further provides a target detection system based on inter-frame information, including:
[0089] A processor, which is used to execute multiple instructions;
[0090] A memory for storing a plurality of instructions;
[0091] The plurality of instructions are used to be stored by the memory, and loaded and executed by the processor to implement the target detection method based on inter-frame information as described above.
[0092] The embodiment of the present invention further provides a computer-readable storage medium, wherein a plurality of instructions are stored in the storage medium; the plurality of instructions are used for a processor to load and execute the target detection method based on inter-frame information as described above.
[0093] It should be noted that, in the absence of conflict, the embodiments of the present invention and the features in the embodiments may be combined with each other.
[0094] In the several embodiments provided by the present invention, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0095] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0096] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of hardware plus software functional units.
[0097] The above-mentioned integrated unit implemented in the form of a software functional unit can be stored in a computer-readable storage medium. The above-mentioned software functional unit is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a physical server, or a network cloud server, etc., which needs to be installed with Windows or Windows Server operating system) to perform some steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (RandomAccess Memory, RAM), disk or optical disk and other media that can store program codes.
[0098] The above description is only a preferred embodiment of the present invention and does not limit the present invention in any form. Any simple modification, equivalent change and modification made to the above embodiment according to the technical essence of the present invention still falls within the scope of the technical solution of the present invention.
Claims
1. A target detection method based on inter-frame information, characterized in that: The method comprises the following steps: Step S101: obtaining a current frame of a video and an image frame of the previous frame, extracting key point features of the current frame and the key point features of the previous frame respectively, matching the key point features of the two frames to obtain a plurality of matching pairs; the key point is a pixel point in the image that represents a feature; Step S102: based on the plurality of matching pairs, obtaining a background motion vector and an absolute optical flow vector; the absolute optical flow vector refers to a motion vector generated by the target in the camera device when both the target and the camera device shooting the video are in motion; Step S103: Calculating the motion parameters of the camera device based on the background motion vector; Step S104: Calculating a compensation vector of the absolute optical flow vector based on the motion parameter; Step S105: compensating the absolute optical flow vector based on the compensation vector to obtain a relative optical flow vector of the key point; the relative optical flow vector is a motion vector of the target relative to itself; Step S106: based on the relative optical flow vector of the key point, obtaining the relative optical flow vector of all the pixels, and splitting the relative optical flow vector of all the pixels into two relative optical flow field maps; Step S107: superimposing the two relative optical flow field images on the current frame, and inputting the superimposed current frame into the target detection network; Step S108: the target detection network outputs the target detection result of the current frame; Step S109: If the current frame is the last frame of the video, the method ends; otherwise, the next frame of the current frame is set as the current frame and the process goes to step S101; The step S104: calculating a compensation vector of the absolute optical flow vector based on the motion parameter, wherein: By using the motion parameters, the coordinates of the current frame corresponding to the coordinates of the key points of the previous frame are calculated to obtain a motion compensation vector; based on the coordinates of the key points, the key points in the motion compensation vector are matched one by one with the key points of the absolute optical flow vector to obtain a vector compensation vector corresponding to the absolute optical flow; The step S105, wherein: The compensation vector is superimposed one by one with the absolute optical flow vector generated by the actual adjacent frames, and the calculation formula is as follows: in, is the key point p i The relative optical flow vector is projected in the X-axis direction of the coordinate system. is the key point p i The absolute optical flow vector is projected in the X-axis direction. is the key point p i The motion compensation vector is projected in the X-axis direction of the coordinate system. is the projection of the relative optical flow vector of the key point pi in the Y-axis direction of the coordinate system, is the projection of the absolute optical flow vector of the key point pi in the Y-axis direction of the coordinate system, The motion compensation vector of the key point pi is projected in the Y-axis direction.
2. The target detection method based on inter-frame information according to claim 1, characterized in that: The step S102: based on the plurality of matching pairs, obtaining a background motion vector and an absolute optical flow vector; the absolute optical flow vector refers to a motion vector generated by the target in the camera device when both the target and the camera device shooting the video are in motion, including: Among all matching pairs, an iterative method is used to find the optimal parameter model, and the key points corresponding to the matching pairs that do not conform to the optimal parameter model are eliminated; by pre-setting a third threshold, the points on the moving target in the matching pairs are eliminated to obtain a background motion vector, and the background motion vector is used to describe the background movement that occurs as the camera device that shoots the video moves; the absolute optical flow vector is obtained, and the absolute optical flow vector refers to the matching vector remaining after only eliminating the wrong matching key points on the basis of all key point matching vectors of the current frame and the previous frame, and the absolute motion vector is used to characterize the motion vectors generated in the camera of the background and the moving target as the camera device that shoots the video moves.
3. The target detection method based on inter-frame information according to claim 2, characterized in that: The step S103: calculating the motion parameters of the camera device based on the background motion vector, wherein: The model parameters of the camera device are calculated according to the background motion vector. The model of the camera device is a six-parameter affine transformation model. The six-parameter affine transformation model can handle the translation, rotation and scaling motion of the camera device. The six-parameter affine transformation model is expressed as: Among them, x k ,y k is the transformed target imaging coordinate, x k-1 ,y k-1 is the transformed target imaging coordinate, a, b, c, d are the camera rotation parameters, e, f are the camera displacement parameters, θ is the camera device rotation angle, γ is the camera device scaling factor, (e, f) T is the translation amount of the camera device in the X-axis and Y-axis directions.
4. The target detection method based on inter-frame information according to claim 3, characterized in that: The step S106: based on the relative optical flow vector of the key point, the relative optical flow vector of all the pixels is obtained, and the relative optical flow vector of all the pixels is split into two relative optical flow field maps, wherein: For the current frame image, bilinear interpolation is used to obtain the relative optical flow vector of the non-keypoint area. The calculation formula is as follows: Among them, (x, y) is the coordinate of a non-keypoint, (x1, y1) is the coordinate of the keypoint closest to the lower left corner of (x, y), (x1, y2) is the coordinate of the keypoint closest to the upper left corner of (x, y), (x2, y1) is the coordinate of the keypoint closest to the lower right corner of (x, y), (x2, y2) is the coordinate of the keypoint closest to the upper right corner of (x, y), and f() represents the relative optical flow vector value at the coordinate point; The relative optical flow vector of all pixels is expressed as: T = (Tx i ,Ty i ), i∈N, where N is the total number of pixels in the current frame; Tx is the projection value of the vector in the X-axis direction of the coordinate system, and Ty is the projection value of the vector in the Y-axis direction of the coordinate system. i is the projection of the relative optical flow vector of pixel i on the X-axis of the coordinate system, Ty i is the projection of the relative optical flow vector of pixel i on the Y axis of the coordinate system; It is split into two relative optical flow field maps, including: the optical flow field map in the X-axis direction and the optical flow field map in the Y-axis direction; the optical flow field map in the X-axis direction is represented as I X ,I X The pixel value of each position in is the projection value of the relative optical flow vector corresponding to the current position in the X-axis direction; the optical flow field diagram in the Y-axis direction is represented by I Y ,I Y The pixel value at each position in is the projection value of the relative optical flow vector corresponding to the current position in the Y-axis direction.
5. The target detection method based on inter-frame information according to claim 4, characterized in that: The two relative optical flow field images are superimposed on the current frame, and the superimposed current frame is input into the target detection network, where: I X and I Y With the same size as the current frame image, it is used as a motion attention map, superimposed on the fourth and fifth channels after the three-channel image, and input into the detection model together with the actual image as the input of the target detection model.
6. A target detection device based on inter-frame information, characterized in that: The device comprises: Matching module: configured to obtain the current frame of the video and the previous frame of the current frame, respectively extract the key point features of the current frame and the key point features of the previous frame, match the key point features of the two frames of images, and obtain a number of matching pairs; the key point is a pixel point in the image that represents the feature; An absolute optical flow vector acquisition module: configured to acquire a background motion vector and an absolute optical flow vector based on the plurality of matching pairs; the absolute optical flow vector refers to a motion vector generated by the target in the camera device when both the target and the camera device shooting the video are in motion; A motion parameter acquisition module: configured to calculate the motion parameter of the camera device based on the background motion vector; A compensation vector acquisition module: configured to calculate a compensation vector of the absolute optical flow vector based on the motion parameter; Motion vector acquisition module: configured to compensate the absolute optical flow vector based on the compensation vector to obtain a relative optical flow vector of a key point; the relative optical flow vector is a motion vector of the target relative to itself; A splitting module: configured to obtain the relative optical flow vectors of all pixels based on the relative optical flow vectors of the key points, and split the relative optical flow vectors of all pixels into two relative optical flow field maps; A superposition module: configured to superimpose the two relative optical flow field images on the current frame, and input the superimposed current frame into the target detection network; Detection module: configured to output the target detection result of the current frame to the target detection network; A judgment module: configured to judge whether the current frame is the last frame of the video; The step of calculating a compensation vector of the absolute optical flow vector based on the motion parameter, wherein: By using the motion parameters, the coordinates of the current frame corresponding to the coordinates of the key points of the previous frame are calculated to obtain a motion compensation vector; based on the coordinates of the key points, the key points in the motion compensation vector are matched one by one with the key points of the absolute optical flow vector to obtain a vector compensation vector corresponding to the absolute optical flow; The motion vector acquisition module, wherein: The compensation vector is superimposed one by one with the absolute optical flow vector generated by the actual adjacent frames, and the calculation formula is as follows: in, is the key point p i The relative optical flow vector is projected in the X-axis direction of the coordinate system. is the projection of the absolute optical flow vector of the key point pi in the X-axis direction, is the projection of the motion compensation vector of the key point pi in the X-axis direction of the coordinate system, is the projection of the relative optical flow vector of the key point pi in the Y-axis direction of the coordinate system, is the key point p i The absolute optical flow vector is projected in the Y-axis direction of the coordinate system. is the key point p i The motion compensation vector is projected in the Y-axis direction.
7. A computer-readable storage medium, wherein a plurality of instructions are stored in the storage medium; the plurality of instructions are used by a processor to load and execute the target detection method based on inter-frame information as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Method and system for generating a video frame
CN108074247A
Video target detection method and device based on SSD network
CN111160229A
