CN115035164B - A moving target recognition method and device - Google Patents
A moving target recognition method and device Download PDFInfo
- Publication number
- CN115035164B CN115035164B CN202210697761.1A CN202210697761A CN115035164B CN 115035164 B CN115035164 B CN 115035164B CN 202210697761 A CN202210697761 A CN 202210697761A CN 115035164 B CN115035164 B CN 115035164B
- Authority
- CN
- China
- Prior art keywords
- target
- optical flow
- target object
- image
- scene
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
- 238000000034 method Methods 0.000 title claims abstract description 119
- 230000003287 optical effect Effects 0.000 claims abstract description 202
- 238000004364 calculation method Methods 0.000 claims description 42
- 239000013598 vector Substances 0.000 claims description 41
- 230000015654 memory Effects 0.000 claims description 21
- 238000001914 filtration Methods 0.000 claims description 20
- 238000012545 processing Methods 0.000 claims description 16
- 238000000605 extraction Methods 0.000 claims description 15
- 238000009499 grossing Methods 0.000 claims description 11
- 238000003860 storage Methods 0.000 claims description 10
- 230000007423 decrease Effects 0.000 claims description 7
- 238000005070 sampling Methods 0.000 claims description 4
- 238000004422 calculation algorithm Methods 0.000 description 31
- 230000008569 process Effects 0.000 description 20
- 230000006870 function Effects 0.000 description 18
- 238000005457 optimization Methods 0.000 description 15
- 238000010586 diagram Methods 0.000 description 11
- 230000002146 bilateral effect Effects 0.000 description 10
- 238000006073 displacement reaction Methods 0.000 description 10
- 238000001514 detection method Methods 0.000 description 8
- 230000003044 adaptive effect Effects 0.000 description 7
- 239000010410 layer Substances 0.000 description 7
- 230000008859 change Effects 0.000 description 6
- 230000008901 benefit Effects 0.000 description 5
- 238000002474 experimental method Methods 0.000 description 5
- 238000004088 simulation Methods 0.000 description 5
- 239000000284 extract Substances 0.000 description 4
- 238000005286 illumination Methods 0.000 description 4
- 230000000694 effects Effects 0.000 description 3
- 101001121408 Homo sapiens L-amino-acid oxidase Proteins 0.000 description 2
- 102100026388 L-amino-acid oxidase Human genes 0.000 description 2
- 101100012902 Saccharomyces cerevisiae (strain ATCC 204508 / S288c) FIG2 gene Proteins 0.000 description 2
- 238000013500 data storage Methods 0.000 description 2
- 238000009826 distribution Methods 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 238000012544 monitoring process Methods 0.000 description 2
- YMHOBZXQZVXHBM-UHFFFAOYSA-N 2,5-dimethoxy-4-bromophenethylamine Chemical compound COC1=CC(CCN)=C(OC)C=C1Br YMHOBZXQZVXHBM-UHFFFAOYSA-N 0.000 description 1
- 101000827703 Homo sapiens Polyphosphoinositide phosphatase Proteins 0.000 description 1
- 102100023591 Polyphosphoinositide phosphatase Human genes 0.000 description 1
- 241000545067 Venus Species 0.000 description 1
- 230000001133 acceleration Effects 0.000 description 1
- 230000003321 amplification Effects 0.000 description 1
- 238000004458 analytical method Methods 0.000 description 1
- 238000003491 array Methods 0.000 description 1
- 230000000739 chaotic effect Effects 0.000 description 1
- 238000004590 computer program Methods 0.000 description 1
- 238000010276 construction Methods 0.000 description 1
- 238000005520 cutting process Methods 0.000 description 1
- 230000007547 defect Effects 0.000 description 1
- 230000007812 deficiency Effects 0.000 description 1
- 238000004134 energy conservation Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 230000002708 enhancing effect Effects 0.000 description 1
- 238000011156 evaluation Methods 0.000 description 1
- 238000010191 image analysis Methods 0.000 description 1
- 238000003384 imaging method Methods 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 239000011229 interlayer Substances 0.000 description 1
- 230000014759 maintenance of location Effects 0.000 description 1
- 238000010295 mobile communication Methods 0.000 description 1
- 230000001537 neural effect Effects 0.000 description 1
- 238000010606 normalization Methods 0.000 description 1
- 238000003199 nucleic acid amplification method Methods 0.000 description 1
- 238000007781 pre-processing Methods 0.000 description 1
- 238000004321 preservation Methods 0.000 description 1
- 238000011084 recovery Methods 0.000 description 1
- 230000009467 reduction Effects 0.000 description 1
- 230000000717 retained effect Effects 0.000 description 1
- 238000012216 screening Methods 0.000 description 1
- 230000011218 segmentation Effects 0.000 description 1
- 238000009394 selective breeding Methods 0.000 description 1
- 238000004904 shortening Methods 0.000 description 1
- 238000012360 testing method Methods 0.000 description 1
- 238000004800 variational method Methods 0.000 description 1
- 238000012795 verification Methods 0.000 description 1
- 239000002699 waste material Substances 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/20—Analysis of motion
- G06T7/269—Analysis of motion using gradient-based methods
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T5/00—Image enhancement or restoration
- G06T5/70—Denoising; Smoothing
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/70—Arrangements for image or video recognition or understanding using pattern recognition or machine learning
- G06V10/764—Arrangements for image or video recognition or understanding using pattern recognition or machine learning using classification, e.g. of video objects
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/20—Special algorithmic details
- G06T2207/20024—Filtering details
- G06T2207/20028—Bilateral filtering
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Multimedia (AREA)
- Artificial Intelligence (AREA)
- Health & Medical Sciences (AREA)
- Computing Systems (AREA)
- Databases & Information Systems (AREA)
- Evolutionary Computation (AREA)
- General Health & Medical Sciences (AREA)
- Medical Informatics (AREA)
- Software Systems (AREA)
- Image Analysis (AREA)
Abstract
本发明提供了一种运动目标识别方法及装置,其中,运动目标识别方法包括:获取目标场景的相邻两帧图像,目标场景包括目标对象;分别提取相邻两帧图像对应的像素数据;将像素数据输入光流模型,计算不同权重参数对应的光流能量场;对不同权重参数对应的光流能量场进行分类,基于分类结果确定目标对象所在目标场景下的目标权重参数;基于光流模型和目标权重参数,计算得到目标对象的运动状态。通过针对不同的目标场景,实现对权重参数的灵活调节,在快速准确确定目标权重参数的基础上,不仅实现了对运动目标运动状态的精确识别,还进一步地提高了识别运动目标的效率。
The present invention provides a moving target recognition method and device, wherein the moving target recognition method comprises: obtaining two adjacent frames of images of a target scene, wherein the target scene includes a target object; extracting pixel data corresponding to the two adjacent frames of images respectively; inputting the pixel data into an optical flow model, calculating the optical flow energy field corresponding to different weight parameters; classifying the optical flow energy field corresponding to different weight parameters, and determining the target weight parameter of the target scene where the target object is located based on the classification result; and calculating the motion state of the target object based on the optical flow model and the target weight parameter. By realizing flexible adjustment of the weight parameter for different target scenes, on the basis of quickly and accurately determining the target weight parameter, not only the accurate recognition of the motion state of the moving target is realized, but also the efficiency of identifying the moving target is further improved.
Description
技术领域Technical Field
本发明涉及图像识别领域,具体涉及一种运动目标识别方法及装置。The present invention relates to the field of image recognition, and in particular to a moving target recognition method and device.
背景技术Background Art
运动目标检测在视频分析、图像处理、微纳操作、医学影像分析等领域发挥着重要作用。光流法由于具有精度高、运动或场景的信息丰富等优点,广泛应用于无人驾驶汽车前景和障碍物检测、识别、分割、跟踪、导航以及形状信息恢复等场景。光流是空间运动物体在观察成像平面上的像素运动的瞬时速度。光流法是利用图像序列中像素在时间域上的变化以及相邻帧之间的相关性来找到上一帧跟当前帧之间存在的对应关系,从而计算出相邻帧之间物体的运动信息的一种方法。Moving object detection plays an important role in video analysis, image processing, micro-nano operation, medical image analysis and other fields. Optical flow method is widely used in scenes such as foreground and obstacle detection, recognition, segmentation, tracking, navigation and shape information recovery of unmanned vehicles due to its advantages of high precision and rich information of motion or scene. Optical flow is the instantaneous speed of pixel movement of a moving object in space on the observation imaging plane. Optical flow method is a method that uses the change of pixels in the time domain in the image sequence and the correlation between adjacent frames to find the corresponding relationship between the previous frame and the current frame, thereby calculating the motion information of objects between adjacent frames.
一般来说,光流的计算方法可分为基于梯度的方法(以HS(Horn Schunck)和LK(Lucas Kanade)以及其衍生方法为代表)、基于匹配的方法、基于能量的方法、基于相位的方法和基于神经动力学方法,其中随着变分法和偏微分方程理论逐渐完善,以HS为基础原理的高精度变分运动目标识别方法和其衍生算法研究较为广泛,然而,该方法及其衍生算法由于受平滑项权重系数影响较大,而对权重系数的调节过程十分困难,需要多次人工试验,导致运动目标识别效率低下。Generally speaking, the calculation methods of optical flow can be divided into gradient-based methods (represented by HS (Horn Schunck) and LK (Lucas Kanade) and their derivative methods), matching-based methods, energy-based methods, phase-based methods and neural dynamics-based methods. Among them, with the gradual improvement of variational methods and partial differential equation theory, high-precision variational moving target recognition methods based on HS principles and their derivative algorithms have been widely studied. However, this method and its derivative algorithms are greatly affected by the weight coefficient of the smoothing term, and the adjustment process of the weight coefficient is very difficult, requiring multiple manual experiments, resulting in low efficiency in moving target recognition.
发明内容Summary of the invention
因此,本发明要解决的技术问题在于克服现有技术中的以HS为基础原理的高精度变分运动目标识别方法和其衍生算法中权重系数的调节过程十分困难,导致运动目标识别效率低下的缺陷,从而提供一种运动目标识别方法及装置。Therefore, the technical problem to be solved by the present invention is to overcome the defect that the adjustment process of the weight coefficient in the high-precision variational moving target recognition method based on the HS principle in the prior art and its derivative algorithm is very difficult, resulting in low efficiency of moving target recognition, thereby providing a moving target recognition method and device.
根据第一方面,本发明实施例提供了一种运动目标识别方法,所述方法包括:According to a first aspect, an embodiment of the present invention provides a moving target recognition method, the method comprising:
获取目标场景的相邻两帧图像,所述目标场景包括目标对象;Acquire two adjacent frames of images of a target scene, wherein the target scene includes a target object;
分别提取所述相邻两帧图像对应的像素数据;Respectively extracting pixel data corresponding to the two adjacent frames of image;
将所述像素数据输入光流模型,计算不同权重参数对应的光流能量场;Inputting the pixel data into an optical flow model to calculate the optical flow energy field corresponding to different weight parameters;
对不同权重参数对应的光流能量场进行分类,基于分类结果确定所述目标对象所在目标场景下的目标权重参数;Classifying the optical flow energy fields corresponding to different weight parameters, and determining the target weight parameter of the target object in the target scene based on the classification result;
基于所述光流模型和所述目标权重参数,计算得到目标对象的运动状态。Based on the optical flow model and the target weight parameter, the motion state of the target object is calculated.
可选地,所述对不同权重参数对应的光流能量场进行分类,基于分类结果确定所述目标对象所在目标场景下的目标权重参数,包括:Optionally, the classifying the optical flow energy fields corresponding to different weight parameters and determining the target weight parameter of the target object in the target scene based on the classification result includes:
对不同权重参数对应的光流能量场进行聚类得到急速下降区、转折区和平稳区;The optical flow energy fields corresponding to different weight parameters are clustered to obtain the rapid decline area, turning area and stable area;
将转折区聚类中心对应的权重参数确定为所述目标对象所在目标场景下的目标权重参数。The weight parameter corresponding to the turning zone cluster center is determined as the target weight parameter in the target scene where the target object is located.
可选地,所述基于所述光流模型和所述目标权重参数,计算得到目标对象的运动状态,包括:Optionally, the calculating the motion state of the target object based on the optical flow model and the target weight parameter includes:
将所述像素数据输入光流模型,进行金字塔滤波处理,得到第一滤波图像和第二滤波图像;Inputting the pixel data into an optical flow model and performing pyramid filtering to obtain a first filtered image and a second filtered image;
基于所述目标权重参数、所述第一滤波图像和所述第二滤波图像,进行金字塔分层采样,分别得到第一图像和第二图像;Based on the target weight parameter, the first filtered image and the second filtered image, pyramid layered sampling is performed to obtain a first image and a second image respectively;
基于所述目标权重系数、所述第一图像和所述第二图像,计算得到光流矢量结果;Calculate an optical flow vector result based on the target weight coefficient, the first image, and the second image;
根据所述光流矢量结果确定所述目标对象的运动状态。The motion state of the target object is determined according to the optical flow vector result.
可选地,所述根据所述光流矢量结果确定所述目标对象的运动状态,包括:Optionally, determining the motion state of the target object according to the optical flow vector result includes:
当所述光流矢量结果大于预设阈值时,判定所述目标对象为运动状态;When the optical flow vector result is greater than a preset threshold, determining that the target object is in motion;
当所述光流矢量结果不大于预设阈值时,判定所述目标对象为静止状态。When the optical flow vector result is not greater than a preset threshold, it is determined that the target object is in a stationary state.
可选地,所述方法还包括:Optionally, the method further comprises:
当所述目标对象为运动状态时,将所有达到阈值的所述光流矢量结果进行提取,得到目标对象的像素提取数据;When the target object is in motion, all the optical flow vector results reaching a threshold are extracted to obtain pixel extraction data of the target object;
基于所述目标对象的像素提取数据,将所述目标对象的运动位置在原始图像上进行标记。Based on the pixel extraction data of the target object, the moving position of the target object is marked on the original image.
可选地,所述基于所述目标对象的像素提取数据,将所述目标对象的运动位置在原始图像上进行标记,包括:Optionally, extracting data based on pixels of the target object and marking the moving position of the target object on the original image includes:
获取所述目标对象在原始图像的位置信息;Obtaining position information of the target object in the original image;
将所述原始图像的位置信息和所述目标对象的像素提取数据进行匹配,得到匹配结果;Matching the position information of the original image with the pixel extraction data of the target object to obtain a matching result;
基于匹配结果,将所述目标对象的运动位置从原始图像上进行标记。Based on the matching result, the moving position of the target object is marked on the original image.
可选地,所述方法还包括:Optionally, the method further comprises:
获取待检测场景图像;Acquire the scene image to be detected;
当所述待检测场景图像与所述目标场景图像一致时,将所述目标场景下的所述目标权重参数确定为所述待检测场景下的目标权重参数。When the to-be-detected scene image is consistent with the target scene image, the target weight parameter under the target scene is determined as the target weight parameter under the to-be-detected scene.
根据第二方面,本发明实施例提供了一种运动目标识别装置,所述装置包括:According to a second aspect, an embodiment of the present invention provides a moving target recognition device, the device comprising:
获取模块,用于获取目标场景的相邻两帧图像,所述目标场景包括目标对象;An acquisition module, used to acquire two adjacent frames of images of a target scene, wherein the target scene includes a target object;
提取模块,用于分别提取所述相邻两帧图像对应的像素数据;An extraction module, used for respectively extracting pixel data corresponding to the two adjacent frames of images;
第一计算模块,用于将所述像素数据输入光流模型,计算不同权重参数对应的光流能量场;A first calculation module, used for inputting the pixel data into an optical flow model to calculate the optical flow energy field corresponding to different weight parameters;
第二计算模块,用于对不同权重参数对应的光流能量场进行分类,基于分类结果确定所述目标对象所在目标场景下的目标权重参数;A second calculation module is used to classify the optical flow energy fields corresponding to different weight parameters, and determine the target weight parameter of the target scene where the target object is located based on the classification result;
第三计算模块,用于基于所述光流模型和所述目标权重参数,计算得到目标对象的运动状态。The third calculation module is used to calculate the motion state of the target object based on the optical flow model and the target weight parameter.
根据第三方面,本发明实施例提供了一种电子设备,包括:According to a third aspect, an embodiment of the present invention provides an electronic device, including:
存储器和处理器,所述存储器和所述处理器之间互相通信连接,所述存储器中存储有计算机指令,所述处理器通过执行所述计算机指令,从而执行第一方面,或者第一方面任意一种可选实施方式中所述的方法。A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the method described in the first aspect or any optional implementation manner of the first aspect by executing the computer instructions.
根据第四方面,本发明实施例提供了一种计算机可读存储介质,所述计算机可读存储介质存储有计算机指令,所述计算机指令用于使计算机执行第一方面,或者第一方面任意一种可选实施方式中所述的方法。According to a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the method described in the first aspect or any optional implementation manner of the first aspect.
本发明技术方案,具有如下优点:The technical solution of the present invention has the following advantages:
本发明提供的运动目标识别方法及装置,通过获取目标场景的相邻两帧图像,所述目标场景包括目标对象;分别提取所述相邻两帧图像对应的像素数据;将所述像素数据输入光流模型,计算不同权重参数对应的光流能量场;对不同权重参数对应的光流能量场进行分类,基于分类结果确定所述目标对象所在目标场景下的目标权重参数;基于所述光流模型和所述目标权重参数,计算得到目标对象的运动状态。通过将目标场景的相邻两帧图像的像素数据输入光流模型中,计算得到不同权重参数对应的光流能量场以及光流能量场的分类,基于分类结果确定目标对象所在的目标场景下的目标权重参数,从而针对不同的目标场景,实现对权重参数的灵活调节,基于光流模型和目标权重参数,计算得到目标对象的运动状态,在快速准确确定目标权重参数的基础上,不仅实现了对运动目标运动状态的精确识别,还进一步地提高了识别运动目标的效率。The moving target recognition method and device provided by the present invention obtain two adjacent frames of images of a target scene, wherein the target scene includes a target object; extract pixel data corresponding to the two adjacent frames of images respectively; input the pixel data into an optical flow model, calculate the optical flow energy field corresponding to different weight parameters; classify the optical flow energy field corresponding to different weight parameters, and determine the target weight parameter in the target scene where the target object is located based on the classification result; and calculate the motion state of the target object based on the optical flow model and the target weight parameter. By inputting the pixel data of the two adjacent frames of images of the target scene into the optical flow model, the optical flow energy field corresponding to different weight parameters and the classification of the optical flow energy field are calculated, and the target weight parameter in the target scene where the target object is located is determined based on the classification result, so as to realize flexible adjustment of the weight parameter for different target scenes, and calculate the motion state of the target object based on the optical flow model and the target weight parameter, and on the basis of quickly and accurately determining the target weight parameter, not only the accurate recognition of the motion state of the moving target is realized, but also the efficiency of identifying the moving target is further improved.
附图说明BRIEF DESCRIPTION OF THE DRAWINGS
为了更清楚地说明本发明具体实施方式或现有技术中的技术方案,下面将对具体实施方式或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图是本发明的一些实施方式,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
图1为本发明实施例的运动目标识别方法的流程图;FIG1 is a flow chart of a moving target recognition method according to an embodiment of the present invention;
图2为本发明实施例的运动目标识别方法的光流能量场与权重参数对应关系图;FIG2 is a diagram showing a corresponding relationship between an optical flow energy field and weight parameters of a moving target recognition method according to an embodiment of the present invention;
图3为本发明实施例的运动目标识别方法的监控目标对象示意图;3 is a schematic diagram of a monitoring target object of a moving target recognition method according to an embodiment of the present invention;
图4为本发明实施例的运动目标识别方法的光流场计算结果示意图;FIG4 is a schematic diagram of an optical flow field calculation result of a moving target recognition method according to an embodiment of the present invention;
图5为本发明实施例的运动目标识别方法的光流矢量计算结果图;FIG5 is a diagram showing the calculation results of optical flow vectors of a moving target recognition method according to an embodiment of the present invention;
图6为本发明实施例的运动目标识别方法的目标对象切割示意图;FIG6 is a schematic diagram of target object cutting of a moving target recognition method according to an embodiment of the present invention;
图7为本发明实施例的运动目标识别方法的算法流程框架图;FIG7 is a flowchart of an algorithm of a moving target recognition method according to an embodiment of the present invention;
图8为本发明实施例的运动目标识别方法的波形对比图;FIG8 is a waveform comparison diagram of a moving target recognition method according to an embodiment of the present invention;
图9为本发明实施例的运动目标识别方法的光流算法结果对比图;FIG9 is a comparison diagram of optical flow algorithm results of a moving target recognition method according to an embodiment of the present invention;
图10为本发明实施例的运动目标识别装置的结构示意图;FIG10 is a schematic diagram of the structure of a moving target recognition device according to an embodiment of the present invention;
图11为本发明实施例的一种电子设备的结构示意图。FIG. 11 is a schematic diagram of the structure of an electronic device according to an embodiment of the present invention.
具体实施方式DETAILED DESCRIPTION
下面将结合附图对本发明的技术方案进行清楚、完整地描述,显然,所描述的实施例是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。The technical solution of the present invention will be described clearly and completely below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
在本发明的描述中,需要说明的是,术语“中心”、“上”、“下”、“左”、“右”、“竖直”、“水平”、“内”、“外”等指示的方位或位置关系为基于附图所示的方位或位置关系,仅是为了便于描述本发明和简化描述,而不是指示或暗示所指的装置或元件必须具有特定的方位、以特定的方位构造和操作,因此不能理解为对本发明的限制。此外,术语“第一”、“第二”、“第三”仅用于描述目的,而不能理解为指示或暗示相对重要性。In the description of the present invention, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc., indicating the orientation or positional relationship, are based on the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as limiting the present invention. In addition, the terms "first", "second", and "third" are used for descriptive purposes only, and cannot be understood as indicating or implying relative importance.
在本发明的描述中,需要说明的是,除非另有明确的规定和限定,术语“安装”、“相连”、“连接”应做广义理解,例如,可以是固定连接,也可以是可拆卸连接,或一体地连接;可以是机械连接,也可以是电连接;可以是直接相连,也可以通过中间媒介间接相连,还可以是两个元件内部的连通,可以是无线连接,也可以是有线连接。对于本领域的普通技术人员而言,可以具体情况理解上述术语在本发明中的具体含义。In the description of the present invention, it should be noted that, unless otherwise clearly specified and limited, the terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be indirectly connected through an intermediate medium, it can also be the internal connection of two components, it can be a wireless connection, or it can be a wired connection. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
此外,下面所描述的本发明不同实施方式中所涉及的技术特征只要彼此之间未构成冲突就可以相互结合。In addition, the technical features involved in the different embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.
光流法是利用图像序列中像素在时间域上的变化以及相邻帧之间的相关性来找到上一帧跟当前帧之间存在的对应关系,从而计算出相邻帧之间物体的运动信息的一种计算方法,其中,基于梯度的光流计算方法中,以HS为基础原理的高精度变分光流计算方法和其衍生算法具有如下不足:The optical flow method is a calculation method that uses the changes in pixels in the time domain in the image sequence and the correlation between adjacent frames to find the corresponding relationship between the previous frame and the current frame, thereby calculating the motion information of objects between adjacent frames. Among the gradient-based optical flow calculation methods, the high-precision variational optical flow calculation method based on the HS principle and its derivative algorithms have the following shortcomings:
1)光流的求解是一个高度不适定的问题,使用基于纯强度的约束通常会导致欠定方程组,存在孔径问题;1) Solving optical flow is a highly ill-posed problem. Using pure intensity-based constraints usually leads to underdetermined equations and aperture problems.
2)基于HS理论的光流法鲁棒性差,无法精确处理光照变化场景、梯度较大边界区域的场景和多目标大位移场景;2) The optical flow method based on HS theory has poor robustness and cannot accurately handle scenes with changing illumination, scenes with large gradient boundary areas, and scenes with large displacement of multiple targets;
3)基于HS理论的光流法是计算稠密光流,效率一般不高;3) The optical flow method based on HS theory calculates dense optical flow, which is generally not very efficient;
4)基于HS理论的光流法受到平滑项权重参数影响较大,且调节困难,需要多次人工实验,适应性较差。4) The optical flow method based on HS theory is greatly affected by the weight parameters of the smoothing term and is difficult to adjust. It requires multiple manual experiments and has poor adaptability.
基于HS原理的光流变分模型,该基础模型由两大核心部分构成:数据项和平滑项,基础模型描述如下:The optical flow variational model based on the HS principle consists of two core parts: data term and smoothing term. The basic model is described as follows:
其中,E(u,v)为光流场计算结果;S为整个图像对应的像素数据集合;Ix为x方向的像素梯度变化值;Iy为y方向的像素梯度变化值;It为前后相邻两帧图像的像素梯度变化值;u,v分别为x方向、y方向的光流矢量;表示u的二阶拉普拉斯算子;表示v的二阶拉普拉斯算子。Among them, E(u,v) is the result of optical flow field calculation; S is the pixel data set corresponding to the entire image; Ix is the pixel gradient change value in the x direction; Iy is the pixel gradient change value in the y direction; It is the pixel gradient change value of the two adjacent frames; u and v are the optical flow vectors in the x and y directions respectively; represents the second-order Laplace operator of u; represents the second-order Laplacian of v.
针对以上问题,本发明实施例提供了一种运动目标识别方法,用于解决上述变分光流计算方法中的不足,通过改进模型中的数据项和平滑项实现相对快速、鲁棒且高精度的光流计算。In view of the above problems, an embodiment of the present invention provides a moving target recognition method for solving the deficiencies in the above-mentioned variational optical flow calculation method, and realizes relatively fast, robust and high-precision optical flow calculation by improving the data terms and smoothing terms in the model.
如图1所示,该运动目标识别方法具体包括如下步骤:As shown in FIG1 , the moving target recognition method specifically includes the following steps:
步骤S101:获取目标场景的相邻两帧图像,目标场景包括目标对象。Step S101: acquiring two adjacent frames of images of a target scene, where the target scene includes a target object.
具体地,在实际应用中,目标场景的图像可通过摄像头进行获取,但实际情况不限于此,目标场景和目标对象的图像可由任意图像采集设备获取,并将图像中的目标场景和目标对象进行分离,从而为后续对目标对象的运动状态进行精确识别奠定基础。Specifically, in practical applications, the image of the target scene can be acquired through a camera, but the actual situation is not limited to this. The images of the target scene and the target object can be acquired by any image acquisition device, and the target scene and the target object in the image can be separated, thereby laying the foundation for the subsequent accurate identification of the motion state of the target object.
本发明实施例提供的运动目标识别方法可应用于交通道路等场景,为获取目标对象的运动状态提供理论和图像技术支撑。The moving target recognition method provided by the embodiment of the present invention can be applied to scenes such as traffic roads, and provides theoretical and image technology support for obtaining the motion state of the target object.
步骤S102:分别提取相邻两帧图像对应的像素数据。Step S102: extracting pixel data corresponding to two adjacent frames of images respectively.
步骤S103:将像素数据输入光流模型,计算不同权重参数对应的光流能量场。Step S103: Input the pixel data into the optical flow model to calculate the optical flow energy field corresponding to different weight parameters.
具体地,在实际应用中,本发明实施例对光流变分模型基础模型进行了改进,改进后的TV-L1光流变分模型(即光流模型)如下所示:Specifically, in practical applications, the embodiment of the present invention improves the basic model of the optical flow variational model, and the improved TV-L 1 optical flow variational model (i.e., optical flow model) is as follows:
其中,E(u,v)为光流场计算结果;Gt是基于三角函数多项式展开的滤波器;Ω代表目标场景的范围;I0和I1分别为运动前后两帧图像;x=(px,py)T为图像上的某一像素点坐标;λ为平滑项的权重参数;即为表示u的二阶拉普拉斯算子;h(x)=[u(x),v(x)]T为待求解x、y两个方向上的光流矢量。Where E(u,v) is the result of optical flow calculation; Gt is a filter based on trigonometric polynomial expansion; Ω represents the range of the target scene; I0 and I1 are the two frames of images before and after the motion respectively; x = ( px , py ) T is the coordinate of a pixel point on the image; λ is the weight parameter of the smoothing term; That is represents the second-order Laplace operator of u; h(x)=[u(x),v(x)] T is the optical flow vector in the x and y directions to be solved.
针对基础模型中的平滑项:本发明实施例通过引入基于能量场分类的K-Means算法,从而使得模型具备自适应选择平滑项中权重系数的能力。具体地,在实际应用中,本发明实施例基于能量场分类的K-Means算法用于权重估计,但实际情况不限于此,为确定最优权重参数而进行算法类型和数量的改变,也在本发明实施例提供的运动目标识别方法的保护范围之内。采用基于能量场分类的K-Means算法用于权重估计,可弥补传统的采用大量实验确定权重参数的取值的方式,节约了大量的处理时间,在对于未知场景的权重参数选择时,通过对不同权重参数对应的光流能量场进行分析,快速确定适合当前场景的权重参数,从而在实现对运动目标运动状态的精确识别基础上,进一步提高识别运动目标的效率。Regarding the smoothing term in the basic model: the embodiment of the present invention introduces the K-Means algorithm based on energy field classification, so that the model has the ability to adaptively select the weight coefficient in the smoothing term. Specifically, in practical applications, the K-Means algorithm based on energy field classification in the embodiment of the present invention is used for weight estimation, but the actual situation is not limited to this. The changes in the type and number of algorithms to determine the optimal weight parameters are also within the protection scope of the moving target recognition method provided by the embodiment of the present invention. The use of the K-Means algorithm based on energy field classification for weight estimation can make up for the traditional method of using a large number of experiments to determine the value of the weight parameters, saving a lot of processing time. When selecting weight parameters for unknown scenes, the optical flow energy fields corresponding to different weight parameters are analyzed to quickly determine the weight parameters suitable for the current scene, thereby further improving the efficiency of identifying moving targets on the basis of achieving accurate identification of the motion state of the moving target.
步骤S104:对不同权重参数对应的光流能量场进行分类,基于分类结果确定目标对象所在目标场景下的目标权重参数。Step S104: classify the optical flow energy fields corresponding to different weight parameters, and determine the target weight parameter of the target scene where the target object is located based on the classification result.
具体地,在实际应用中,本发明实施例依据不同权重参数对应的常用场景的光流能量场进行分类,基于光流变分模型将多类光流能量场的分类情况进行确定,并根据目标场景和模型中常用场景进行比对,从而确定目标对象所在目标场景下的目标权重参数。Specifically, in practical applications, the embodiments of the present invention classify the optical flow energy fields of common scenes corresponding to different weight parameters, determine the classification of multiple types of optical flow energy fields based on the optical flow variational model, and compare the target scenes with the common scenes in the model to determine the target weight parameters of the target scene where the target object is located.
本发明实施例通过将不同权重参数与多常用场景的光流能量场进行比对匹配,确定适合当前常用场景的权重参数,当图像采集设备采集到的图像数据输入光流变分模型后,可直接通过比对目标场景、目标对象以及模型中存储的常用场景确定目标权重参数,实现权重参数在未知场景的自适应调节。The embodiment of the present invention determines the weight parameters suitable for the current common scenes by comparing and matching different weight parameters with the optical flow energy fields of multiple common scenes. After the image data collected by the image acquisition device is input into the optical flow variational model, the target weight parameters can be directly determined by comparing the target scene, target object and the common scenes stored in the model, thereby realizing adaptive adjustment of the weight parameters in unknown scenes.
步骤S105:基于光流模型和目标权重参数,计算得到目标对象的运动状态。Step S105: Based on the optical flow model and the target weight parameter, the motion state of the target object is calculated.
具体地,在实际应用中,本发明实施例基于光流变分模型和目标权重参数,对目标对象的像素数据进行计算,即可得到目标对象的运动状态,并将目标对象的运动情况进行显示。Specifically, in practical applications, the embodiments of the present invention calculate the pixel data of the target object based on the optical flow variational model and the target weight parameter, thereby obtaining the motion state of the target object and displaying the motion state of the target object.
通过执行上述步骤,本发明实施例提供的运动目标识别方法,通过获取目标场景的相邻两帧图像,目标场景包括目标对象;分别提取相邻两帧图像对应的像素数据;将像素数据输入光流模型,计算不同权重参数对应的光流能量场;对不同权重参数对应的光流能量场进行分类,基于分类结果确定目标对象所在目标场景下的目标权重参数;基于光流模型和目标权重参数,计算得到目标对象的运动状态。通过将目标场景的相邻两帧图像的像素数据输入光流模型中,计算得到不同权重参数对应的光流能量场以及光流能量场的分类,基于分类结果确定目标对象所在的目标场景下的目标权重参数,从而针对不同的目标场景,实现对权重参数的灵活调节,基于光流模型和目标权重参数,计算得到目标对象的运动状态,在快速准确确定目标权重参数的基础上,不仅实现了对运动目标运动状态的精确识别,还进一步地提高了识别运动目标的效率。By executing the above steps, the moving target recognition method provided by the embodiment of the present invention obtains two adjacent frames of images of the target scene, and the target scene includes the target object; extracts the pixel data corresponding to the two adjacent frames of images respectively; inputs the pixel data into the optical flow model, and calculates the optical flow energy field corresponding to different weight parameters; classifies the optical flow energy field corresponding to different weight parameters, and determines the target weight parameter in the target scene where the target object is located based on the classification result; and calculates the motion state of the target object based on the optical flow model and the target weight parameter. By inputting the pixel data of the two adjacent frames of images of the target scene into the optical flow model, the optical flow energy field corresponding to different weight parameters and the classification of the optical flow energy field are calculated, and the target weight parameter in the target scene where the target object is located is determined based on the classification result, so as to realize flexible adjustment of the weight parameter for different target scenes, and calculate the motion state of the target object based on the optical flow model and the target weight parameter, and on the basis of quickly and accurately determining the target weight parameter, not only the accurate recognition of the motion state of the moving target is realized, but also the efficiency of identifying the moving target is further improved.
具体地,在一实施例中,上述步骤S104对不同权重参数对应的光流能量场进行分类,基于分类结果确定目标对象所在目标场景下的目标权重参数,具体包括如下步骤:Specifically, in one embodiment, the above step S104 classifies the optical flow energy fields corresponding to different weight parameters, and determines the target weight parameter of the target scene where the target object is located based on the classification result, which specifically includes the following steps:
步骤S201:对不同权重参数对应的光流能量场进行聚类得到急速下降区、转折区和平稳区。Step S201: clustering the optical flow energy fields corresponding to different weight parameters to obtain a rapid drop area, a turning area and a stable area.
步骤S202:将转折区聚类中心对应的权重参数确定为目标对象所在目标场景下的目标权重参数。Step S202: Determine the weight parameter corresponding to the turning zone cluster center as the target weight parameter in the target scene where the target object is located.
具体地,在实际应用中,本发明实施例基于光流变分模型对权重参数进行训练和确定,并采用多种常用场景对不同权重参数的光流能量场进行分类,基于分类结果确定目标对象所在目标场景下的目标权重参数,为后续直接将待检测场景与目标场景进行比对,从而大幅缩短权重参数的选择处理时间,快速确定目标权重参数奠定基础。Specifically, in practical applications, the embodiments of the present invention train and determine the weight parameters based on the optical flow variational model, and adopt a variety of common scenarios to classify the optical flow energy fields of different weight parameters, and determine the target weight parameters of the target object in the target scene based on the classification results, so as to directly compare the scene to be detected with the target scene, thereby greatly shortening the selection and processing time of the weight parameters and laying the foundation for quickly determining the target weight parameters.
具体地,基于能量场分类的K-Means算法用于权重估计通过三步实现:能量场的计算>能量场有效数据筛选>K-Means实现权重参数自适应选择。Specifically, the K-Means algorithm based on energy field classification is used for weight estimation through three steps: calculation of energy field > screening of effective data of energy field > adaptive selection of weight parameters by K-Means.
具体地,针对不同应用场景,本发明实施例以四种常用场景为例,选取了四组图像序列,对各场景的权重参数的确定过程进行解释说明,但实际情况不限于此,实际情况可根据此过程进行训练和确定,在此不再进行赘述。Specifically, for different application scenarios, the embodiment of the present invention takes four common scenarios as examples, selects four groups of image sequences, and explains the process of determining the weight parameters of each scene. However, the actual situation is not limited to this. The actual situation can be trained and determined according to this process, which will not be repeated here.
具体地,本发明实施例的四组图像序列分别为“Army-Group1、Mequon-Group2、Evergreen-Group3、Basketball-Group4”,不同图像序列在不同λ时所对应的能量场分布如图2所示。可以看出,虽然图像序列不同,能量场与λ也不同,但相同的是能量曲线的趋势,可以将不同λ对应的能量场分为三类:急速下降区、转折区和平稳区,又因为转折区所代表的光流场密度大且噪声水平低,因此可通过K-Means的方法对能量场进行分类,具体过程如下:Specifically, the four groups of image sequences in the embodiment of the present invention are "Army-Group1, Mequon-Group2, Evergreen-Group3, Basketball-Group4", and the energy field distribution corresponding to different image sequences at different λ is shown in Figure 2. It can be seen that although the image sequences are different, the energy fields and λ are also different, but the same is the trend of the energy curve. The energy fields corresponding to different λ can be divided into three categories: rapid decline area, turning area and stable area. Because the optical flow field represented by the turning area has a large density and a low noise level, the energy field can be classified by the K-Means method. The specific process is as follows:
①数据归一化,通过预处理的方法统一不同图像序列的数据,便于后续的比较。① Data normalization: unify the data of different image sequences through preprocessing methods to facilitate subsequent comparison.
②选择初始化的k个样本作为初始的聚类中心,k为能量场分类结果,即k=3,即ai=a1,a2,a3,其中,ai为第i个聚类中心,i=1,2,3。② Select the initialized k samples as the initial clustering centers, k is the energy field classification result, that is, k = 3, that is, a i = a 1 , a 2 , a 3 , where a i is the i-th clustering center, i = 1, 2, 3.
③根据每个λi的能量场,计算到k个聚类中心的距离,并将其分到距离最小的聚类中心所对应的类中。③ According to the energy field of each λ i , calculate the distance to the k cluster centers and divide them into the class corresponding to the cluster center with the smallest distance.
④针对每个ai,重新计算聚类中心其中,x为权重参数λ的样本数据;ci为第i簇样本。④ For each a i , recalculate the cluster center Among them, x is the sample data of weight parameter λ; ci is the i-th cluster sample.
具体地,如图2所示,c1、c2和c3分别表示不同λ对应的三类能量场的聚类集合,即急速下降区权重参数样本数据集合、转折区权重参数样本数据集合和平稳区权重参数样本数据集合,示例性地,本发明实施例以c1为急速下降区权重参数集合、c2表示转折区权重参数集合、c3表示平稳区权重参数集合为例进行说明,但实际情况不限于此,ci与能量场的对应情况可根据实际需要进行变化。Specifically, as shown in FIG2 , c1 , c2 , and c3 respectively represent cluster sets of three types of energy fields corresponding to different λ, namely, a set of sample data of weight parameters in a rapid decline zone, a set of sample data of weight parameters in a turning zone, and a set of sample data of weight parameters in a stable zone. Exemplarily, the embodiment of the present invention takes c1 as a set of weight parameters in a rapid decline zone, c2 as a set of weight parameters in a turning zone, and c3 as a set of weight parameters in a stable zone as an example for explanation, but the actual situation is not limited thereto, and the correspondence between c1 and the energy field may be changed according to actual needs.
⑤设置终止条件,这里为限制迭代次数,重复③-④步骤直至分出急速下降区、转折区和平稳区。⑤Set the termination condition, which is to limit the number of iterations here, and repeat steps ③-④ until the rapid decline area, turning area and stable area are separated.
⑥以转折区聚类中心作为转折区的最优解作为输出。⑥ Take the turning zone cluster center as the optimal solution of the turning zone as output.
本发明实施例通过①-⑥过程,即可实现权重参数λ的自适应选取,且该分类方法效率较高。The embodiment of the present invention can realize the adaptive selection of the weight parameter λ through the processes ①-⑥, and the classification method is highly efficient.
聚类的中心代表了同类别数据的分布,是一类数据的代表,在本发明实施例中,转折区域即为能量特征变换快的区域,而聚类中心最能代表和体现图像的能量特征,采用转折区聚类中心数值作为权重参数,可充分体现目标场景与目标对象的能量特征,实现对目标对象运动状态的精确精准识别。The center of the cluster represents the distribution of data of the same category and is the representative of a type of data. In an embodiment of the present invention, the turning area is the area where the energy characteristics change rapidly, and the cluster center can best represent and reflect the energy characteristics of the image. Using the turning area cluster center value as the weight parameter can fully reflect the energy characteristics of the target scene and the target object, and realize accurate and precise identification of the motion state of the target object.
本发明实施例采用的聚类方法参照现有技术中的聚类计算过程的相关描述,在此不再进行赘述。The clustering method adopted in the embodiment of the present invention refers to the relevant description of the clustering calculation process in the prior art, which will not be described in detail here.
具体地,在一实施例中,上述步骤S104具体还包括如下步骤:Specifically, in one embodiment, the above step S104 further includes the following steps:
步骤S301:获取待检测场景图像。Step S301: Acquire an image of a scene to be detected.
步骤S302:当待检测场景图像与目标场景图像一致时,将目标场景下的目标权重参数确定为待检测场景下的目标权重参数。Step S302: When the image of the scene to be detected is consistent with the image of the target scene, the target weight parameters of the target scene are determined as the target weight parameters of the scene to be detected.
具体地,在实际应用中,当光流变分模型训练好后,将待检测场景图像的像素数据输入至光流变分模型后,会首先对光流变分模型中的目标场景图像进行对比,当待检测场景图像与目标场景图像一致时,将目标场景下的目标权重参数确定为待检测场景下的目标权重参数,从而避免重复计算权重参数的过程,大幅提高运动目标的检测效率。Specifically, in practical applications, after the optical flow variational model is trained, after the pixel data of the scene image to be detected is input into the optical flow variational model, the target scene image in the optical flow variational model will be compared first. When the scene image to be detected is consistent with the target scene image, the target weight parameters under the target scene are determined as the target weight parameters under the scene to be detected, thereby avoiding the process of repeatedly calculating the weight parameters and greatly improving the detection efficiency of moving targets.
具体地,在一实施例中,上述步骤S105基于光流模型和目标权重参数,计算得到目标对象的运动状态,具体包括如下步骤:Specifically, in one embodiment, the above step S105 calculates the motion state of the target object based on the optical flow model and the target weight parameter, and specifically includes the following steps:
步骤S401:将所述像素数据输入光流模型,进行金字塔滤波处理,得到第一滤波图像和第二滤波图像。Step S401: inputting the pixel data into an optical flow model and performing pyramid filtering to obtain a first filtered image and a second filtered image.
具体地,在实际应用中,本发明实施例通过将像素数据输入光流变分模型中,进行金字塔分层处理,即下采样处理,下采样处理包括滤波和修改图像尺寸。Specifically, in practical applications, the embodiments of the present invention perform pyramid layering processing, namely downsampling processing, by inputting pixel data into an optical flow variational model. The downsampling processing includes filtering and modifying the image size.
具体地,相较于传统的采用高斯滤波器的金字塔方法,本发明实施例为保证目标图像以及目标对象的边缘清晰,使用了优化后的双边滤波器,优化后的双边滤波器结构中包括高斯滤波过程,因此可以充分保留传统高斯滤波器优势的同时,进一步地提高滤波效果。此外,为加快双边滤波的计算速度,本发明实施例采用O(1)复杂度三角函数多项式逼近代替双边滤波中的高斯滤波器结构,从而在大幅提升计算效率的同时,还增强了目标检测边缘清晰能力。Specifically, compared to the traditional pyramid method using Gaussian filter, the embodiment of the present invention uses an optimized bilateral filter to ensure the edge clarity of the target image and the target object. The optimized bilateral filter structure includes a Gaussian filtering process, so that the advantages of the traditional Gaussian filter can be fully retained while further improving the filtering effect. In addition, in order to speed up the calculation speed of the bilateral filtering, the embodiment of the present invention uses an O(1) complexity trigonometric function polynomial approximation to replace the Gaussian filter structure in the bilateral filtering, thereby greatly improving the calculation efficiency and enhancing the edge clarity capability of the target detection.
本发明实施例针对基础模型中数据项的优化包括:①积分项外层引入滤波器,通常情况下选用高斯滤波器,并采用三角函数多项式展开替代该高斯滤波器,实现滤波复杂度由O(n2)降至O(1),同时提高模型抗噪能力和对光照变换的抗干扰能力;②将数据项中的二阶罚函数改为一阶,使得光流计算在梯度变化较大的处保持清晰的边缘。The optimization of the data items in the basic model in the embodiment of the present invention includes: ① introducing a filter in the outer layer of the integral term, usually a Gaussian filter is selected, and the Gaussian filter is replaced by a trigonometric function polynomial expansion to reduce the filtering complexity from O(n2) to O(1), while improving the model's anti-noise ability and anti-interference ability to illumination changes; ② changing the second-order penalty function in the data item to the first order, so that the optical flow calculation maintains clear edges in places where the gradient changes are large.
步骤S402:基于所述目标权重参数、所述第一滤波图像和所述第二滤波图像,进行金字塔分层采样,分别得到第一图像和第二图像。Step S402: performing pyramid hierarchical sampling based on the target weight parameter, the first filtered image and the second filtered image to obtain a first image and a second image respectively.
具体地,关于修改图像尺寸处理过程,本发明实施例将输入的两帧图像的长和宽分别进行缩小,示例性地,可缩小为原尺寸的一半,即整体缩小4倍(下采样的层数可根据图像尺寸进行人工设置,一般为3-5层),从而得到原始尺寸的第一图像和缩小后的第二图像。Specifically, regarding the process of modifying the image size, the embodiment of the present invention reduces the length and width of the two input frames of images respectively. Exemplarily, it can be reduced to half of the original size, that is, the overall reduction is 4 times (the number of downsampling layers can be manually set according to the image size, generally 3-5 layers), thereby obtaining a first image of the original size and a reduced second image.
金字塔分层算法可以使两帧图像从最低分辨率开始进行目标检测,再逐渐投影至原始分辨率,因此,即使最初输入的不是相邻的两帧图像,比如输入的是第一帧和第五帧图像,通过金字塔分层算法,可由低分辨率图像完成目标检测后,往高分辨率投影即可成功求解大位移(即跳帧检测)的问题。The pyramid layering algorithm can make two frames of images start from the lowest resolution for target detection and then gradually project them to the original resolution. Therefore, even if the initial input is not two adjacent frames of images, for example, the first frame and the fifth frame of images are input, the pyramid layering algorithm can complete the target detection from the low-resolution image and then project it to the high-resolution image to successfully solve the problem of large displacement (i.e., frame skipping detection).
步骤S403:基于所述目标权重系数、所述第一图像和所述第二图像,计算得到光流矢量结果。Step S403: Calculate and obtain an optical flow vector result based on the target weight coefficient, the first image, and the second image.
具体地,在实际应用中,本发明实施例依据公式(2),通过目标权重参数λ、第一图像以及第二图像进行计算,从而得到目标对象的光流矢量结果,其中,光流矢量结果包括光流方向和光流位移信息。Specifically, in practical applications, the embodiment of the present invention calculates the optical flow vector result of the target object based on formula (2) through the target weight parameter λ, the first image and the second image, wherein the optical flow vector result includes the optical flow direction and the optical flow displacement information.
通过对光流算法进行优化,本发明实施例采用三角函数多项式代替高斯滤波器的方式,降低了算法复杂度;通过对目标权重参数进行有效确定,保证了光流场以及光流矢量计算结果的准确性。By optimizing the optical flow algorithm, the embodiment of the present invention adopts trigonometric function polynomials instead of Gaussian filters to reduce the complexity of the algorithm; by effectively determining the target weight parameters, the accuracy of the optical flow field and the optical flow vector calculation results is guaranteed.
步骤S404:根据光流矢量结果确定目标对象的运动状态。Step S404: determining the motion state of the target object according to the optical flow vector result.
具体地,在实际应用中,本发明实施例将光流矢量结果在目标对象上进行有效显示,从而不仅可以实现对目标对象运动状态的确定,还可以对目标对象的运动趋势进行一定的预测,更具有预测前瞻性。Specifically, in practical applications, the embodiments of the present invention effectively display the optical flow vector results on the target object, thereby not only being able to determine the motion state of the target object, but also being able to make certain predictions about the motion trend of the target object, and being more forward-looking.
具体地,在一实施例中,上述步骤S404具体包括如下步骤:Specifically, in one embodiment, the above step S404 specifically includes the following steps:
步骤S501:当光流矢量结果大于预设阈值时,判定目标对象为运动状态。Step S501: When the optical flow vector result is greater than a preset threshold, the target object is determined to be in motion.
步骤S502:当光流矢量结果不大于预设阈值时,判定目标对象为静止状态。Step S502: When the optical flow vector result is not greater than a preset threshold, the target object is determined to be stationary.
具体地,在实际应用中,为更好地将目标对象的运动状态进行快速确定,本发明实施例通过设定预设阈值,当光流矢量结果大于预设阈值时,判定目标对象为运动状态;当光流矢量结果不大于预设阈值时,判定目标对象为静止状态,预设阈值的数值可根据实际情况进行设定,从而满足不同用户的使用需求。Specifically, in practical applications, in order to quickly determine the motion state of the target object, the embodiment of the present invention sets a preset threshold. When the optical flow vector result is greater than the preset threshold, the target object is judged to be in motion; when the optical flow vector result is not greater than the preset threshold, the target object is judged to be stationary. The value of the preset threshold can be set according to actual conditions to meet the usage requirements of different users.
具体地,在一实施例中,在执行上述步骤S501判定目标对象为运动状态后,具体还包括如下步骤:Specifically, in one embodiment, after executing the above step S501 to determine that the target object is in motion, the following steps are further included:
步骤S601:当目标对象为运动状态时,将所有达到阈值的光流矢量结果进行提取,得到目标对象的像素提取数据。Step S601: when the target object is in motion, all optical flow vector results reaching a threshold are extracted to obtain pixel extraction data of the target object.
步骤S602:基于目标对象的像素提取数据,将目标对象的运动位置在原始图像上进行标记。Step S602: extracting data based on the pixels of the target object and marking the moving position of the target object on the original image.
示例性地,结合图3-图5所示,本发明实施例首先通过监控视频获取相邻两帧图像;将两帧图像输入光流变分模型中,得到目标场景下目标对象的光流场计算结果,如图4所示,横坐标0-639像素和640-1280像素分别表示x方向(即u方向)和y方向(即v方向)的流场;根据公式(2)计算得到目标对象的光流矢量计算结果,通过将光流矢量结果图进行放大(如图5中右图所示),可对目标对象各位置坐标的运动方向和运动位移进行准确显示,根据图5可以看出目标运动幅度越大,矢量值越高;进一步地,如图6所示,当确定目标对象为运动状态后,本发明实施例还可根据光流场计算结果以及光流矢量计算结果,确定原视频图像内目标场景下的目标对象位置,并将其与目标场景进行分割,进行标记显示。Exemplarily, in combination with FIG. 3-FIG. 5, the embodiment of the present invention first obtains two adjacent frames of images through monitoring video; the two frames of images are input into the optical flow variational model to obtain the optical flow field calculation result of the target object in the target scene, as shown in FIG. 4, the horizontal coordinates 0-639 pixels and 640-1280 pixels represent the flow field in the x direction (i.e., u direction) and the y direction (i.e., v direction), respectively; the optical flow vector calculation result of the target object is calculated according to formula (2), and by enlarging the optical flow vector result diagram (as shown in the right figure in FIG. 5), the motion direction and motion displacement of each position coordinate of the target object can be accurately displayed. According to FIG. 5, it can be seen that the larger the target motion amplitude, the higher the vector value; further, as shown in FIG. 6, after determining that the target object is in a moving state, the embodiment of the present invention can also determine the position of the target object in the target scene in the original video image according to the optical flow field calculation result and the optical flow vector calculation result, and segment it from the target scene for marking and display.
本发明实施例通过获取相邻两帧图像,将图像的像素数据输入光流变分模型,通过目标场景对应的目标权重参数对像素数据进行处理,分别得到光流场计算结果和光流矢量计算结果,用户通过光流矢量局部放大图可以对目标对象的运动方向以及运动位移进行直观查看,不仅大幅提高对目标对象(即运动目标)运动状态的识别,还可对目标对象的运动趋势进行一定的预测,满足用户需求,在此基础上,本发明实施例还可将目标对象与目标场景进行分割,并将目标对象在目标场景中的位置进行着重标记,从而便于用户快速确定原始图像中的目标对象的位置。The embodiment of the present invention obtains two adjacent frames of images, inputs the pixel data of the images into the optical flow variational model, processes the pixel data through the target weight parameters corresponding to the target scene, and obtains the optical flow field calculation results and the optical flow vector calculation results respectively. The user can intuitively view the movement direction and movement displacement of the target object through the local magnified image of the optical flow vector, which not only greatly improves the recognition of the movement state of the target object (i.e., the moving target), but also can make a certain prediction on the movement trend of the target object to meet the needs of the user. On this basis, the embodiment of the present invention can also segment the target object from the target scene, and emphasize the position of the target object in the target scene, so as to facilitate the user to quickly determine the position of the target object in the original image.
具体地,在一实施例中,上述步骤S602基于目标对象的像素提取数据,将目标对象的运动位置在原始图像上进行标记,具体包括如下步骤:Specifically, in one embodiment, the above step S602 extracts data based on the pixels of the target object and marks the moving position of the target object on the original image, which specifically includes the following steps:
步骤S701:获取目标对象在原始图像的位置信息。Step S701: Obtain the position information of the target object in the original image.
步骤S702:将原始图像的位置信息和目标对象的像素提取数据进行匹配,得到匹配结果。Step S702: Match the position information of the original image with the pixel extraction data of the target object to obtain a matching result.
步骤S703:基于匹配结果,将目标对象的运动位置从原始图像上进行标记。Step S703: Based on the matching result, the moving position of the target object is marked on the original image.
具体地,在实际应用中,通过获取目标对象在原始图像的位置信息,并与光流变分模型中目标对象的像素提取数据进行匹配,基于匹配结果,将目标对象的运动位置从原始图像上进行标记,从而在快速判定目标对象运动状态的同时,便于用户快速确定原始图像中的目标对象的位置。Specifically, in practical applications, by obtaining the position information of the target object in the original image and matching it with the pixel extraction data of the target object in the optical flow variational model, the motion position of the target object is marked on the original image based on the matching result, thereby quickly determining the motion state of the target object and facilitating the user to quickly determine the position of the target object in the original image.
通过执行上述步骤,本发明实施例提供的运动目标识别方法,通过将目标场景的相邻两帧图像的像素数据输入光流模型中,计算得到不同权重参数对应的光流能量场以及光流能量场的分类,基于分类结果确定目标对象所在的目标场景下的目标权重参数,从而针对不同的目标场景,实现对权重参数的灵活调节,基于光流模型和目标权重参数,计算得到目标对象的运动状态,在快速准确确定目标权重参数的基础上,不仅实现了对运动目标运动状态的精确识别,还进一步地提高了识别运动目标的效率。By executing the above steps, the moving target recognition method provided by the embodiment of the present invention inputs the pixel data of two adjacent frames of the target scene into the optical flow model, calculates the optical flow energy field corresponding to different weight parameters and the classification of the optical flow energy field, and determines the target weight parameters in the target scene where the target object is located based on the classification result, thereby realizing flexible adjustment of the weight parameters for different target scenes, and calculating the motion state of the target object based on the optical flow model and the target weight parameters. On the basis of quickly and accurately determining the target weight parameters, not only the accurate recognition of the motion state of the moving target is realized, but also the efficiency of identifying the moving target is further improved.
下面将结合具体应用示例,对本发明实施例提供的运动目标识别方法进行详细的说明。The moving target recognition method provided by the embodiment of the present invention will be described in detail below with reference to specific application examples.
结合图1-图8所示,本发明实施例分别对基础模型(公式(1))进行优化,具体描述如下:In conjunction with FIG. 1 to FIG. 8 , the embodiments of the present invention optimize the basic model (Formula (1)) respectively, as described in detail as follows:
1)针对数据项:①积分项外层引入滤波器,通常情况下选用高斯滤波器,并采用三角函数多项式展开替代该高斯滤波器,实现滤波复杂度由O(n2)降至O(1),同时提高模型抗噪能力和对光照变换的抗干扰能力;②将数据项中的二阶罚函数改为一阶,使得光流计算在梯度变化较大的处保持清晰的边缘;1) For the data item: ① Introduce a filter in the outer layer of the integral item. Usually, a Gaussian filter is selected, and the trigonometric function polynomial expansion is used to replace the Gaussian filter to reduce the filtering complexity from O(n 2 ) to O(1), while improving the model's anti-noise ability and anti-interference ability to illumination changes; ② Change the second-order penalty function in the data item to the first order, so that the optical flow calculation maintains clear edges in places where the gradient changes are large;
2)针对平滑项:引入基于能量场分类的K-Means算法,从而使得模型具备自适应选择平滑项中权重系数的能力;2) For smooth terms: the K-Means algorithm based on energy field classification is introduced, so that the model has the ability to adaptively select weight coefficients in smooth terms;
3)针对模型整体:引入优化后的双边滤波算法与金字塔分层算法,在金字塔构造多级分辨率图像时,使用优化后的双边滤波器进行滤波后再进行降采样,从而能够使所求解的光流场中物体边缘保持高精度的光流估计。此外,优化后的双边滤波算法中所设计的高斯项可直接使用1)中的三角函数多项式展开替代该高斯项,实现算法复用。3) For the whole model: introduce the optimized bilateral filtering algorithm and pyramid layering algorithm. When constructing a multi-level resolution image in the pyramid, use the optimized bilateral filter for filtering and then downsample, so that the edge of the object in the solved optical flow field can maintain high-precision optical flow estimation. In addition, the Gaussian term designed in the optimized bilateral filtering algorithm can be directly replaced by the trigonometric function polynomial expansion in 1) to achieve algorithm reuse.
改进后的TV-L1光流变分模型如公式(2)所示,在此不再进行赘述。The improved TV- L1 optical flow variational model is shown in formula (2) and will not be described in detail here.
本发明实施例通过三大核心步骤进行实现,如图7所示,具体描述如下:The embodiment of the present invention is implemented through three core steps, as shown in FIG7 , which are specifically described as follows:
1)数据项优化1) Data item optimization
在传统基于HS模型的光流法中,其数据项为L2罚函数,该项会造成能量守恒假设误差的非线性放大且会影响流场边缘。为了增加数据项流场估计的鲁棒性,本发明在数据项引入L1非平方罚函数。同时为了保证数据项流场估计的精度,在积分项外层加入一种优化的滤波器。通常情况下,高斯滤波器为常规的选择,但在基于HS模型的光流估计方法中,由于HS隶属于稠密光流计算的范畴,本身效率就不具备优势,如果依然采用传统的滤波器,其卷积过程会造成程序执行成时间的增加,降低实时性。为此,本发明实施例引入一种三角函数多项式展开来逼近高斯滤波,使其在指定阶数时能够具备与高斯滤波器相似的性能。该滤波器的表达形式为:In the traditional optical flow method based on the HS model, the data item is an L2 penalty function, which will cause nonlinear amplification of the error of the energy conservation assumption and affect the edge of the flow field. In order to increase the robustness of the data item flow field estimation, the present invention introduces an L1 non-square penalty function in the data item. At the same time, in order to ensure the accuracy of the data item flow field estimation, an optimized filter is added to the outer layer of the integral term. Under normal circumstances, the Gaussian filter is a conventional choice, but in the optical flow estimation method based on the HS model, since HS belongs to the category of dense optical flow calculation, its efficiency itself does not have an advantage. If the traditional filter is still used, its convolution process will cause the program execution time to increase and reduce real-time performance. To this end, the embodiment of the present invention introduces a trigonometric function polynomial expansion to approximate the Gaussian filter, so that it can have similar performance to the Gaussian filter when the order is specified. The expression of the filter is:
式中,t为当前时刻,t∈[-T,T];λ=π/2T,T为所处理图像序列当前帧像素的动态范围;N为多项式的阶数,N=2,3,…,i;i为总阶数,i∈[0+∞]。一般情况下,当N足够大时,会存在如下近似:Where t is the current time, t∈[-T, T]; λ=π/2T, T is the dynamic range of the pixels in the current frame of the processed image sequence; N is the order of the polynomial, N=2, 3, …, i; i is the total order, i∈[0+∞]. In general, when N is large enough, the following approximation exists:
式中,cos(*)为余弦三角函数,在形式上转换为高斯函数的表达形式,其中cos(*)的定义域为[-π/2,π/2];其中,σ为高斯函数的标准差,ρ为近似处理过程中产生的比例因子。图8给出了三角函数多项式的函数曲线与高斯函数的曲线对比图,可以看出,在一定条件下,随着阶数N的提高,虚线的波形越来越接近实线的波形,即三角函数多项式的波形越来越接近高斯曲线。实验证明,当N=4时,可以很好地逼近高斯曲线,从而实现替换。由于二维的高斯函数在编码过程中是通过双层循环来实现的,其复杂度为O(n2),替换为三角函数多项式后,可将乘法变为加法,从而将复杂度降至O(1)。此外,在编码实现过程中,对于所处理图像像素的加法和乘法,本发明实施例采用指令集的方法进行加速,如SSE指令集,利用128位寄存器,单次读入8个像素值,进行加或乘的操作,再进行保存,从而提升执行效率。Where cos(*) is the cosine trigonometric function, which is formally converted into the expression of the Gaussian function, where the domain of cos(*) is [-π/2, π/2]; Among them, σ is the standard deviation of the Gaussian function, and ρ is the scale factor generated during the approximate processing. Figure 8 shows a comparison diagram of the function curve of the trigonometric polynomial and the curve of the Gaussian function. It can be seen that under certain conditions, as the order N increases, the waveform of the dotted line is getting closer and closer to the waveform of the solid line, that is, the waveform of the trigonometric polynomial is getting closer and closer to the Gaussian curve. Experiments have shown that when N=4, the Gaussian curve can be well approximated, thereby achieving replacement. Since the two-dimensional Gaussian function is implemented through a double-layer loop during the encoding process, its complexity is O(n 2 ). After being replaced by a trigonometric polynomial, multiplication can be converted into addition, thereby reducing the complexity to O(1). In addition, during the encoding implementation process, for the addition and multiplication of the processed image pixels, the embodiment of the present invention adopts an instruction set method for acceleration, such as the SSE instruction set, which uses a 128-bit register to read 8 pixel values at a time, perform addition or multiplication operations, and then save them, thereby improving execution efficiency.
2)平滑项优化2) Smoothness Optimization
在平滑项中涉及到一个关键参数,即为式(2)中的λ,代表平滑项的权重参数,该参数的选择会影响整个流场的估计精度。示例性地,当λ取50、100和180时,在u和v方向的光流估计场存在差别,因此,该权重参数对精度的影响较大。传统的方法是通过先验知识或大量实验确定模型中的权重参数的取值,这些方法在面对未知场景中就显得不太适用,且浪费了大量时间,因此,本发明实施例引入一种基于能量场分类的K-Means算法用于权重估计,用以解决上述问题。A key parameter is involved in the smoothing term, namely, λ in formula (2), which represents the weight parameter of the smoothing term. The selection of this parameter will affect the estimation accuracy of the entire flow field. For example, when λ is 50, 100 and 180, there are differences in the optical flow estimation fields in the u and v directions. Therefore, the weight parameter has a greater impact on the accuracy. The traditional method is to determine the value of the weight parameter in the model through prior knowledge or a large number of experiments. These methods are not very applicable in the face of unknown scenes and waste a lot of time. Therefore, the embodiment of the present invention introduces a K-Means algorithm based on energy field classification for weight estimation to solve the above problem.
3)流场边缘与大位移优化3) Flow field edge and large displacement optimization
经过“1)数据项优化”和“2)平滑项优化”即可实现同一尺度下微位移的变分光流场的高精度估计,然而在实际应用中,如果待测物体运动较大或某一时刻光照变化剧烈时,仅依靠上述“1)数据项优化”和“2)平滑项优化”的过程无法得出光流场的准确估计且梯度变化处物体的边缘较为模糊,无法进行准确的光流场数值计算。因此,就需要流场边缘和大位移优化方法的介入。After "1) data term optimization" and "2) smooth term optimization", high-precision estimation of variational optical flow field with micro-displacement at the same scale can be achieved. However, in practical applications, if the object to be measured moves greatly or the illumination changes dramatically at a certain moment, the above "1) data term optimization" and "2) smooth term optimization" processes alone cannot accurately estimate the optical flow field, and the edges of the objects at the gradient changes are relatively blurred, making it impossible to perform accurate numerical calculations of the optical flow field. Therefore, the intervention of flow field edge and large displacement optimization methods is required.
在大位移计算时,基于金字塔分层的算法被证实是非常有效的,但在金字塔构建过程中,每两层之间的降采样前均需要高斯滤波,以防止降采样后的图像出现的锯齿效应。一般的算法使用高斯滤波是非常有效的,然而光流场的估计对梯度变化较为敏感,微小的变化会使得光流场边界模糊,从而导致计算的鲁棒性降低。因此,本发明实施例引入一种边缘保持能力较强的滤波器作为构建金字塔层间图像的处理工具,以双边滤波为例,如直接使用传统的双边滤波算法,可以得到精度较高的边缘,但算法本身耗时严重,受益于“1)数据项优化”中采用三角函数多项式展开逼近高斯滤波的思路,将该操作引入到传统双边滤波中,与金字塔分层算法嵌套使用并配合指令集方法进行编码实现,形成一套优化算法。In large displacement calculations, the algorithm based on pyramid layering has been proven to be very effective, but in the process of pyramid construction, Gaussian filtering is required before downsampling between each two layers to prevent the jagged effect of the downsampled image. The general algorithm using Gaussian filtering is very effective, but the estimation of the optical flow field is more sensitive to gradient changes. Small changes will make the optical flow field boundary blurred, resulting in reduced robustness of the calculation. Therefore, the embodiment of the present invention introduces a filter with strong edge retention ability as a processing tool for constructing pyramid inter-layer images. Taking bilateral filtering as an example, if the traditional bilateral filtering algorithm is directly used, a high-precision edge can be obtained, but the algorithm itself is time-consuming. Benefiting from the idea of using trigonometric function polynomial expansion to approximate Gaussian filtering in "1) Data Item Optimization", this operation is introduced into the traditional bilateral filtering, nested with the pyramid layering algorithm and encoded and implemented in conjunction with the instruction set method to form a set of optimization algorithms.
本发明实施例首先将目标场景的相邻两帧图像进行获取并提取各自对应的像素数据,基于金字塔分层算法对两帧图像进行降采样处理,从而实现对流场边缘以及大位移处理的优化过程。The embodiment of the present invention first acquires two adjacent frames of images of the target scene and extracts the corresponding pixel data, and performs downsampling processing on the two frames of images based on a pyramid layering algorithm, thereby realizing an optimization process for flow field edge and large displacement processing.
通过将像素数据输入光流变分模型中,进行金字塔分层处理,基于目标场景、目标对象计算得到不同权重参数对应的光流能量场结果,通过对光流能量场结果进行分类,确定目标对象所在目标场景下的目标权重参数,基于光流模型和目标权重参数计算得到目标对象的运动状态,并将目标对象的光流矢量结果在原图像上进行显示。By inputting pixel data into the optical flow variational model and performing pyramid layered processing, the optical flow energy field results corresponding to different weight parameters are calculated based on the target scene and target object. By classifying the optical flow energy field results, the target weight parameters of the target object in the target scene are determined. The motion state of the target object is calculated based on the optical flow model and the target weight parameters, and the optical flow vector result of the target object is displayed on the original image.
通过完成上述所有步骤,即可全部实现基于TV-L1自适应光流场的优化估计,为验证结果的正确性,本发明实施例还进行了针对此过程的仿真验证,并给出仿真的结果如图9所示,其中,第1列为基于理论计算得到的光流场图像;第2列为基于LK光流法计算得到的光流场图像;第3列为基于HS光流法计算得到的光流场图像;第4列为基于块光流法计算得到的光流场图像;第5列为本发明实施例提出的运动目标识别方法计算得到的光流场图像。By completing all the above steps, the optimization estimation based on TV-L 1 adaptive optical flow field can be fully realized. In order to verify the correctness of the results, the embodiment of the present invention also carried out simulation verification for this process, and the simulation results are shown in Figure 9, wherein the first column is the optical flow field image obtained based on theoretical calculation; the second column is the optical flow field image calculated based on the LK optical flow method; the third column is the optical flow field image calculated based on the HS optical flow method; the fourth column is the optical flow field image calculated based on the block optical flow method; the fifth column is the optical flow field image calculated by the moving target recognition method proposed in the embodiment of the present invention.
示例性地,本发明实施例以标准测试集来自MIDDLEBURY光流数据库的数据为例进行仿真,得到仿真结果。Exemplarily, the embodiment of the present invention uses the data of the standard test set from the MIDDLEBURY optical flow database as an example to perform simulation and obtain simulation results.
由图9可以看出,在处理数据集中的“Urban3”和“Venus”的两帧图像时,与理论光流场相比,LK光流法估计结果较为稀疏,物体梯度边缘光流描述较差;HS光流法精度较LK高,但相邻区域内流场估计不均匀,受到权重系数的人工选择的影响较大;基于块的光流法边界光流清晰,适合处理高对比度图像序列流场估计,但容易出现错误光流估计的现象,使得流场估计较为混乱;而本发明实施例所提出的基于TV-L1自适应光流优化估计方法可实现自适应权重系数的选择,得到的流场估计在边缘处较为清晰、均匀,在遮挡较多的“Urban3”中算法的检测性能也较其他三种优秀。本发明实施例所提出的方法是综合型的,普适性更好,而其他三种方法更有各自突出的应用领域,如基于块的方法,虽然会估计较多错误光流,但在梯度变化较大的边缘处其效果非常好。As can be seen from Figure 9, when processing the two frames of images "Urban3" and "Venus" in the data set, compared with the theoretical optical flow field, the estimation result of the LK optical flow method is relatively sparse, and the description of the object gradient edge optical flow is poor; the HS optical flow method has higher accuracy than the LK, but the flow field estimation in adjacent areas is uneven and is greatly affected by the artificial selection of weight coefficients; the block-based optical flow method has clear boundary optical flow and is suitable for processing high-contrast image sequence flow field estimation, but it is easy to have the phenomenon of erroneous optical flow estimation, making the flow field estimation more chaotic; and the TV-L 1 adaptive optical flow optimization estimation method proposed in the embodiment of the present invention can realize the selection of adaptive weight coefficients, and the obtained flow field estimation is clearer and more uniform at the edge. The detection performance of the algorithm in "Urban3" with more occlusion is also better than the other three. The method proposed in the embodiment of the present invention is comprehensive and has better universality, while the other three methods have their own outstanding application fields. For example, although the block-based method will estimate more erroneous optical flows, it works very well at the edge with large gradient changes.
为了量化说明本发明实施例所提出方法对光流场估计的精度,使用平均角度误差(AAE)、平均终点误差(AEPE)和平均标准差(ASTD)来衡量图9中的光流场估计结果如表1所示。可以看出,三种误差评价标准下,本发明实施例所提出的方法误差在某一个指标下并不是最优的,但总体性能是最优的,三种误差均保持较低的水平,且计算速度分别为0.14s和0.27s,效率较其他三种方法提升1-2.5倍。In order to quantify the accuracy of the optical flow field estimation of the method proposed in the embodiment of the present invention, the average angle error (AAE), average endpoint error (AEPE) and average standard deviation (ASTD) are used to measure the optical flow field estimation results in Figure 9 as shown in Table 1. It can be seen that under the three error evaluation standards, the error of the method proposed in the embodiment of the present invention is not optimal under a certain indicator, but the overall performance is optimal, the three errors are all maintained at a low level, and the calculation speed is 0.14s and 0.27s respectively, which is 1-2.5 times more efficient than the other three methods.
表1算法误差结果对比Table 1 Comparison of algorithm error results
综上,本发明实施例提供的运动目标识别方法,其最大的优势在于:从基础模型层面提供性能优化方法,面向学者和工程人员提供一种可以实现变分光流计算中高精度、稠密光流场的低复杂度、抗噪性强、光流场边界保持、自适应权重参数选择的一套解决方案,并通过仿真实验验证了算法的性能,给研发应用人员提供有效的参考。In summary, the greatest advantage of the moving target recognition method provided by the embodiment of the present invention is that it provides a performance optimization method from the basic model level, and provides scholars and engineers with a set of solutions that can achieve high precision in variational optical flow calculation, low complexity of dense optical flow field, strong noise resistance, optical flow field boundary preservation, and adaptive weight parameter selection. The performance of the algorithm is verified through simulation experiments, providing an effective reference for R&D and application personnel.
本发明实施例提供了一种运动目标识别装置,如图10所示,该运动目标识别装置包括:An embodiment of the present invention provides a moving target recognition device, as shown in FIG10 , the moving target recognition device includes:
获取模块101,用于获取目标场景的相邻两帧图像,目标场景包括目标对象。详细内容参见上述方法实施例中步骤S101的相关描述,在此不再进行赘述。The acquisition module 101 is used to acquire two adjacent frames of images of a target scene, where the target scene includes a target object. For details, please refer to the relevant description of step S101 in the above method embodiment, which will not be repeated here.
提取模块102,用于分别提取相邻两帧图像对应的像素数据。详细内容参见上述方法实施例中步骤S102的相关描述,在此不再进行赘述。The extraction module 102 is used to extract pixel data corresponding to two adjacent frames of images respectively. For details, please refer to the relevant description of step S102 in the above method embodiment, which will not be repeated here.
第一计算模块103,用于将像素数据输入光流模型,计算不同权重参数对应的光流能量场。详细内容参见上述方法实施例中步骤S103的相关描述,在此不再进行赘述。The first calculation module 103 is used to input pixel data into the optical flow model and calculate the optical flow energy field corresponding to different weight parameters. For details, please refer to the relevant description of step S103 in the above method embodiment, which will not be repeated here.
第二计算模块104,用于对不同权重参数对应的光流能量场进行分类,基于分类结果确定目标对象所在目标场景下的目标权重参数。详细内容参见上述方法实施例中步骤S104的相关描述,在此不再进行赘述。The second calculation module 104 is used to classify the optical flow energy fields corresponding to different weight parameters, and determine the target weight parameter of the target scene where the target object is located based on the classification result. For details, please refer to the relevant description of step S104 in the above method embodiment, which will not be repeated here.
第三计算模块105,用于基于光流模型和目标权重参数,计算得到目标对象的运动状态。详细内容参见上述方法实施例中步骤S105的相关描述,在此不再进行赘述。The third calculation module 105 is used to calculate the motion state of the target object based on the optical flow model and the target weight parameter. For details, please refer to the relevant description of step S105 in the above method embodiment, which will not be repeated here.
上述的运动目标识别装置的更进一步描述参见上述运动目标识别方法实施例的相关描述,在此不再进行赘述。For further description of the above-mentioned moving target recognition device, please refer to the relevant description of the above-mentioned moving target recognition method embodiment, which will not be repeated here.
通过上述各个组成部分的协同合作,本发明实施例提供的运动目标识别装置,通过将目标场景的相邻两帧图像的像素数据输入光流模型中,计算得到不同权重参数对应的光流能量场以及光流能量场的分类,基于分类结果确定目标对象所在的目标场景下的目标权重参数,从而针对不同的目标场景,实现对权重参数的灵活调节,基于光流模型和目标权重参数,计算得到目标对象的运动状态,在快速准确确定目标权重参数的基础上,不仅实现了对运动目标运动状态的精确识别,还进一步地提高了识别运动目标的效率。Through the coordinated cooperation of the above-mentioned components, the moving target recognition device provided by the embodiment of the present invention inputs the pixel data of two adjacent frames of images of the target scene into the optical flow model, calculates the optical flow energy field corresponding to different weight parameters and the classification of the optical flow energy field, and determines the target weight parameters of the target scene where the target object is located based on the classification result, thereby realizing flexible adjustment of the weight parameters for different target scenes, and calculating the motion state of the target object based on the optical flow model and the target weight parameters. On the basis of quickly and accurately determining the target weight parameters, not only the accurate recognition of the motion state of the moving target is realized, but also the efficiency of identifying the moving target is further improved.
本发明实施例提供了一种电子设备,如图11所示,该电子设备包括处理器901和存储器902,存储器902和处理器901之间互相通信连接,其中处理器901和存储器902可以通过总线或者其他方式连接,图11中以通过总线连接为例。An embodiment of the present invention provides an electronic device, as shown in FIG11 , the electronic device includes a processor 901 and a memory 902 , the memory 902 and the processor 901 are communicatively connected with each other, wherein the processor 901 and the memory 902 may be connected via a bus or other means, and FIG11 takes the connection via a bus as an example.
处理器901可以为中央处理器(Central Processing Unit,CPU)。处理器901还可以为其他通用处理器、数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现场可编程门阵列(Field-Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等芯片,或者上述各类芯片的组合。The processor 901 may be a central processing unit (CPU). The processor 901 may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or a combination of the above chips.
存储器902作为一种非暂态计算机可读存储介质,可用于存储非暂态软件程序、非暂态计算机可执行程序以及模块,如本发明实施例中方法所对应的程序指令/模块。处理器901通过运行存储在存储器902中的非暂态软件程序、指令以及模块,从而执行处理器901的各种功能应用以及数据处理,即实现上述方法实施例中的方法。The memory 902 is a non-transitory computer-readable storage medium that can be used to store non-transitory software programs, non-transitory computer executable programs and modules, such as program instructions/modules corresponding to the method in the embodiment of the present invention. The processor 901 executes various functional applications and data processing of the processor 901 by running the non-transitory software programs, instructions and modules stored in the memory 902, that is, implements the method in the above method embodiment.
存储器902可以包括存储程序区和存储数据区,其中,存储程序区可存储操作系统、至少一个功能所需要的应用程序;存储数据区可存储处理器901所创建的数据等。此外,存储器902可以包括高速随机存取存储器,还可以包括非暂态存储器,例如至少一个磁盘存储器件、闪存器件、或其他非暂态固态存储器件。在一些实施例中,存储器902可选包括相对于处理器901远程设置的存储器,这些远程存储器可以通过网络连接至处理器901。上述网络的实例包括但不限于互联网、企业内部网、局域网、移动通信网及其组合。The memory 902 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required by at least one function; the data storage area may store data created by the processor 901, etc. In addition, the memory 902 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some embodiments, the memory 902 may optionally include a memory remotely arranged relative to the processor 901, and these remote memories may be connected to the processor 901 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
一个或者多个模块存储在存储器902中,当被处理器901执行时,执行上述方法实施例中的方法。One or more modules are stored in the memory 902 , and when executed by the processor 901 , the method in the above method embodiment is executed.
上述电子设备具体细节可以对应参阅上述方法实施例中对应的相关描述和效果进行理解,此处不再赘述。The specific details of the above electronic device can be understood by referring to the corresponding descriptions and effects in the above method embodiments, and will not be repeated here.
本领域技术人员可以理解,实现上述实施例方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成,实现的程序可存储于一计算机可读取存储介质中,该程序在执行时,可包括如上述各方法的实施例的流程。其中,存储介质可为磁碟、光盘、只读存储记忆体(Read-Only Memory,ROM)、随机存储记忆体(Random Access Memory,RAM)、快闪存储器(Flash Memory)、硬盘(Hard Disk Drive,缩写:HDD)或固态硬盘(Solid-State Drive,SSD)等;存储介质还可以包括上述种类的存储器的组合。Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program, and the implemented program can be stored in a computer-readable storage medium, and when the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, the storage medium can be a disk, an optical disk, a read-only memory (ROM), a random access memory (RAM), a flash memory, a hard disk drive (HDD) or a solid-state drive (SSD), etc.; the storage medium can also include a combination of the above-mentioned types of memory.
显然,上述实施例仅仅是为清楚地说明所作的举例,而并非对实施方式的限定。对于所属领域的普通技术人员来说,在上述说明的基础上还可以做出其它不同形式的变化或变动。这里无需也无法对所有的实施方式予以穷举。而由此所引伸出的显而易见的变化或变动仍处于本发明创造的保护范围之中。Obviously, the above embodiments are merely examples for the purpose of clear explanation, and are not intended to limit the implementation methods. For those skilled in the art, other different forms of changes or modifications can be made based on the above description. It is not necessary and impossible to list all the implementation methods here. The obvious changes or modifications derived therefrom are still within the scope of protection of the invention.
Claims (5)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210697761.1A CN115035164B (en) | 2022-06-20 | 2022-06-20 | A moving target recognition method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210697761.1A CN115035164B (en) | 2022-06-20 | 2022-06-20 | A moving target recognition method and device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN115035164A CN115035164A (en) | 2022-09-09 |
CN115035164B true CN115035164B (en) | 2024-11-05 |
Family
ID=83125668
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202210697761.1A Active CN115035164B (en) | 2022-06-20 | 2022-06-20 | A moving target recognition method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN115035164B (en) |
Families Citing this family (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115880784B (en) * | 2023-02-22 | 2023-05-09 | 武汉商学院 | Scenic spot multi-person action behavior monitoring method based on artificial intelligence |
CN118505982B (en) * | 2024-07-16 | 2024-10-18 | 广东海洋大学 | Target detection method based on finite time gradient projection nerve dynamics |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104869387A (en) * | 2015-04-19 | 2015-08-26 | 中国传媒大学 | Method for acquiring binocular image maximum parallax based on optical flow method |
CN105261042A (en) * | 2015-10-19 | 2016-01-20 | 华为技术有限公司 | Optical flow estimation method and apparatus |
Family Cites Families (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111028263B (en) * | 2019-10-29 | 2023-05-05 | 福建师范大学 | Moving object segmentation method and system based on optical flow color clustering |
CN112132871B (en) * | 2020-08-05 | 2022-12-06 | 天津(滨海)人工智能军民融合创新中心 | Visual feature point tracking method and device based on feature optical flow information, storage medium and terminal |
-
2022
- 2022-06-20 CN CN202210697761.1A patent/CN115035164B/en active Active
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104869387A (en) * | 2015-04-19 | 2015-08-26 | 中国传媒大学 | Method for acquiring binocular image maximum parallax based on optical flow method |
CN105261042A (en) * | 2015-10-19 | 2016-01-20 | 华为技术有限公司 | Optical flow estimation method and apparatus |
Also Published As
Publication number | Publication date |
---|---|
CN115035164A (en) | 2022-09-09 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109711288B (en) | Remote Sensing Ship Detection Method Based on Feature Pyramid and Distance Constrained FCN | |
CN109544677B (en) | Indoor scene main structure reconstruction method and system based on depth image key frame | |
CN110097536B (en) | Hexagonal bolt looseness detection method based on deep learning and Hough transform | |
CN105551036B (en) | A kind of training method and device of deep learning network | |
CN110334762B (en) | Feature matching method based on quad tree combined with ORB and SIFT | |
CN110674987A (en) | Traffic flow prediction system and method and model training method | |
CN115035164B (en) | A moving target recognition method and device | |
CN106504276A (en) | The combinations matches cost algorithms of non local Stereo Matching Algorithm and parallax joint filling algorithm | |
CN102800098B (en) | Multi-characteristic multi-level visible light full-color and multi-spectrum high-precision registering method | |
CN104574347A (en) | On-orbit satellite image geometric positioning accuracy evaluation method on basis of multi-source remote sensing data | |
CN110838145B (en) | Visual positioning and mapping method for indoor dynamic scene | |
CN108401565B (en) | Remote sensing image registration method based on improved KAZE features and Pseudo-RANSAC algorithms | |
CN111523447A (en) | Vehicle tracking method, device, electronic equipment and storage medium | |
CN111079826B (en) | Construction progress real-time identification method integrating SLAM and image processing | |
CN107862735A (en) | A kind of RGBD method for reconstructing three-dimensional scene based on structural information | |
CN113673400A (en) | Real scene three-dimensional semantic reconstruction method and device based on deep learning and storage medium | |
CN113947766A (en) | A real-time license plate detection method based on convolutional neural network | |
CN106203269A (en) | A kind of based on can the human face super-resolution processing method of deformation localized mass and system | |
CN113657214B (en) | A building damage assessment method based on Mask RCNN | |
CN108986103B (en) | An image segmentation method based on superpixels and multi-supergraph fusion | |
CN114612412A (en) | Processing method of three-dimensional point cloud data, application of processing method, electronic device and storage medium | |
CN104700359A (en) | Super-resolution reconstruction method of image sequence in different polar axis directions of image plane | |
CN112884804A (en) | Action object tracking method and related equipment | |
CN111854651A (en) | A real-time measurement method of indoor building area based on SLAM | |
CN116863332A (en) | A low-resolution vibration image target detection network structure, training method and application |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |