[go: up one dir, main page]

CN115035446B - A kitchen rat detection and recognition method based on local MSR and target matching - Google Patents

A kitchen rat detection and recognition method based on local MSR and target matching Download PDF

Info

Publication number
CN115035446B
CN115035446B CN202210641604.9A CN202210641604A CN115035446B CN 115035446 B CN115035446 B CN 115035446B CN 202210641604 A CN202210641604 A CN 202210641604A CN 115035446 B CN115035446 B CN 115035446B
Authority
CN
China
Prior art keywords
image
mouse
background
gaussian distribution
gaussian
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
Application number
CN202210641604.9A
Other languages
Chinese (zh)
Other versions
CN115035446A (en
Inventor
谢红刚
姜迪
李郑美
湛文科
王鹏举
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hubei University of Technology
Original Assignee
Hubei University of Technology
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Hubei University of Technology filed Critical Hubei University of Technology
Priority to CN202210641604.9A priority Critical patent/CN115035446B/en
Publication of CN115035446A publication Critical patent/CN115035446A/en
Application granted granted Critical
Publication of CN115035446B publication Critical patent/CN115035446B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V20/00Scenes; Scene-specific elements
    • G06V20/40Scenes; Scene-specific elements in video content
    • G06V20/41Higher-level, semantic clustering, classification or understanding of video scenes, e.g. detection, labelling or Markovian modelling of sport events or news items
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/50Image enhancement or restoration using two or more images, e.g. averaging or subtraction
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/90Dynamic range modification of images or parts thereof
    • G06T5/92Dynamic range modification of images or parts thereof based on global image properties
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/13Edge detection
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/194Segmentation; Edge detection involving foreground-background segmentation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/70Arrangements for image or video recognition or understanding using pattern recognition or machine learning
    • G06V10/74Image or video pattern matching; Proximity measures in feature spaces
    • G06V10/75Organisation of the matching processes, e.g. simultaneous or sequential comparisons of image or video features; Coarse-fine approaches, e.g. multi-scale approaches; using context analysis; Selection of dictionaries
    • G06V10/752Contour matching
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/70Arrangements for image or video recognition or understanding using pattern recognition or machine learning
    • G06V10/764Arrangements for image or video recognition or understanding using pattern recognition or machine learning using classification, e.g. of video objects
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V20/00Scenes; Scene-specific elements
    • G06V20/50Context or environment of the image
    • G06V20/52Surveillance or monitoring of activities, e.g. for recognising suspicious objects
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/10Image acquisition modality
    • G06T2207/10016Video; Image sequence

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Physics & Mathematics (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Multimedia (AREA)
  • Software Systems (AREA)
  • Health & Medical Sciences (AREA)
  • Databases & Information Systems (AREA)
  • Evolutionary Computation (AREA)
  • General Health & Medical Sciences (AREA)
  • Medical Informatics (AREA)
  • Computing Systems (AREA)
  • Artificial Intelligence (AREA)
  • Computational Linguistics (AREA)
  • Image Analysis (AREA)

Abstract

本发明提供一种基于局部MSR和目标匹配的厨房老鼠检测识别方法,包括监控图像提取、图像低照度增强、老鼠活动区域检测、老鼠模板制作、老鼠匹配和判定,其特征在于:所述监控图像提取是通过视频图像采集卡将摄像机中的视频图像传递到计算机中,然后把视频图像转换为连续帧的图像序列。

The present invention provides a kitchen rat detection and identification method based on local MSR and target matching, including monitoring image extraction, image low-light enhancement, rat activity area detection, rat template preparation, rat matching and judgment, and is characterized in that: the monitoring image extraction is to transfer the video image in the camera to the computer through a video image acquisition card, and then convert the video image into an image sequence of continuous frames.

Description

一种基于局部MSR和目标匹配的厨房老鼠检测识别方法A kitchen rat detection and recognition method based on local MSR and target matching

技术领域Technical Field

计算机视觉包括图像处理,模式识别和目标检测。目标检测广泛运用于视频监控领域,本文采用运动目标检测中的背景差分法来检测识别监控视频中的运动目标。Computer vision includes image processing, pattern recognition and target detection. Target detection is widely used in the field of video surveillance. This paper uses the background difference method in moving target detection to detect and identify moving targets in surveillance videos.

背景技术Background Art

随着人们生活水平的提高,我国的餐饮业也蓬勃发展起来,老鼠的出现给餐饮行业带来严重的食品安全问题,运用视频图像技术能找到老鼠的行动轨迹,通过在老鼠路径上部署捕鼠装置可以解决这一问题。As people's living standards improve, my country's catering industry has also flourished. The emergence of rats has brought serious food safety problems to the catering industry. The use of video imaging technology can find the movement trajectory of rats, and this problem can be solved by deploying rat traps on the rat path.

随着图像检测与识别的迅速发展,视频监控技术在监控领域也得到了广大的运用。运用计算机视觉技术建立视频监控系统,对监控中的图像进行实时检测,识别出其中危害食品的老鼠,分析出老鼠的活动轨迹,根据已知的路线轨迹布置捕鼠设备,从而降低老鼠对厨房食品的危害,减少了不必要的食品安全问题纠纷和捕鼠的人力成本。该技术采用背景差分法来将运动目标和背景相分离,快速的找出并识别运动目标。在背景差分前,依据老鼠活动区域固定的特点,仅对老鼠可能出现的区域进行MSR处理,减少计算量,提高效率。传统混合高斯模型的模型更新的学习速率是固定的,这会照成差分图像上产生空洞或拖影等问题,本文设计了一种能对不同阶段的背景建模按照不同的学习速度进行更新的方法,对传统的混合高斯模型进行改进,能很好的解决这一问题。本文设计一种针对目标老鼠的匹配判定方法对老鼠进行识别,根据老鼠的形态特点设计四种不同角度的老鼠模板,将模板与检测图像进行匹配,判断老鼠是否存在。With the rapid development of image detection and recognition, video surveillance technology has also been widely used in the field of surveillance. Using computer vision technology to establish a video surveillance system, real-time detection of images under surveillance, identification of rats that endanger food, analysis of rat activity trajectories, and arrangement of rat-catching equipment based on known route trajectories can reduce the harm of rats to kitchen food, reduce unnecessary food safety disputes and the labor cost of rat-catching. This technology uses background difference method to separate moving targets from background, quickly find and identify moving targets. Before background difference, based on the characteristics of fixed rat activity areas, only MSR processing is performed on areas where rats may appear, reducing the amount of calculation and improving efficiency. The learning rate of model update of traditional mixed Gaussian model is fixed, which will cause problems such as holes or smears on the differential image. This paper designs a method that can update the background modeling at different stages according to different learning rates, improves the traditional mixed Gaussian model, and can solve this problem well. This paper designs a matching judgment method for target rats to identify rats. According to the morphological characteristics of rats, four rat templates at different angles are designed, and the templates are matched with the detection image to determine whether the rat exists.

发明内容Summary of the invention

本发明的目的是提供一种局部MSR和特定目标匹配相结合检测识别老鼠方法。The purpose of the present invention is to provide a method for detecting and identifying mice by combining local MSR and specific target matching.

本发明实现步骤如下:The present invention implements the steps as follows:

①监控图像提取(101):① Surveillance image extraction (101):

通过视频图像采集卡将摄像机中的视频图像传递到计算机中,然后把视频图像转换为连续帧的图像序列。The video images in the camera are transferred to the computer through the video image acquisition card, and then the video images are converted into an image sequence of continuous frames.

②图像低照度增强(102):② Image low-light enhancement (102):

将每帧图像采用非均分方法按水平方向分割,得到上下两份图像,将下方图像采用MSR方法进行图像增强。Each frame of the image is split horizontally using a non-uniform division method to obtain two images, the upper and lower images, and the lower image is enhanced using the MSR method.

③老鼠活动区域检测(103):③ Mouse activity area detection (103):

对预处理后图像的每一个像素点构建K(K=3,5)个高斯分布模型,从而形成混合高斯背景模型。将当前帧像素点的K个高斯分布与背景像素点的K个高斯分布进行匹配,若匹配的高斯分布符合背景要求,那么该像素点为背景,否则为前景,若无高斯分布与背景相匹配,则此时出现了一个新的高斯分布,那么就将该分布取代背景高斯分布中权重最小的高斯分布。当背景差分完后,需要对背景模型进行更新,更新背景模型需要将当前像素点的高斯分布与已有的高斯分布进行比较,如果该高斯分布与某一个高斯分布相匹配,则相应的对高斯分布的均值,权重和方差进行更新,如果都不匹配,则出现了一个新的高斯分布,需要将该高斯分布取代权重最小的高斯分布。Construct K (K = 3, 5) Gaussian distribution models for each pixel of the preprocessed image to form a mixed Gaussian background model. Match the K Gaussian distributions of the current frame pixel with the K Gaussian distributions of the background pixel. If the matched Gaussian distribution meets the background requirements, then the pixel is the background, otherwise it is the foreground. If no Gaussian distribution matches the background, a new Gaussian distribution appears at this time, and then the distribution replaces the Gaussian distribution with the smallest weight in the background Gaussian distribution. After the background difference is completed, the background model needs to be updated. To update the background model, the Gaussian distribution of the current pixel needs to be compared with the existing Gaussian distribution. If the Gaussian distribution matches a certain Gaussian distribution, the mean, weight and variance of the Gaussian distribution are updated accordingly. If none of them match, a new Gaussian distribution appears, and the Gaussian distribution with the smallest weight needs to be replaced by this Gaussian distribution.

将背景建模的过程划分为初始阶段和稳固阶段,在背景初始阶段需要一个较大的学习速率,在背景稳固阶段需要一个较小的速率。The background modeling process is divided into an initial stage and a stable stage. A larger learning rate is required in the initial stage of the background, and a smaller rate is required in the stable stage of the background.

依据建立的混合高斯模型作为背景,对每帧经过预处理后的图像差分出前景图像。Based on the established mixed Gaussian model as the background, the foreground image is differentiated from each frame of the preprocessed image.

将差分后的图像进行形态学处理,然后对处理后的图像进行边缘检测,提取差分图像的轮廓信息。The differential image is subjected to morphological processing, and then edge detection is performed on the processed image to extract the contour information of the differential image.

④老鼠模板制作(104):④ Mouse template production (104):

依据不同角度老鼠的形状差异设计出四个不同角度的老鼠轮廓图像,将提取的运动目标的轮廓信息与四种老鼠轮廓图像进行形状匹配。根据老鼠体型较小,所占的像素点较少的特点,缩小设计的轮廓图像并计算不同角度轮廓面积。According to the shape differences of mice at different angles, four mouse contour images at different angles were designed, and the contour information of the extracted moving target was matched with the four mouse contour images. According to the characteristics of mice being small in size and occupying fewer pixels, the designed contour image was reduced and the contour areas at different angles were calculated.

⑤老鼠匹配和判定(105):⑤ Mouse matching and determination (105):

将差分图像的轮廓信息和四个老鼠模板相匹配,将匹配较高的老鼠轮廓图像所对应的轮廓面积与提取的运动目标的轮廓面积相比较,若两者相差较小,则判定该运动目标为老鼠。The contour information of the differential image is matched with four mouse templates, and the contour area corresponding to the mouse contour image with the higher match is compared with the contour area of the extracted moving target. If the difference between the two is small, the moving target is determined to be a mouse.

本发明具有下列优点和积极效果:The present invention has the following advantages and positive effects:

为了解决老鼠夜间活动得到的图像亮度低和噪点多的问题,在图像低照度增强阶段依据老鼠活动范围在监控较下方的特点,先将每帧图像分为上下两块,仅对下方图像采用MSR进行图像增强,既能消除图像噪点,提升图像亮度,又能减小计算工作量,提升计算效率。根据厨房背景固定和老鼠目标较小特点,在使用混合高斯背景建模的方法建立一个背景模型时,将学习速率变为一种自适应值,适应不同阶段背景的更新速度,以此来提取更加准确的老鼠差分图像,同时加快检测的速度,减少不必要的资源浪费。对差分后的图像进行二值化,形态学处理和边缘检测,提取目标匹配所需的轮廓信息。In order to solve the problem of low brightness and high noise in images obtained from rats' nighttime activities, in the low-light enhancement stage of images, each frame of the image is first divided into two parts, upper and lower, based on the characteristics that the range of rats' activities is located at the lower part of the monitoring area. Only the lower image is enhanced by MSR, which can not only eliminate image noise and improve image brightness, but also reduce the computational workload and improve computational efficiency. According to the characteristics of the fixed kitchen background and the small rat target, when using the mixed Gaussian background modeling method to establish a background model, the learning rate is changed to an adaptive value to adapt to the update speed of the background at different stages, so as to extract more accurate rat differential images, speed up the detection speed, and reduce unnecessary resource waste. The differential image is binarized, morphologically processed, and edge detected to extract the contour information required for target matching.

在目标匹配阶段依据具体问题具体分析,根据厨房场景固定以及老鼠活动角度不同的特点,制作出不同角度的老鼠轮廓图像并将其与边缘检测后的轮廓图像匹配,以边缘检测后的轮廓图像的形状面积是否与某一角度的轮廓形状和面积匹配来判断该帧图像中是否存在老鼠,通过双重匹配机制来提高识别的准确率。In the target matching stage, we analyze specific problems based on specific situations. Based on the characteristics of a fixed kitchen scene and different angles of mouse activity, we produce mouse outline images at different angles and match them with the outline image after edge detection. We determine whether there is a mouse in the frame image by checking whether the shape and area of the outline image after edge detection matches the shape and area of the outline at a certain angle. We use a double matching mechanism to improve recognition accuracy.

附图说明BRIEF DESCRIPTION OF THE DRAWINGS

图1主流程图Figure 1 Main flow chart

图2老鼠活动区域检测Figure 2 Mouse activity area detection

图3厨房背景模型更新学习速率流程图Figure 3 Kitchen background model update learning rate flow chart

图4四个角度观测老鼠轮廓图像Figure 4 Mouse outline images observed from four angles

101监控图像提取102图像低照度增强103老鼠活动区域检测104老鼠模板的制作105老鼠匹配和判定201建立混合高斯厨房背景模型202厨房背景更新203厨房背景建模学习速率更新204老鼠厨房前景背景差分205差分图像二值化206形态学处理207边缘检测101 Surveillance image extraction 102 Image low illumination enhancement 103 Mouse activity area detection 104 Mouse template creation 105 Mouse matching and judgment 201 Establishing a mixed Gaussian kitchen background model 202 Kitchen background update 203 Kitchen background modeling learning rate update 204 Mouse kitchen foreground and background difference 205 Difference image binarization 206 Morphological processing 207 Edge detection

具体实施方式DETAILED DESCRIPTION

一、方法1. Methods

1、本方法的步骤1. Steps of this method

①监控图像提取;① Monitoring image extraction;

②图像低照度增强;② Image low illumination enhancement;

③老鼠活动区域检测;③ Detection of rat activity areas;

④老鼠模板制作;④ Mouse template production;

⑤老鼠匹配和判定;⑤ Mouse matching and determination;

2、工作机理2. Working mechanism

以下对本发明的工作机理进行简单说明:The working mechanism of the present invention is briefly described below:

将输入设备中的视频图像通过计算机输入设备输入到计算机内存中,把该图像转换为计算机能够识别和处理的图像,每帧图像进行图像上下分块,对下方图像进行MSR处理。将预处理后的图像的每一个像数值都建立多个高斯分布模型,根据提取的帧图像对背景模型进行更新,逐渐形成一个比较稳固的背景模型,然后按照混合高斯模型背景建模的算法判断图像的前景像素和背景像素,以此达到背景与前景分割的目的。对经过背景差分的图像进行二值化和形态学处理,将处理后的图像进行边缘检测,提取图像中的轮廓信息。依据老鼠的形态特征制作不同角度老鼠轮廓图像,将其与经过边缘检测后的差分图像进行匹配,判断该图像中是否存在老鼠。The video image in the input device is input into the computer memory through the computer input device, and the image is converted into an image that can be recognized and processed by the computer. Each frame of the image is divided into upper and lower blocks, and the lower image is processed by MSR. Multiple Gaussian distribution models are established for each pixel value of the preprocessed image, and the background model is updated according to the extracted frame image to gradually form a relatively stable background model. Then, the foreground pixels and background pixels of the image are determined according to the algorithm of mixed Gaussian model background modeling, so as to achieve the purpose of background and foreground segmentation. The image after background difference is binarized and morphologically processed, and the processed image is edge detected to extract the contour information in the image. According to the morphological characteristics of the mouse, the mouse contour images of different angles are made, and they are matched with the differential image after edge detection to determine whether there is a mouse in the image.

子步骤Substeps

i.监控图像提取:i. Surveillance image extraction:

将摄像机中的视频图像通过数字采集卡转存到计算机中,然后将视频转换为图像序列。The video images in the camera are transferred to the computer through a digital acquisition card, and then the video is converted into an image sequence.

ii.图像低照度增强:ii. Image low illumination enhancement:

厨房检测老鼠的时间处在晚上下班后,曝光条件不足,所得到的图像为低照度图像,需要先对每帧图像进行图像增强处理,消除图像噪点,提高图像质量。The time for detecting mice in the kitchen is after get off work in the evening. The exposure conditions are insufficient and the obtained images are low-light images. It is necessary to first perform image enhancement processing on each frame of the image to eliminate image noise and improve image quality.

由于厨房中的老鼠大多在灶台以及地面上活动,处在监控的下方,所以仅需对下方图像进行增强处理,减少不必要的运算,提高运算效率。Since most mice in the kitchen move around on the stove and on the ground, which are below the surveillance camera, only the image below needs to be enhanced to reduce unnecessary calculations and improve computing efficiency.

首先每帧图像像素大小,由于每张图像大小相同,仅需计算第一帧图像像素大小,对图像的垂直像素按四舍五入法分割为上下两块图像。First, the pixel size of each frame of the image is calculated. Since each image has the same size, only the pixel size of the first frame of the image needs to be calculated, and the vertical pixels of the image are divided into two images, the upper and the lower, by rounding off.

对分割出的下方图像进行MSR(多尺度Retienx)图像增强,采用了三种不同尺度的高斯滤波函数,每种滤波函数具有不同的尺度参数,分别用三种高斯滤波函数对低光图像进行卷积操作,操作完成后可得不同尺度的光照图像,再将多张不同尺度的光照图像加权平均,获得最终的光照图像,如公式(1)和公式(2):The segmented lower image is subjected to MSR (Multi-Scale Retienx) image enhancement. Three Gaussian filter functions of different scales are used. Each filter function has a different scale parameter. The three Gaussian filter functions are used to perform convolution operations on the low-light image. After the operation is completed, illumination images of different scales can be obtained. Then, the multiple illumination images of different scales are weighted averaged to obtain the final illumination image, as shown in formula (1) and formula (2):

在公式(1)和公式(2)中,n为3,N表示高斯Si(x,y)卷积函数的数量,一般为3个分别,用于表示小、中、大三种尺度,Wn表示每种尺度的权值,kn示不同尺度的归一化因子,cn表示不同的尺度参数,Gn(x,y,c)表示n个不同的高斯函数,Si(x,y)示低光图像中第i个通道的分量。In formula (1) and formula (2), n is 3, N represents the number of Gaussian S i (x, y) convolution functions, which is generally 3, respectively, used to represent small, medium and large scales, W n represents the weight of each scale, k n represents the normalization factor of different scales, c n represents different scale parameters, G n (x, y, c) represents n different Gaussian functions, S i (x, y) represents the component of the i-th channel in the low-light image.

操作完成后可得不同尺度的光照图像,再将三张不同尺度的光照图像加权平均,获得光照增强和噪声消除的最终图像。After the operation is completed, illumination images of different scales can be obtained, and then the three illumination images of different scales are weighted averaged to obtain the final image with illumination enhancement and noise elimination.

iii.老鼠活动区域检测:iii. Mouse activity area detection:

1)建立混合高斯厨房背景模型(201):1) Establishing a mixed Gaussian kitchen background model (201):

