CN-116416265-B - Pedestrian image accurate segmentation method based on contour attribute characteristics
Abstract
The invention relates to the technical field of computer vision and discloses a pedestrian image accurate segmentation method based on contour attribute characteristics, which comprises the steps of obtaining an image with a pedestrian as an original image; the method comprises the steps of performing binarization on an original image to obtain a binarized image, sequentially performing edge detection on the image, local processing and fusion on the edge of the image to perform image contour extraction on the binarized image to obtain a contour image, performing contour feature extraction on the contour image to obtain a contour feature image, training a pedestrian and background contour classifier, and identifying the contour of a pedestrian according to the pedestrian and background contour classifier to obtain a pedestrian mask so as to separate the pedestrian from the background according to the pedestrian mask. The pedestrian image accurate segmentation method based on the contour attribute features provided by the invention does not need to be driven by a large amount of data, only needs to collect a small amount of data in the fixed scene, reduces the overfitting of the model, improves the segmentation effect, directly outputs the segmentation result, and does not need a complex decoding process.
Inventors
- WANG MIN
- CHENG TAOMU
- WANG JINGHUI
- CHEN NING
- WU LIANG
- MAO TAO
Assignees
- 博瑞得科技有限公司
Dates
- Publication Date
- 20260505
- Application Date
- 20230406
Claims (9)
- 1. The pedestrian image accurate segmentation method based on the contour attribute features is characterized by comprising the following steps of: acquiring an image with pedestrians as an original image; binarizing the original image to convert the original image into a binarized image; Sequentially carrying out edge detection of the images and local processing and fusion of the edges of the images on the binarized images so as to extract image contours of the binarized images and obtain contour images; Extracting contour features of the contour image to obtain a contour feature image, wherein the contour feature extraction comprises calculating contour centroid, center moment, contour area, contour perimeter, contour circumscribed rectangle, contour area-circumscribed rectangle area ratio and contour area-bulge area ratio; training a pedestrian and background contour classifier, and identifying the contour of the pedestrian according to the pedestrian and background contour classifier to obtain a pedestrian mask so as to separate the pedestrian from the background according to the pedestrian mask, wherein the method specifically comprises the following steps: Training sample data x i ∈R p of two categories of pedestrians and backgrounds in different scenes, i=1,..n and a label vector y e {1, -1} n of the samples, where 1 indicates that the contour belongs to a pedestrian, -1 indicates that the contour belongs to the background, the goal is to get a set of parameters w e R p and b e R, and then bring the contour features into the calculation: the outline of the pedestrian can be correctly distinguished; Classification of contours is achieved by the SVC algorithm: y i (w T φ(x i )+b)≥1-ζ i ,ζ i ≥0,i=1,...,n Wherein ζ is a function interval, C is a regular term, n is the number of sample data, i is a sample index, from 1 to n, ζ i is a function interval of an ith sample, y i is a sample label of the ith sample, and x i is the ith sample data; by maximizing the interval i w 2 =w T w, the classifier predicts the class of the contour as accurately as possible, while adding the regularization term C, the problem can be expressed as: Solving the formula to obtain an optimal parameter, wherein w * b * is the optimal parameter; inputting the feature vector x of each contour according to the pedestrian and background contour classifier, and outputting a classification result Filtering out the outline of the pedestrian, obtaining the mask of the pedestrian according to the coordinates of the outline, and separating the pedestrian from the background according to the mask.
- 2. The pedestrian image accurate segmentation method based on the contour attribute features of claim 1, wherein the step of binarizing the original image to convert the original image into a binarized image includes: converting the original image from RGB to Gray scale image, wherein the formula is gray= (R299+G 587+B 114)/1000; Calculating a histogram of the image intensity according to the gray level image, wherein the X axis of the histogram is a pixel value, and the Y axis is the number of pixels with the pixel value in the gray level image; A global threshold is determined from the histogram of image intensities to binarize the gray scale image pixels, mapping the pixels to [0,255].
- 3. The method for precisely segmenting the pedestrian image based on the contour attribute features according to claim 1, wherein the step of sequentially performing edge detection of the image, local processing and fusion of the image edges on the binarized image to extract the image contour of the binarized image and obtain the contour image is characterized in that the step of performing edge detection of the image on the binarized image comprises the steps of: Calculating gradient information of the binarized image by adopting a circular two-dimensional Gaussian function smooth image, and estimating edge intensity and direction at each point according to gradient amplitude and direction of the binarized image, wherein the input binarized image is represented by f (x, y), and the Gaussian smoothing function is represented by G (x, y): The gaussian smoothed image f s (x, y) is obtained by convolution filtering: calculating a gradient value, a gradient amplitude and an edge direction of the smoothed image: Wherein g x 、g y represents two gradients in the horizontal and vertical directions of the smoothed image, M (x, y) represents the magnitude of the gradient, and α (x, y) represents the direction of the gradient; Refining the edge through non-maximum suppression, and performing 3X 3 local non-maximum suppression on an edge angle matrix alpha (x, y) of the image, wherein d 1 ,d 2 ,d 3 ,d 4 represents four directions in a 3X 3 region, namely 0 degree, -45 degrees, 90 degrees and 45 degrees; Non-maximum suppression is performed for a3 x 3 region centered on each coordinate (x, y) of the edge angle matrix.
- 4. A pedestrian image accurate segmentation method based on contour attribute features as set forth in claim 3, wherein the step of performing non-maximum suppression for a 3 x 3 region centered on each coordinate (x, y) of the edge angle matrix includes: finding the basic direction d k ,d k closest to α (x, y) as one of four directions { d 1 ,d 2 ,d 3 ,d 4 }; If the value of M (x, y) is at least smaller than one of two adjacent amplitude values along the d k direction, the gradient amplitude value is restrained, and g N (x, y) =0, otherwise, the amplitude value is kept unchanged, wherein g N (x, y) is an amplitude matrix obtained by restraining the non-maximum amplitude value; thresholding g N (x, y) reduces false edge points, and all remaining magnitude points in g N (x, y) are assumed to be valid edge pixel points.
- 5. The method for precisely segmenting the pedestrian image based on the contour attribute features according to claim 1, wherein the step of sequentially performing edge detection, local processing of image edges and fusion of the binarized image to extract the image contour of the binarized image and obtain the contour image is characterized in that the step of performing local processing and fusion of the image edges on the binarized image comprises the steps of: calculating a gradient amplitude matrix M (x, y) and a gradient angle matrix alpha (x, y) of the input binarized image f (x, y); A pair of binary images g (x, y) is formed, wherein the value at any coordinate pair (x, y) is given by: wherein T M represents an amplitude threshold, A represents a specified angular direction, and + -T A represents an angular acceptable range; Traversing rows of g (x, y) and filling all slots in each row not exceeding a specified length; In a preset direction Upper detection slit to the direction Rotating the binary image g (x, y), repeating the steps of traversing the lines of the rotated binary image g (x, y) and filling all the gaps in each line not exceeding a specified length, and in the opposite direction Rotating the binary image g (x, y); Repeating the steps to obtain the edge connection matrix.
- 6. The pedestrian image accurate segmentation method based on the contour attribute features of claim 1, wherein the step of extracting the contour features of the contour image to obtain the contour feature image comprises the following steps: calculating the centroid and the center moment of the profile, wherein the calculation formula is as follows: Wherein, the For centroid coordinates of the contour, M 00 is zero-order moment of the contour, M 10 、M 01 is first-order moment of the contour, u pq is center moment, pix (x,y) is pixel value at x, y of the contour; Calculating the area of the outline area: calculating the perimeter of the outline and the outline bounding rectangle, and determining the aspect ratio: wherein Aspect Ratio is the Aspect Ratio of the outline circumscribed rectangle, width is the Width of the circumscribed rectangle, and Height is the Height of the circumscribed rectangle; calculating the ratio of the outline area to the circumscribed matrix area: Wherein ContourArea is the area of the outline, bounding RECTANGLE AREA is the area of the outline circumscribed rectangle; calculating the ratio of the contour area to the convex area: Wherein Convex Hull Area is the area of the bump.
- 7. The pedestrian image accurate segmentation device based on the contour attribute features, based on the pedestrian image accurate segmentation method based on the contour attribute features as set forth in any one of claims 1 to 6, comprising: the acquisition module is used for acquiring an image with pedestrians as an original image; The binarization module is used for binarizing the original image to convert the original image into a binarized image; the first extraction module is used for sequentially carrying out edge detection on the binarized image, local processing and fusion on the image edge so as to extract the image contour of the binarized image and obtain a contour image; The second extraction module is used for extracting the contour features of the contour image to obtain a contour feature image; And the separation module is used for training the pedestrian and background profile classifier, identifying the pedestrian profile according to the pedestrian and background profile classifier, and obtaining a pedestrian mask so as to separate the pedestrian from the background according to the pedestrian mask.
- 8. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor implements the steps of the method of any of claims 1 to 6 when the computer program is executed.
- 9. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any of claims 1 to 6.
Description
Pedestrian image accurate segmentation method based on contour attribute characteristics Technical Field The invention relates to the technical field of computer vision, in particular to a pedestrian image accurate segmentation method based on contour attribute characteristics. Background In the field of computer vision, image segmentation has important technical support in the fields of image processing, automatic driving, robots and the like. The image segmentation of pedestrians is to divide pedestrians and the background in the image into different areas according to the characteristics of gray scale, contour, texture and the like of the image, so that the pedestrians and the background are separated. The current image segmentation method based on deep learning is mainly divided into two main categories, namely two-stage and one-stage. The whole process is divided into two stages as the name implies, namely, firstly, a region where a target (such as a pedestrian) is located is found through a target detection method, and then semantic segmentation is carried out in the target region, wherein the representative methods are Mask-RCNN, PANet and FCIS. The One-stage method is similar to the single-stage target detection method, is an end-to-end thought, inputs are images, outputs are segmentation results of each instance, and representative methods are YOLACT, SOLO and FCOS. The problems and difficulties of the current image segmentation task are that 1, a method based on deep learning needs massive data support, the deep learning is driven by data, and the data marking cost is high. 2. The deep learning method is easy to overfit, and good results can be obtained in open source data easily, but in practical application, the model generalization effect is reduced due to the distribution difference of the data. 3. The result post-processing of the deep learning model is complicated, the model output is generally a high-dimensional matrix and is not a direct segmentation result, and the result decoding process is complicated. Disclosure of Invention The invention provides a pedestrian image accurate segmentation method based on contour attribute characteristics, which does not need a large amount of data to drive, only needs to collect a small amount of data in the fixed scene, reduces the overfitting of a model, improves the segmentation effect, directly outputs the segmentation result, and does not need a complex decoding process. The invention provides a pedestrian image accurate segmentation method based on contour attribute characteristics, which comprises the following steps: acquiring an image with pedestrians as an original image; binarizing the original image to convert the original image into a binarized image; Sequentially carrying out edge detection of the images and local processing and fusion of the edges of the images on the binarized images so as to extract image contours of the binarized images and obtain contour images; Extracting contour features of the contour image to obtain a contour feature image; and training a pedestrian and background profile classifier, and identifying the profile of the pedestrian according to the pedestrian and background profile classifier to obtain a pedestrian mask so as to separate the pedestrian from the background according to the pedestrian mask. Further, the step of binarizing the original image to convert the original image into a binarized image includes: converting the original image from RGB to Gray scale image, wherein the formula is gray= (R299+G 587+B 114)/1000; Calculating a histogram of the image intensity according to the gray level image, wherein the X axis of the histogram is a pixel value, and the Y axis is the number of pixels with the pixel value in the gray level image; A global threshold is determined from the histogram of image intensities to binarize the gray scale image pixels, mapping the pixels to [0,255]. Further, the step of sequentially performing edge detection of the image, local processing and fusion of the image edge on the binarized image to extract an image contour of the binarized image and obtain a contour image includes: Calculating gradient information of the binarized image by adopting a circular two-dimensional Gaussian function smooth image, and estimating edge intensity and direction at each point according to gradient amplitude and direction of the binarized image, wherein the input binarized image is represented by f (x, y), and the Gaussian smoothing function is represented by G (x, y): The gaussian smoothed image f s (x, y) is obtained by convolution filtering: calculating a gradient value, a gradient amplitude and an edge direction of the smoothed image: Wherein g x、gy represents two gradients in the horizontal and vertical directions of the smoothed image, M (x, y) represents the magnitude of the gradient, and α (x, y) represents the direction of the gradient; Refining the edge through non-maximum suppression, an