混合高斯背景建模采用为像素点建立K个高斯模型的方法来描述此像素点在某一时刻的状态,假设初始时刻某一像素点的像素值是Xt,概率函数的表达式如下:The mixed Gaussian background modeling uses the method of establishing K Gaussian models for pixels to describe the state of the pixel at a certain moment. Assuming that the pixel value of a pixel at the initial moment is Xt, the expression of the probability function is as follows:

该式中:Xt——t时刻样本像素观察值;In this formula: X t ——the observed value of the sample pixel at time t;

K——模型总数;K – total number of models;

I——模型序号;I——model number;

μi,t——模型的均值;μ i,t —mean of the model;

wi,t——模型的权重;w i,t ——weight of the model;

i,t——协方差矩阵;i, t —covariance matrix;

η(Xt,μi,t,∑i,t)——概率密度函数;η(X t , μ i,t , ∑ i,t )——probability density function;

P(Xt)——Xt的概率函数;P(X t )——Probability function of X t ;

通过上面式子的计算,建立了初始混合高斯厨房背景模型,以便后续背景模型的更新与差分。Through the calculation of the above formula, the initial mixed Gaussian kitchen background model is established to facilitate the subsequent updating and differentiation of the background model.

2)厨房背景更新(202):2) Kitchen background update (202):

将每个像素与各个高斯分布进行匹配运算,匹配运算公式如下:Each pixel is matched with each Gaussian distribution. The matching operation formula is as follows:

|Xti,t-1|≤λσi,t-1 |X ti,t-1 |≤λσ i,t-1 (5)(5)

该式中:λ为置信参数,μi,t-1为第i个高斯分布,σi,t-1为t-1时刻的均值和方差。In the formula: λ is the confidence parameter, μ i,t-1 is the i-th Gaussian distribution, and σ i,t-1 is the mean and variance at time t-1.

若该像素点的高斯分布与之相匹配,则对该高斯参数相匹配的参数做如下改变:If the Gaussian distribution of the pixel matches it, the parameters that match the Gaussian parameters are changed as follows:

该式中:a为学习速率,ρ为期望与方差的学习速率。In the formula: a is the learning rate, ρ is the expected and variance learning rate.

若不匹配,则说明出现了一种新的高斯分布,需要新建一个高斯分布与这个高斯分布相匹配,由于背景建模的高斯分布个数固定,需要将该高斯分布取代权重较小的高斯分布。新建的高斯分布的初始化参数为将待处理的像素的像数值赋为高斯分布的均值,同时赋予一个较大的方差和一个较小的权值。If there is no match, it means that a new Gaussian distribution has appeared. A new Gaussian distribution needs to be created to match this Gaussian distribution. Since the number of Gaussian distributions for background modeling is fixed, this Gaussian distribution needs to replace the Gaussian distribution with a smaller weight. The initialization parameters of the new Gaussian distribution are to assign the image value of the pixel to be processed to the mean of the Gaussian distribution, and to assign a larger variance and a smaller weight.

3)学习速率更新(203):3) Learning rate update (203):

根据厨房背景固定和老鼠目标较小特点,将厨房背景建模分为初始阶段和稳固阶段,根据时间段的不同采用不同的学习速率。According to the characteristics of fixed kitchen background and small mouse target, the kitchen background modeling is divided into the initial stage and the stable stage, and different learning rates are adopted according to different time periods.

a)在背景建模的初始阶段(n<N),背景建模处于逐渐形成的过程,这是时需要一个较大的学习速率来加速厨房背景模型的形成。但此时厨房背景尚未完全形成,方差和期望不易收敛过快,随着厨房背景的逐渐形成,学习速率逐渐递减,以此来使得背景模型逐渐稳定:a) In the initial stage of background modeling (n<N), the background modeling is in the process of gradual formation. At this time, a larger learning rate is needed to accelerate the formation of the kitchen background model. However, the kitchen background has not yet been fully formed, and the variance and expectation are not easy to converge too quickly. As the kitchen background gradually forms, the learning rate gradually decreases, so that the background model gradually stabilizes:

式中:λ1为衰减系数;n为当前流过的帧数;N为划分背景建模的初始阶段和稳固阶段的帧数分界线;α1为初始阶段的学习速率;ρ1为初始阶段期望与方差的学习速率;Where: λ 1 is the attenuation coefficient; n is the number of frames currently flowing; N is the dividing line between the initial stage and the stable stage of background modeling; α 1 is the learning rate in the initial stage; ρ 1 is the learning rate of the expectation and variance in the initial stage;

b)在背景稳固阶段(n≥N),厨房背景模型已经基本形成,由于厨房内老鼠活动可能会对固定的厨房背景产生一定的破坏,使得背景产生变化,需要对背景进行实时维护更新。背景的维护更新阶段根据模态像素变化的匹配次数与不匹配的次数作为反馈量来修正模型的学习速率。当不匹配时,反馈量为正值,以此来增大学习速率,加大对场景的学习;当匹配时,反馈量为负值,以此来减小学习速率,减弱对场景的学习,保证模型的稳定:b) In the background stabilization stage (n≥N), the kitchen background model has been basically formed. Since the activities of mice in the kitchen may cause certain damage to the fixed kitchen background, the background changes, and the background needs to be maintained and updated in real time. In the background maintenance and update stage, the number of matches and mismatches of modal pixel changes are used as feedback to correct the learning rate of the model. When there is a mismatch, the feedback is positive, which increases the learning rate and strengthens the learning of the scene; when there is a match, the feedback is negative, which reduces the learning rate and weakens the learning of the scene to ensure the stability of the model:

式中:λ2为学习率基准系数,ΔF=(2f-t)×10-2为反馈量,f为不匹配次数,t为匹配次数,;α2为稳固阶段的学习速率;ρ3为稳固阶段期望与方差的学习速率。Where: λ 2 is the learning rate reference coefficient, ΔF = (2f-t) × 10 -2 is the feedback amount, f is the number of mismatches, t is the number of matches, α 2 is the learning rate in the stable stage, and ρ 3 is the learning rate of the expectation and variance in the stable stage.

4)老鼠厨房前景背景差分(204):4) Mouse kitchen foreground and background difference (204):

将高斯分布优先级按照wi,ti,t的值从大到小排列,然后从排列在最前的一个模型开始,取B个高斯分布作为混合高斯分布的背景模型Arrange the Gaussian distribution priorities from large to small according to the value of w i,ti,t , and then start from the model at the front and take B Gaussian distributions as the background model of the mixed Gaussian distribution

式中:T为背景所占的比例。Where: T is the proportion of the background.

由于目标老鼠为运动目标,而背景为厨房,厨房为室内场景,不受室外光照影响,同时厨房内的物品很少挪动位置,背景变化较小,依据以上特点,将比例T设置为一个适中的值,减少目标老鼠被检测为噪声的可能。Since the target mouse is a moving target and the background is a kitchen, which is an indoor scene and is not affected by outdoor lighting, and the items in the kitchen rarely move, the background changes little. Based on the above characteristics, the ratio T is set to a moderate value to reduce the possibility of the target mouse being detected as noise.

进行前景检测时,选取B个高斯模型作为背景后,将当前帧的像数值与B个高斯背景模型分别进行比较,若该帧的像数值存在与背景模型相对应的高斯分布,这该像素点为背景点,否则为前景点。When performing foreground detection, after selecting B Gaussian models as the background, the image value of the current frame is compared with the B Gaussian background models respectively. If the image value of the frame has a Gaussian distribution corresponding to the background model, the pixel point is a background point, otherwise it is a foreground point.

5)差分图像二值化(205):5) Binarization of the difference image (205):

为了更好的区分前景和背景,需要对背景差分后的前景和背景进行不同的着色,将差分图像二值化,即将目标前景的像素点改为最大灰度值,背景像素点给为最小灰度值。In order to better distinguish the foreground and background, it is necessary to color the foreground and background differently after background difference, and binarize the difference image, that is, change the pixel points of the target foreground to the maximum gray value and the background pixel points to the minimum gray value.

6)形态学处理(206)6) Morphological processing (206)

为了去除二值化图像存在的细小尖刺和小颗粒噪点,对二值化后的图像进行形态学处理来得到完整的目标老鼠图像,首先对背景噪声先腐蚀掉,然后对前景噪声进行膨胀,消除噪声点和尖刺。In order to remove the tiny spikes and small particle noise points in the binary image, the binarized image is subjected to morphological processing to obtain the complete target mouse image. First, the background noise is eroded, and then the foreground noise is expanded to eliminate noise points and spikes.

7)边缘检测(207)7) Edge Detection (207)

将经过形态学处理后的差分图像进行边缘检测,提取被检测目标的轮廓图像,并计算出轮廓的面积。The differential image after morphological processing is subjected to edge detection, the contour image of the detected target is extracted, and the area of the contour is calculated.

iv.老鼠模板制作(104):iv. Mouse template production (104):

根据老鼠特定的形状特征,制作出正面,侧面,后面以及斜上面四个角度观测老鼠的轮廓图像。由于摄像机中观测到老鼠属于小目标,像素较小,根据这一特征,将老鼠轮廓图像的像素比设计为8×8,依据该像素比计算不同角度观测老鼠轮廓图像的轮廓内面积。According to the specific shape characteristics of the mouse, the outline images of the mouse are produced from the front, side, back and oblique angles. Since the mouse observed in the camera is a small target with small pixels, the pixel ratio of the mouse outline image is designed to be 8×8 based on this feature, and the inner area of the outline of the mouse outline image observed from different angles is calculated based on the pixel ratio.

v.老鼠匹配和判定(105):v. Mouse matching and determination (105):

首先将经过边缘检测后的轮廓图像与之前设计的四个不同角度观测的老鼠轮廓图像进行形状匹配,如果该图像与某一角度的观测的老鼠轮廓图像相似值小于0.1,则判定该图像可能存在目标老鼠,进入下一阶段。First, the contour image after edge detection is matched with the mouse contour images observed at four different angles designed previously. If the similarity value between the image and the mouse contour image observed at a certain angle is less than 0.1, it is determined that the image may contain the target mouse and enters the next stage.

将该图像轮廓内面积与上一阶段匹配的某一角度老鼠轮廓图像相对应的面积进行比较,如果两者面积误差小于10%,则判定该图像中的运动目标为老鼠。The area inside the image contour is compared with the area corresponding to the mouse contour image at a certain angle matched in the previous stage. If the area error between the two is less than 10%, the moving target in the image is determined to be a mouse.

二、创新点2. Innovation

1.根据厨房夜间光照强度较小和老鼠活动范围在下方图像的特点,设计出一种基于MSR的局部图像增强的方法,在消除噪声提升图像质量的同时,还能提高计算效率。基于混合高斯背景建模的方法,根据厨房背景固定和老鼠目标较小特点,在使用混合高斯背景建模的方法建立一个背景模型时,将学习速率变为一种自适应值,适应不同阶段背景的更新速度,以此来提取更加准确的老鼠差分图像,同时加快检测的速度,减少不必要的资源浪费。1. According to the characteristics of low light intensity at night in the kitchen and the mouse activity range in the lower image, a local image enhancement method based on MSR is designed to improve the computational efficiency while eliminating noise and improving image quality. Based on the mixed Gaussian background modeling method, according to the characteristics of fixed kitchen background and small mouse target, when using the mixed Gaussian background modeling method to establish a background model, the learning rate is changed to an adaptive value to adapt to the update speed of the background at different stages, so as to extract more accurate mouse differential images, speed up the detection speed, and reduce unnecessary resource waste.

2.在目标匹配阶段依据具体问题具体分析,根据厨房场景固定以及老鼠活动角度不同的特点,制作出不同角度的老鼠轮廓图像并将其与边缘检测后的轮廓图像匹配,以边缘检测后的轮廓图像的形状面积是否与某一角度的轮廓形状和面积匹配来判断该帧图像中是否存在老鼠,通过双重匹配机制来提高识别的准确率。2. In the target matching stage, we analyze specific problems based on specific situations. Based on the characteristics of a fixed kitchen scene and different angles of mouse activity, we produce mouse outline images at different angles and match them with the outline image after edge detection. We determine whether there is a mouse in the frame image by whether the shape and area of the outline image after edge detection matches the shape and area of the outline at a certain angle. We use a double matching mechanism to improve recognition accuracy.

Claims (4)

1. A kitchen mouse detection and recognition method based on local MSR and target matching comprises the steps of monitoring image extraction, image low illumination enhancement, mouse activity area detection, mouse template manufacturing, mouse matching and judgment, and is characterized in that: the monitoring image extraction is to transmit video images in a video camera to a computer through a video image acquisition card, and then convert the video images into an image sequence of continuous frames;
The mouse activity area detection is as follows: constructing K Gaussian distribution models for each pixel point of the preprocessed image, wherein K is equal to 3 or 5, so that a mixed Gaussian background model is formed; matching the K Gaussian distributions of the pixel points of the current frame with the K Gaussian distributions of the background pixel points, if the matched Gaussian distribution meets the background requirement, the pixel points are the background, otherwise, the pixel points are the foreground, if no Gaussian distribution is matched with the background, a new Gaussian distribution appears at the moment, and then the Gaussian distribution with the minimum weight in the background Gaussian distribution is replaced by the distribution; after the background difference is finished, the background model is required to be updated, the Gaussian distribution of the current pixel point is required to be compared with the existing Gaussian distribution to update the background model, if the Gaussian distribution is matched with a certain Gaussian distribution, the mean value, the weight and the variance of the Gaussian distribution are correspondingly updated, and if the Gaussian distribution is not matched with the certain Gaussian distribution, a new Gaussian distribution appears, and the Gaussian distribution with the minimum weight is required to be replaced by the Gaussian distribution; dividing the background modeling process into an initial stage and a stable stage, wherein a larger learning rate is required in the initial stage of the background, and a smaller learning rate is required in the stable stage of the background; differentiating a foreground image from the preprocessed image of each frame according to the established Gaussian mixture model as a background; carrying out morphological processing on the image after the difference, then carrying out edge detection on the processed image, and extracting outline information of the difference image;
The mouse template manufacturing comprises the following steps: designing four mouse contour images with different angles according to shape differences of mice with different angles, and performing shape matching on the extracted contour information of the moving object and the four mouse contour images; according to the characteristic of small mouse body size and small occupied pixel points, reducing designed contour images and calculating contour areas with different angles;
The mouse matching and determination includes: matching the outline information of the differential image with four mouse templates, comparing the outline area corresponding to the outline image of the mouse with higher matching with the outline area of the extracted moving object, and judging the moving object as the mouse if the difference between the outline area and the outline area of the extracted moving object is smaller;
The image low-illumination enhancement comprises the steps that after the time for detecting mice in a kitchen is in the night and after the time is out of work, exposure conditions are insufficient, the obtained image is a low-illumination image, and image enhancement processing is needed to be carried out on each frame of image, so that image noise is eliminated, and image quality is improved; because most mice in the kitchen move on the cooking bench and the ground and are positioned below the monitoring, only the images below the mice are subjected to enhancement processing, so that unnecessary operation is reduced, and the operation efficiency is improved; firstly, the pixel size of each frame of image is the same, and the pixel size of the first frame of image is only needed to be calculated, and the vertical pixels of the image are divided into an upper image and a lower image by a rounding method; MSR image enhancement is carried out on the segmented lower image, three Gaussian filter functions with different scales are adopted, each filter function has different scale parameters, convolution operation is carried out on the low-light image by using the three Gaussian filter functions, illumination images with different scales can be obtained after the operation is finished, and then a plurality of illumination images with different scales are weighted and averaged to obtain a final illumination image, such as formula (1) and formula (2):
In the formula (1) and the formula (2), n is 3, n represents the number of gaussian S i (x, y) convolution functions, typically 3 are used to represent the small, medium and large three scales respectively, W n represents the weight of each scale, k n represents the normalization factor of different scales, c n represents different scale parameters, G n (x, y, c) represents n different gaussian functions, and S i (x, y) represents the component of the i-th channel in the low-light image;
After the operation is finished, illumination images with different scales can be obtained, and then three illumination images with different scales are weighted and averaged to obtain a final image with illumination enhancement and noise elimination.
2. The kitchen mouse detection and recognition method based on local MSR and target matching according to claim 1, wherein the image low-illumination enhancement is to divide each frame of image in a horizontal direction by adopting a non-uniform division method to obtain an upper image and a lower image, and the lower image is subjected to image enhancement by adopting an MSR method.
3. The method for kitchen mouse detection and recognition based on local MSR and object matching of claim 1, wherein the mouse activity area detection comprises learning rate update: according to the characteristics of kitchen background fixation and small mouse targets, kitchen background modeling is divided into an initial stage and a stable stage, and different learning rates are adopted according to different time periods.
4. The method for kitchen mouse detection and recognition based on local MSR and object matching according to claim 1, wherein the mouse template making comprises: according to the specific shape characteristics of the mice, the contour images of the mice are observed at four angles of the front, the side, the back and the inclined upper surface; since the rat is observed in the camera to belong to a small target, the pixel is smaller, the pixel ratio of the mouse outline image is designed to be 8 multiplied by 8 according to the characteristic, and the outline inner area of the mouse outline image is observed at different angles according to the pixel ratio.
CN202210641604.9A 2022-06-08 2022-06-08 A kitchen rat detection and recognition method based on local MSR and target matching Active CN115035446B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210641604.9A CN115035446B (en) 2022-06-08 2022-06-08 A kitchen rat detection and recognition method based on local MSR and target matching

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210641604.9A CN115035446B (en) 2022-06-08 2022-06-08 A kitchen rat detection and recognition method based on local MSR and target matching

Publications (2)

Publication Number Publication Date
CN115035446A CN115035446A (en) 2022-09-09
CN115035446B true CN115035446B (en) 2024-08-09

Family

ID=83122122

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210641604.9A Active CN115035446B (en) 2022-06-08 2022-06-08 A kitchen rat detection and recognition method based on local MSR and target matching

Country Status (1)

Country Link
CN (1) CN115035446B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN118941822B (en) * 2024-10-12 2024-12-13 成都考拉悠然科技有限公司 Mouse detection method and system based on multi-frame judgment and multi-feature matching

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2017000466A1 (en) * 2015-07-01 2017-01-05 中国矿业大学 Method and system for tracking moving target based on optical flow method
CN111462169A (en) * 2020-03-27 2020-07-28 杭州视在科技有限公司 Mouse trajectory tracking method based on background modeling

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105354862B (en) * 2015-09-30 2018-12-25 深圳大学 The shadow detection method of moving target, system in a kind of monitor video
CN111310665A (en) * 2020-02-18 2020-06-19 深圳市商汤科技有限公司 Violation event detection method and device, electronic equipment and storage medium

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2017000466A1 (en) * 2015-07-01 2017-01-05 中国矿业大学 Method and system for tracking moving target based on optical flow method
CN111462169A (en) * 2020-03-27 2020-07-28 杭州视在科技有限公司 Mouse trajectory tracking method based on background modeling

Also Published As

Publication number Publication date
CN115035446A (en) 2022-09-09

Similar Documents

Publication Publication Date Title
CN115082683B (en) Injection molding defect detection method based on image processing
CN105718945B (en) Apple picking robot night image recognition method based on watershed and neural network
CN106199557B (en) A kind of airborne laser radar data vegetation extracting method
CN107909081B (en) A fast acquisition and fast calibration method for image datasets in deep learning
CN104715239B (en) A kind of vehicle color identification method based on defogging processing and weight piecemeal
CN111104943B (en) Color image region-of-interest extraction method based on decision-level fusion
CN110837768B (en) An online detection and identification method for rare animal protection
CN103942557B (en) A kind of underground coal mine image pre-processing method
CN108319966B (en) A method for identifying and classifying equipment in infrared images of complex backgrounds in substations
CN108009509A (en) Vehicle target detection method
CN110288538A (en) A shadow detection and elimination method for moving objects based on multi-feature fusion
CN106169081A (en) A kind of image classification based on different illumination and processing method
CN105513053B (en) One kind is used for background modeling method in video analysis
CN106529568A (en) Pearl multi-classification method based on BP neural network
CN108805826B (en) Method for improving defogging effect
CN101630411B (en) Automatic threshold value image segmentation method based on entropy value and facing to transmission line part identification
CN107092876A (en) The low-light (level) model recognizing method combined based on Retinex with S SIFT features
CN108062508B (en) Extraction method of equipment in substation complex background infrared image
CN109035254A (en) Based on the movement fish body shadow removal and image partition method for improving K-means cluster
CN112906550B (en) A Static Gesture Recognition Method Based on Watershed Transform
CN103971367B (en) Hydrologic data image segmenting method
CN114842262A (en) Laser point cloud ground object automatic identification method fusing line channel orthographic images
CN106503748A (en) A kind of based on S SIFT features and the vehicle targets of SVM training aids
CN108335294A (en) The power distribution room abnormality image-recognizing method of complex condition
CN106570885A (en) Background modeling method based on brightness and texture fusion threshold value

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