Multi-scene video image texture feature extraction method based on attention mechanism
By adopting the multi-scene video image texture feature extraction method based on attention mechanism in monitoring scenes with uneven lighting, a new texture feature vector is generated using Gaussian filters and mode values, which solves the problem of low texture classification accuracy and realizes the Improve the accuracy of texture feature extraction.
Patent Information
- Application Number
- CN202510045127.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-13
- Publication Date
- 2025-02-21
- Estimated Expiration
- 2045-01-13
AI Technical Summary
In monitoring scenarios with uneven lighting, the accuracy of texture classification is low, which affects the extraction accuracy of texture features in the image.
Using the multi-scene video image texture feature extraction method based on attention mechanism, Gaussian filter images of multiple scales are constructed through Gaussian filters, the annular neighborhood radius and global contrast of each pixel point are determined, and the plus and negative binary mode values are used. 和幅度二值模式值生成新的纹理特征向量,输入基于注意力机制的神经网络模型进行目标识别。
It reduces the impact of light on texture extraction, improves the accuracy of texture classification, and thus improves the extraction accuracy of texture features in the image.
Smart Images

Figure CN119494969A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing technology, and in particular to a method for extracting texture features from multi-scene video images based on an attention mechanism. Background Art
[0002] Texture is used to describe the arrangement and statistical characteristics of pixel values in a local area of an image. Texture reflects the roughness, smoothness, and regularity of the surface in the image. Texture features usually include grayscale distribution, spatial arrangement, and frequency components.
[0003] In some scenarios, a texture feature extraction method based on an attention mechanism is often used to extract texture features from an image. In this method, the initial operation is to extract texture features using the Center-Symmetric Local Binary Pattern (CLBP), in which obtaining the image comparison map is a relatively important step. When obtaining the image comparison map, the image comparison map is obtained by comparing the pixel points with the global pixel. In monitoring scenes with uneven illumination distribution, it is easy to lose the texture of local details of the image. For example, the grayscale of the pixel in the area with strong illumination is higher, while the grayscale of the pixel in the area with low illumination is lower. In this way, the same texture will appear similar in different areas, or different textures in different areas will appear similar. When the texture is finally classified, it is difficult to distinguish the textures in different areas, resulting in low accuracy of texture classification, which in turn affects the accuracy of texture feature extraction in the image. Summary of the invention
[0004] In order to solve the technical problem that the accuracy of texture classification is low, which in turn affects the extraction accuracy of texture features in images, the purpose of the present invention is to provide a multi-scene video image texture feature extraction method based on an attention mechanism. The technical solution adopted is as follows: In a first aspect, an embodiment of the present invention provides a multi-scene video image texture feature extraction method based on an attention mechanism, including: obtaining a local image that needs to be identified from a surveillance video screen of a target area; determining the global contrast of each pixel point according to the grayscale value of each pixel point in the local image; constructing Gaussian filtered images of multiple scales of the local image through a Gaussian filter, taking each pixel point in the Gaussian filtered image as the center pixel, and determining the annular neighborhood radius of each pixel point; selecting the direction of the point with the largest amplitude difference in grayscale value between each pixel point within the range corresponding to the annular neighborhood radius and the center pixel point within the range corresponding to the annular neighborhood radius as the dominant direction, and determining the positive and negative binary pattern values and the amplitude binary pattern value of any pixel point; determining a new texture feature vector of the local image according to the global contrast, positive and negative binary pattern values, and amplitude binary pattern values of each pixel point in the Gaussian filtered image of each scale; inputting the new texture feature vector into a neural network model based on the attention mechanism, and identifying the target in the local image through the neural network model.
[0005] Optionally, determining the global contrast of each pixel based on the grayscale value of each pixel in the local image includes: determining a contrast neighborhood radius of each pixel based on the grayscale value of each pixel in the local image; determining the global contrast of each pixel based on the grayscale value of each pixel and the grayscale values of all pixels within a range corresponding to the contrast neighborhood radius corresponding to each pixel.
[0006] Optionally, determining the comparison neighborhood radius of each pixel point according to the grayscale value of each pixel point in the local image includes: determining the light intensity attenuation rate of each column in the local image according to the grayscale values of adjacent pixels in the same column of the local image; determining the average of the light intensity attenuation rates of all columns as the vertical attenuation rate of the local image, and determining the horizontal attenuation rate of the local image as a preset value; determining the predicted grayscale value of the pixel points in the current row according to the grayscale value of the pixel points in the previous row of the current row in the same column and the vertical attenuation rate; determining the grayscale difference of each pixel point according to the grayscale value and the predicted grayscale value of each pixel point; determining the neighborhood range of each pixel point, and determining the first mean value of the grayscale differences of all pixels in the neighborhood range; determining the degree of texture change of each pixel point according to the grayscale difference of each pixel point and the first mean value of the neighborhood range of each pixel point; classifying each pixel point according to the degree of texture change to obtain multiple texture classifications; determining the core degree of the texture where the pixel point is located by using the distance between any pixel point in the same texture classification and other pixel points in the same texture classification; determining the comparison neighborhood radius of the pixel point according to the preset comparison neighborhood radius and the core degree of the texture where the pixel point is located.
[0007] Optionally, determining the light intensity attenuation rate of each column in the local image based on the grayscale values of adjacent pixels in the same column of the local image includes: calculating a first difference between the grayscale values of adjacent pixels in the same column of the local image, and superimposing each first difference to obtain a first superimposed value; normalizing the first superimposed value to obtain the light intensity attenuation rate of each column in the local image.
[0008] Optionally, determining the degree of texture change of each pixel based on the grayscale difference of each pixel and the first mean of the neighborhood range of each pixel includes: calculating the absolute value of the second difference between the first mean and the grayscale difference of the pixel, and calculating a first ratio of the grayscale difference of the pixel to the sum of the absolute value of the second difference and a predetermined value; normalizing the first ratio to obtain the degree of texture change of the pixel.
[0009] Optionally, using the distance between any pixel point in the same texture classification and other pixel points in the same texture classification to determine the core degree of the texture in which the pixel point is located includes: superimposing the distance between any pixel point in the same texture classification and other pixel points in the same texture classification to obtain a second superimposed value; normalizing the second superimposed value to obtain the core degree of the texture in which the pixel point is located.
[0010] Optionally, determining the comparison neighborhood radius of a pixel point based on a preset comparison neighborhood radius and the core degree of the texture where the pixel point is located includes: calculating a first product of the preset comparison neighborhood radius and the inverse of the core degree of the texture where the pixel point is located; and determining the sum of the preset comparison neighborhood radius and the first product as the comparison neighborhood radius of the pixel point.
[0011] Optionally, determining the global contrast of each pixel based on the grayscale value of each pixel and the grayscale values of all pixels within a range corresponding to a contrast neighborhood radius corresponding to each pixel includes: determining a second mean of the grayscale values of all pixels within a range corresponding to the contrast neighborhood radius; determining the global contrast of each pixel based on the grayscale value of each pixel and the second mean within a range corresponding to the contrast neighborhood radius corresponding to each pixel.
[0012] Optionally, determining the global contrast of each pixel based on the grayscale value of each pixel and the second mean within the range corresponding to the contrast neighborhood radius corresponding to each pixel includes: when the grayscale value of the pixel is greater than or equal to the second mean, determining the global contrast of the pixel as a first value; when the grayscale value of the pixel is less than the second mean, determining the global contrast of the pixel as a second value.
[0013] Optionally, determining a new texture feature vector of a local image based on the global contrast, positive and negative binary pattern values, and amplitude binary pattern values of each pixel in the Gaussian filtered image of each scale includes: determining the feature vector of the Gaussian filtered image of each scale based on the global contrast, positive and negative binary pattern values, and amplitude binary pattern values of each pixel in the Gaussian filtered image of each scale; and fusing the feature vectors of the Gaussian filtered images of each scale to obtain a new texture feature vector.
[0014] The invention has the following beneficial effects: firstly, a local image for target recognition is obtained from a surveillance video screen of a target area; then, the global contrast of each pixel is determined according to the gray value of each pixel in the local image; then, Gaussian filter images of multiple scales of the local image are constructed by a Gaussian filter, and each pixel in the Gaussian filter image is used as a central pixel to determine the annular neighborhood radius of each pixel; secondly, the direction of the point with the largest difference in gray value between each pixel in the range corresponding to the annular neighborhood radius and the central pixel in the range corresponding to the annular neighborhood radius is selected as the dominant direction, and the positive and negative binary mode values and the amplitude binary mode values of any pixel are determined; and according to the global contrast, positive and negative binary mode values and amplitude binary mode values of each pixel in the Gaussian filter image of each scale, a new texture feature vector of the local image is determined; finally, the new texture feature vector is input into a neural network model based on an attention mechanism, and the target in the local image is recognized by the neural network model.
[0015] In this way, the embodiment of the present invention can determine the fine global contrast of the preliminary texture of the local image in the monitoring screen according to the change of illumination, and determine the new texture feature vector of the local image according to the global contrast, the positive and negative binary pattern values of the local image, and the amplitude binary pattern value, thereby reducing the influence of illumination on texture extraction. Finally, based on the new texture feature vector, the neural network model of the attention mechanism is used to identify the target in the local image. This will cause the same texture to behave similarly in different areas, or different textures in different areas to behave similarly. In this way, the embodiment of the present invention can distinguish the textures of different areas, improve the accuracy of texture classification, and then improve the extraction accuracy of texture features in the image. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] In order to more clearly illustrate the technical solutions and advantages in the embodiments of the present invention or the prior art, the drawings required for use in the embodiments or the prior art descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0017] Figure 1A flowchart of a method for extracting texture features from multi-scene video images based on an attention mechanism is provided for one embodiment of the present invention; Figure 2 A schematic diagram of the installation of a camera provided by one embodiment of the present invention; Figure 3 A schematic diagram of a selection method when the radius of a circular neighborhood is 1 provided in one embodiment of the present invention; Figure 4 A schematic diagram of a selection method when the radius of an annular neighborhood is 3 provided in one embodiment of the present invention; Figure 5 A schematic diagram of the structure of a multi-scene video image texture feature extraction system based on an attention mechanism is provided for one embodiment of the present invention. DETAILED DESCRIPTION
[0018] In order to further explain the technical means and effects adopted by the present invention to achieve the predetermined invention purpose, the following is a detailed description of the specific implementation method, structure, features and effects of a multi-scene video image texture feature extraction method based on an attention mechanism proposed by the present invention in combination with the accompanying drawings and preferred embodiments. In the following description, different "one embodiment" or "another embodiment" does not necessarily refer to the same embodiment. In addition, specific features, structures or characteristics in one or more embodiments may be combined in any suitable form.
[0019] Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs.
[0020] The following is a detailed description of a method for extracting texture features from multi-scene video images based on an attention mechanism provided by the present invention in conjunction with the accompanying drawings.
[0021] Embodiment 1: See also Figure 1 , which shows a flowchart of a multi-scene video image texture feature extraction method based on an attention mechanism provided by an embodiment of the present invention, including: S101, obtaining a local image that needs to be identified from a surveillance video of a target area.
[0022] Specifically, the target area can be an area that needs to be monitored in any scenario. A camera can be installed in the target area to capture video images, and the video images include multiple monitoring video screens, each of which is a separate image, which contains a partial image that needs to be identified. For example, a monitoring video screen includes a complete body image of a worker, wherein the partial image is a head image of the complete body image, and the target to be identified in the head image is the texture of the safety helmet in the complete body image. Among them, depending on the actual scene, the monitoring video screen and the partial image that needs to be identified can also be other types, and the embodiments of the present invention are not limited here.
[0023] Furthermore, when capturing surveillance video images of the target area, a camera may be installed to capture video images. For example, Figure 2 As shown, Figure 2 A schematic diagram of the installation of a camera provided in one embodiment of the present invention. The width of the camera entrance is X in this embodiment of the present invention, the distance between the camera and the monitoring entrance is D, the height of the camera from the ground is H, and the angle of the camera is Not more than 15 degrees.
[0024] Exemplarily, the relationship among the monitoring width, installation distance and maximum height at the monitoring entrance in the embodiment of the present invention may be shown in Table 1 below.
[0025] Table 1 Relationship between monitoring width, installation distance and maximum height For example, at the gate of a certain community, the width of the monitored entrance and exit is measured to be 2 meters, and the distance between the monitoring probe installed at the gate of the community and the opposite side can be greater than 2 meters to 3 meters. Referring to Table 1 of the embodiment of the present invention, the following steps are performed to query and determine the point position: first, determine that the monitoring width of the entrance and exit is 2 meters; then consult Table 1 to know that it can be installed at a distance of 1.5 meters to 3 meters from the entrance and exit; secondly, choose to install a texture feature intelligent recognition monitoring probe at a distance of 3 meters from the entrance and exit; consult Table 1 again to know that the installation height must not be higher than 2.2 meters; choose to install a texture feature intelligent recognition monitoring probe at a height of 2 meters; finally, adjust the angle of the monitoring probe so that the portrait standing at the entrance and exit is in the center of the picture, and Using the surveillance video images obtained by the camera, select the local image that needs to be identified and convert the local image into grayscale.
[0026] S102, determining the global contrast of each pixel point according to the gray value of each pixel point in the local image.
[0027] Specifically, the local image obtained by the above embodiment of the present invention is usually easy to cause uneven illumination distribution of the captured picture due to the working environment of the camera, and the grayscale of the obtained image changes gradually, which affects texture recognition. On the one hand, since the light source comes from the lighting fixture above the door monitoring, the light generated by the lamp is from top to bottom, which causes the grayscale value in the local area of the image to darken from top to bottom. If the selected image is the same texture, it has a more obvious grayscale monotonous change trend. Therefore, when the monotonous change trend generated by a certain pixel point is abnormal, it may be a texture pixel point. On the other hand, the distribution of texture is continuous, and the area where the pixel points with higher continuity distribution are located may be the same texture. Therefore, firstly, the degree of change of the pixel point is estimated according to the global image, and then the distribution of the texture is determined according to the degree of change, and finally the comparison range of each pixel point is obtained. In addition, due to the operating characteristics of monitoring, it needs to run 24 hours without interruption. When it is in an environment with poor lighting, such as night monitoring, the artificial light source in a fixed direction of the monitoring area is used to achieve lighting, and then the image is obtained. Since the light for this type of image is irradiated from a single direction, the texture of this type of image is brighter on the top and darker on the bottom. At this time, if a global unified contrast area is used to implement image segmentation to obtain a contrast map, the effect of the contrast map is poor, and more texture information is lost in the darker or brighter areas.
[0028] Furthermore, when determining the global contrast of each pixel, as an optional embodiment of the present invention, the contrast neighborhood radius of each pixel is first determined based on the grayscale value of each pixel in the local image; then the global contrast of each pixel is determined based on the grayscale value of each pixel and the grayscale values of all pixels within the corresponding range of the contrast neighborhood radius corresponding to each pixel.
[0029] Among them, when determining the comparison neighborhood radius of each pixel point, as an optional embodiment of the present invention, the light intensity attenuation rate of each column in the local image is determined according to the grayscale values of adjacent pixels in the same column of the local image; the average of the light intensity attenuation rates of all columns is determined to be the vertical attenuation rate of the local image, and the horizontal attenuation rate of the local image is determined to be a preset value; the predicted grayscale value of the pixel point in the current row is determined according to the grayscale value of the pixel point in the previous row of the current row in the same column and the vertical attenuation rate; the grayscale difference of each pixel point is determined according to the grayscale value and the predicted grayscale value of each pixel point; the neighborhood range of each pixel point is determined, and the first mean value of the grayscale difference of all pixels in the neighborhood range is determined; the texture change degree of each pixel point is determined according to the grayscale difference of each pixel point and the first mean value of the neighborhood range of each pixel point; each pixel point is classified according to the texture change degree to obtain multiple texture classifications; the core degree of the texture of the pixel point is determined by using the distance between any pixel point in the same texture classification and other pixel points in the same texture classification; the comparison neighborhood radius of the pixel point is determined according to the preset comparison neighborhood radius and the core degree of the texture of the pixel point.
[0030] Specifically, since the selected local image for monitoring is usually a small-scale texture image, it can be considered that the illumination change in the direction from top to bottom presents a linear change. In the horizontal direction of the image, since there are usually multiple illumination light sources at the top, the light difference in the horizontal direction is small, and the change in the illumination influence in the horizontal direction is much smaller than the change in the influence in the vertical direction, so it is considered that the illumination attenuation rate in the horizontal direction is a preset value, and the preset value in the embodiment of the present invention is 0. Therefore, assuming that the selected local image contains only one texture, the grayscale size that should appear is predicted, and then the texture change degree of the pixel point is determined according to the predicted grayscale difference and the actual grayscale difference. Further, the stronger the grayscale of the image, the higher the degree of illumination influence. Since only the illumination change from top to bottom is considered, the grayscale of the image can reflect the change of illumination, so the change rate of illumination is calculated by using the change of grayscale. With the upper left corner of the local image as the origin, the right side and the bottom side as the positive direction, the size of the local image is m*n, where m represents the mth row pixel of the local image, and n represents the nth column pixel of the local image.
[0031] Furthermore, when determining the light intensity attenuation rate of each column in the local image, as an optional embodiment of the present invention, the first difference between the grayscale values of adjacent pixels in the same column in the local image is first calculated, and the first differences are superimposed to obtain a first superimposed value; then the first superimposed value is normalized to obtain the light intensity attenuation rate of each column in the local image.
[0032] Specifically, the embodiment of the present invention specifically adopts the following formula for calculation: In the above formula, represents the light intensity attenuation rate of the kth column of the local image. m represents the number of rows of pixels in the local image. Represents the grayscale value of the pixel in the i-th row on the k-th column. Represents the grayscale value of the pixel in the i-1th row on the kth column. Represents the normalization function, which is used to Perform normalization.
[0033] Furthermore, all columns in the local image are integrated to obtain the mean value of the light intensity attenuation rate of all columns in the local image, and the attenuation rate in the vertical direction of the selected local image is obtained. , the attenuation rate of the local image in the horizontal direction is 0.
[0034] Furthermore, the above-mentioned light intensity attenuation rate in the vertical direction is determined based on the global grayscale change. If the selected local image is the same texture, then in the same column, the grayscale value of the pixels in the next row can be predicted based on the pixels in the previous row and the change rate, and the difference between the predicted value and the actual value is small. On the contrary, if the difference between the predicted value and the actual value is large, it means that the two pixels are not of the same texture and the degree of texture change is large. In the embodiment of the present invention, the following formula is used to calculate the predicted grayscale value of the pixel in the current row: In the above formula, Represents the attenuation rate of the pixel in the mth row and kth column of the local image according to the vertical direction of the local image Predicted grayscale value. Represents the grayscale value of the pixel at the m-1th row and the kth column. Indicates the vertical attenuation rate of the light effect on the local image.
[0035] Furthermore, the grayscale difference of each pixel can be the absolute value of the difference between the predicted grayscale value of each pixel and the actual grayscale value. Where there is a texture change in the local image, there is a large difference between the predicted grayscale value change and the actual grayscale value change. Usually, the appearance of texture is usually continuous, so the smaller the difference between the predicted grayscale value of a pixel and the average grayscale value of the surrounding neighborhood, the higher the possibility that the pixel is another texture, and the greater the degree of texture change. Therefore, the embodiment of the present invention adopts the formula Calculate the grayscale difference between the predicted grayscale value and the actual grayscale value of pixel i. Represents the grayscale difference between the predicted grayscale value of pixel i and the actual grayscale value, Represents the actual grayscale value of pixel i; Represents the predicted grayscale value of pixel i.
[0036] Furthermore, in the embodiment of the present invention, the neighborhood range of each pixel point can be 24 pixels around the pixel point as the neighborhood range. Of course, the size of the neighborhood range can also be other values, which are not limited in the embodiment of the present invention. In the embodiment of the present invention, the mean value of the grayscale difference in the neighborhood range of pixel point i is obtained, which is recorded as .
[0037] Furthermore, when determining the degree of texture change of each pixel, as an optional embodiment of the present invention, the absolute value of the second difference between the first mean and the grayscale difference of the pixel is first calculated, and the first ratio of the grayscale difference of the pixel to the sum of the absolute value of the second difference and a predetermined value is calculated; then the first ratio is normalized to obtain the degree of texture change of the pixel.
[0038] Specifically, the predetermined value can be determined according to actual conditions, and in the embodiment of the present invention, the predetermined value is set to 1.
[0039] In the above formula, Indicates the degree of texture change of pixel i. Represents the grayscale difference between the predicted grayscale value and the actual grayscale value of the jth pixel in the neighborhood of pixel i. Represents the mean grayscale difference between the predicted grayscale value and the actual grayscale value of the pixels in the neighborhood of the i-th pixel. Represents the normalization function, which is used to Perform normalization.
[0040] Specifically, the embodiment of the present invention uses the following formula to calculate the texture change degree of a pixel point: Furthermore, the texture distribution has regional connectivity, so that pixels with similar texture change degrees may be edge pixels of the same texture, and these edge pixels may be closed to each other. Therefore, when the texture change degrees of pixels are the same, it means that the current pixel may be a pixel of the same texture, and the texture is usually connected, so that multiple closed areas can be formed, and a closed area is a texture. Among them, the composition of the texture is composed of multiple scattered pixels. When the pixel is located at the center of the texture, the linear change affected by the illumination is stronger, and the degree of influence of the illumination is lower, so the contrast segmentation range can be increased to improve the accuracy. On the contrary, when the pixel is located at the edge of the texture, the linear change affected by the illumination is weaker, and the degree of influence of the illumination is higher. It is necessary to reduce the contrast segmentation range and reduce the influence of the illumination. Therefore, the embodiment of the present invention clusters similar pixels according to the degree of texture change to obtain the edge pixel features of the texture, specifically, the pixels with the same degree of texture change are classified into one category, and the pixels with the same degree of texture change may be formed by the same texture change.
[0041] Further, the position of each pixel in the preliminary texture is calculated to obtain the size of the contrast area when calculating the contrast image. If the pixel i is at the edge of the texture, the linear influence of the optical fiber influence changes poorly, and the greater the degree of influence of the light. When selecting a local contrast area and performing segmentation, a smaller contrast range can be selected to reduce the influence of light. On the contrary, if the pixel is in the middle of the texture, the linear influence of the light influence changes more obviously, and the degree of influence of the light is small, so a larger contrast range can be selected to improve the accuracy of contrast segmentation. Therefore, when determining the core degree of the texture where the pixel is located, as an optional embodiment of the present invention, first, the distance between any pixel in the same texture classification and other pixel points in the same texture classification is superimposed to obtain a second superposition value; then the second superposition value is normalized to obtain the core degree of the texture where the pixel is located.
[0042] Specifically, the embodiment of the present application uses the following formula to calculate the coreness of the texture where the pixel point is located: In the above formula, Indicates the degree to which pixel i is located in the core of its texture. The smaller the value, the higher the degree to which pixel i is located in the center of the texture. Indicates the total number of pixels in the texture classification where pixel i is located. Represents the distance between pixel i and pixel j. Represents the normalization function, which is used to Perform normalization.
[0043] Furthermore, when a pixel point is located in a more core texture, the range of its contrast segmentation is larger, which can improve the accuracy of the contrast segmentation map and retain more texture features. The pixel points at the edge reduce the problem of being highly affected by the illumination caused by the intersection of texture changes. Therefore, when determining the contrast neighborhood radius of the pixel point, as an optional embodiment of the present invention, first calculate the first product of the preset contrast neighborhood radius and the inverse of the core degree of the texture where the pixel point is located; then determine the sum of the preset contrast neighborhood radius and the first product as the contrast neighborhood radius of the pixel point.
[0044] Specifically, the embodiment of the present invention can use the following formula to calculate the comparison neighborhood radius of the pixel point: In the above formula, Indicates the size of the comparison neighborhood radius of pixel i. It indicates the size of the preset comparison neighborhood radius set based on experience, which is usually set to the size of a 3-neighborhood radius window centered on the current pixel point, that is, The default is 3. Indicates the core degree of the texture where the pixel i is located. The size of is no greater than half of the selected local image size. It is worth noting that when and When the value is not an integer, only the integer part is retained, the part after the decimal point is removed, and the and The integer part of is involved in the calculation of the above formula.
[0045] Furthermore, when determining the global contrast of each pixel, as an optional embodiment of the present invention, the second mean of the grayscale values of all pixels within the range corresponding to the contrast neighborhood radius is first determined; then the global contrast of each pixel is determined based on the grayscale value of each pixel and the second mean within the range corresponding to the contrast neighborhood radius corresponding to each pixel.
[0046] Specifically, the grayscale value of each pixel and the second mean value within the corresponding range of the contrast neighborhood radius corresponding to each pixel can be compared to obtain the global contrast of each pixel. As an optional embodiment of the present invention, when the grayscale value of the pixel is greater than or equal to the second mean value, the global contrast of the pixel is determined to be the first value; when the grayscale value of the pixel is less than the second mean value, the global contrast of the pixel is determined to be the second value.
[0047] More specifically, in the embodiment of the present invention, the first value may be 1, and the second value may be 0. The embodiment of the present invention uses the following formula to calculate the global contrast: In the above formula, Represents the grayscale value of the i-th pixel. Represents the second mean of the grayscale values of all pixels within the range corresponding to the comparison neighborhood radius. Represents the global contrast of the i-th pixel.
[0048] S103, constructing Gaussian filter images of multiple scales of the local image through a Gaussian filter, taking each pixel point in the Gaussian filter image as a central pixel, and determining the annular neighborhood radius of each pixel point.
[0049] Specifically, the pixel points optimized by the above embodiment of the present invention exclude the adaptive contrast range affected by illumination, determine the optimized contrast map, and use the Center-Symmetric Local Binary Pattern (CLBP) algorithm to extract other features. The form of the Gaussian filter can be expressed as , (x, y) represents the coordinates of the pixel point, Represents the standard deviation of the pixels around the Gaussian filter. The local image is subjected to n consecutive Gaussian filtering to obtain Gaussian filtered images of n scales. In the embodiment of the present invention, the value of n can be 10. Represents the inverse normalization function, which is used to Perform inverse normalization.
[0050] Furthermore, when determining the radius of the annular neighborhood, the central pixel in each texture classification of the local image is first obtained, and multiple neighborhoods of the central pixel are set. Since an overly dense neighborhood will introduce a large amount of redundant information and the amount of calculation is large. The annular neighborhood radii selected in the embodiment of the present invention are 1, 3, and 5, respectively, and the number of pixels in the annular neighborhood is 8, 12, and 16. For example, Figure 3 and Figure 4 As shown, Figure 3 A schematic diagram of a selection method when the radius of a circular neighborhood is 1 provided in one embodiment of the present invention, Figure 4 A schematic diagram of a selection method when the annular neighborhood radius is 3 is provided for an embodiment of the present invention. Figure 3 In the example, a circular neighborhood 302 with a radius of 1 is selected with pixel point 301 as the center. Figure 4 In the example, a circular neighborhood 402 with a radius of 3 is selected with pixel point 401 as the center.
[0051] S104, selecting the direction of the point with the largest difference in grayscale value between each pixel point within the range corresponding to the annular neighborhood radius and the central pixel point within the range corresponding to the annular neighborhood radius as the dominant direction, and determining the positive and negative binary pattern values and the amplitude binary pattern value of any pixel point.
[0052] Specifically, the direction of the pixel with the largest grayscale difference between each pixel and the central pixel within the range corresponding to the annular neighborhood radius is the dominant direction, and the global contrast of each pixel is calculated counterclockwise. The calculation is performed from the neighborhood radius of the same pixel from small to large, and then the global contrast of each pixel within the range corresponding to each neighborhood radius is superimposed to obtain the positive and negative binary pattern values and the amplitude binary pattern values of any pixel. It is worth noting that the calculation method of the positive and negative binary pattern values and the amplitude binary pattern values of the pixel can refer to the CLBP algorithm in the prior art, and the embodiments of the present invention will not be repeated here.
[0053] S105 , determining a new texture feature vector of the local image according to the global contrast, the positive and negative binary pattern values, and the amplitude binary pattern value of each pixel point in the Gaussian filter image of each scale.
[0054] Specifically, the global contrast, positive and negative binary pattern values, and amplitude binary pattern values of each pixel in the Gaussian filter image of each scale are combined into a histogram and reduced in dimension to be converted into a row vector. The feature vectors at multiple scales are fused as a new texture feature vector.
[0055] Furthermore, as an optional embodiment of the present invention, determining a new texture feature vector of a local image includes: determining a feature vector of a Gaussian filtered image of each scale based on a global contrast, a positive and negative binary pattern value, and an amplitude binary pattern value of each pixel in the Gaussian filtered image of each scale; and fusing the feature vectors of the Gaussian filtered images of each scale to obtain a new texture feature vector.
[0056] Specifically, the global contrast, positive and negative binary pattern values, and amplitude binary pattern values of each pixel are used as the coordinate system, and the number of pixels with the same global contrast, positive and negative binary pattern values, and amplitude binary pattern values are counted, that is, a dot matrix is formed in three-dimensional space. Finally, the dot matrix is represented in the form of a matrix and converted into a row feature vector, that is, a new texture feature vector.
[0057] S106, inputting the new texture feature vector into a neural network model based on an attention mechanism, and identifying the target in the local image through the neural network model.
[0058] Specifically, the neural network model based on the attention mechanism can be a network using AlexNet as the backbone network, in which the attention mechanism is introduced, and the attention mechanism is added to the first and last layers of the AlexNet network, and the input new texture feature vector is passed through multiple convolutional layers and pooling layers to obtain The feature map is convolved with a 1×1×C convolution filter to obtain an attention heat map, and then the attention heat map is globally max-pooled. The maximum response value is selected on the attention heat map to obtain the region with discriminative features, thus forming an attention-guided deep texture feature learning model.
[0059] Improve the AlexNet network's recognition accuracy for textures in local images.
[0060] The embodiment of the present invention can determine the fine global contrast of the preliminary texture of the local image in the monitoring screen according to the change of illumination, and determine the new texture feature vector of the local image according to the global contrast, the positive and negative binary pattern values of the local image, and the amplitude binary pattern value, thereby reducing the influence of illumination on texture extraction. Finally, based on the new texture feature vector, the neural network model of the attention mechanism is used to identify the target in the local image, which will cause the same texture to appear similar in different areas, or different textures in different areas to appear similar. In this way, the embodiment of the present invention can distinguish the textures of different areas, improve the accuracy of texture classification, and then improve the extraction accuracy of texture features in the image.
[0061] Embodiment 2: Corresponding to the multi-scene video image texture feature extraction method based on the attention mechanism provided in the above embodiment, based on the same technical concept, an embodiment of the present invention also provides a multi-scene video image texture feature extraction system based on the attention mechanism, and the multi-scene video image texture feature extraction system based on the attention mechanism is used to execute the multi-scene video image texture feature extraction method based on the attention mechanism. Figure 5 A structural diagram of a multi-scene video image texture feature extraction system based on an attention mechanism is provided in one embodiment of the present invention. Figure 5 The multi-scene video image texture feature extraction system based on the attention mechanism may have relatively large differences due to different configurations or performances, and may include one or more processors 501 and memory 502, the memory 502 is used to store computer programs that can be run on the processor 501, and the processor 501 is used to execute the program stored in the memory 502 to achieve the above Figure 1 The memory 502 may be a short-term storage or a persistent storage. The application stored in the memory 502 may include one or more modules (not shown in the figure), each of which may include a series of computer executable instructions in the multi-scene video image texture feature extraction system based on the attention mechanism.
[0062] Furthermore, the processor 501 can be configured to communicate with the memory 502 to execute a series of computer executable instructions in the memory 502 on the multi-scene video image texture feature extraction system based on the attention mechanism. The multi-scene video image texture feature extraction system based on the attention mechanism can also include one or more power supplies 503, one or more wired or wireless network interfaces 504, one or more input and output interfaces 505, and one or more keyboards 506.
[0063] Specifically in this embodiment, the multi-scene video image texture feature extraction system based on the attention mechanism includes a processor, a communication interface, a memory and a communication bus; wherein the processor, the communication interface and the memory communicate with each other through the bus; the memory is used to store computer programs; the processor is used to execute the programs stored in the memory to achieve the above Figure 1 The various steps in the method embodiment are similar to those in the method embodiment, and have the beneficial effects of the above method embodiments. To avoid repetition, the embodiments of the present invention will not be described in detail here.
[0064] It should be noted that the multi-scene video image texture feature extraction system based on the attention mechanism provided in the embodiment of the present invention and the multi-scene video image texture feature extraction method based on the attention mechanism provided in the embodiment of the present invention are based on the same application concept. Therefore, the specific implementation of this embodiment can refer to the implementation of the aforementioned multi-scene video image texture feature extraction method based on the attention mechanism, and has the same or similar beneficial effects, and the repetitions will not be repeated.
[0065] It should be noted that the sequence of the above embodiments of the present invention is only for description and does not represent the advantages and disadvantages of the embodiments. The processes depicted in the accompanying drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0066] The various embodiments in this specification are described in a progressive manner, and the same or similar parts between the various embodiments can be referenced to each other, and each embodiment focuses on the differences from other embodiments.
Claims
1. A multi-scene video image texture feature extraction method based on attention mechanism, characterized in that: The multi-scene video image texture feature extraction method based on the attention mechanism includes: Acquire a local image that needs to be identified from the surveillance video of the target area; Determining the global contrast of each pixel in the local image according to the grayscale value of each pixel; Constructing Gaussian filter images of multiple scales of the local image by using a Gaussian filter, taking each pixel point in the Gaussian filter image as a central pixel, and determining the annular neighborhood radius of each pixel point; Select the direction of the point where the grayscale value difference between each pixel point within the range corresponding to the annular neighborhood radius and the central pixel point within the range corresponding to the annular neighborhood radius is the largest as the dominant direction, and determine the positive and negative binary mode values and the amplitude binary mode value of any pixel point; Determine a new texture feature vector of the local image according to the global contrast, the positive and negative binary pattern values, and the amplitude binary pattern values of each pixel in the Gaussian filtered image of each scale; The new texture feature vector is input into a neural network model based on an attention mechanism, and the target in the local image is identified by the neural network model.
2. The multi-scene video image texture feature extraction method based on the attention mechanism according to claim 1 is characterized in that: Determining the global contrast of each pixel point according to the grayscale value of each pixel point in the local image includes: Determine the comparison neighborhood radius of each pixel point according to the gray value of each pixel point in the local image; The global contrast of each pixel is determined according to the grayscale value of each pixel and the grayscale values of all pixels within a range corresponding to the contrast neighborhood radius corresponding to each pixel.
3. The multi-scene video image texture feature extraction method based on the attention mechanism according to claim 2 is characterized in that: Determining the comparison neighborhood radius of each pixel point according to the grayscale value of each pixel point in the local image comprises: Determining the light intensity attenuation rate of each column in the local image according to the grayscale values of adjacent pixels in the same column of the local image; Determine that the average value of the light intensity attenuation rate of all columns is the vertical attenuation rate of the local image, and determine that the horizontal attenuation rate of the local image is a preset value; Determine a predicted grayscale value of a pixel in the current row according to the grayscale value of a pixel in a row above the current row in the same column and the vertical direction attenuation rate; Determine the grayscale difference of each pixel according to the grayscale value of each pixel and the predicted grayscale value; Determine the neighborhood range of each pixel point, and determine the first mean value of the grayscale difference of all pixels points in the neighborhood range; Determine the texture change degree of each pixel point according to the grayscale difference of each pixel point and the first mean value of the neighborhood range of each pixel point; Classifying each pixel point according to the degree of texture change to obtain multiple texture classifications; Determine the core degree of the texture where any pixel point is located by using the distance between any pixel point in the same texture classification and other pixel points in the same texture classification; The comparison neighborhood radius of the pixel point is determined according to a preset comparison neighborhood radius and the core degree of the texture where the pixel point is located.
4. The method for extracting texture features of multi-scene video images based on the attention mechanism according to claim 3 is characterized in that: Determining the light intensity attenuation rate of each column in the local image according to the grayscale values of adjacent pixels in the same column of the local image includes: Calculating a first difference between grayscale values of adjacent pixels in the same column in the local image, and superimposing the first difference values to obtain a first superimposed value; The first superposition value is normalized to obtain the light intensity attenuation rate of each column in the local image.
5. The method for extracting texture features from multi-scene video images based on the attention mechanism according to claim 3, characterized in that: Determining the texture change degree of each pixel point according to the grayscale difference of each pixel point and the first mean value of the neighborhood range of each pixel point includes: Calculating an absolute value of a second difference between the first mean value and the grayscale difference of the pixel point, and calculating a first ratio of the grayscale difference of the pixel point to the sum of the absolute value of the second difference and a predetermined value; The first ratio is normalized to obtain the texture change degree of the pixel point.
6. The method for extracting texture features of multi-scene video images based on attention mechanism according to claim 3, characterized in that: Determining the core degree of the texture where any pixel point is located by using the distance between any pixel point in the same texture classification and other pixel points in the same texture classification includes: Superimposing the distances between any pixel point in the same texture classification and other pixel points in the same texture classification to obtain a second superposition value; The second superposition value is normalized to obtain the core degree of the texture where the pixel point is located.
7. The method for extracting texture features from multi-scene video images based on the attention mechanism according to claim 3, characterized in that: Determining the comparison neighborhood radius of the pixel point according to the preset comparison neighborhood radius and the core degree of the texture where the pixel point is located includes: Calculate a first product of the preset comparison neighborhood radius and the inverse of the core degree of the texture where the pixel point is located; The sum of the preset comparison neighborhood radius and the first product is determined as the comparison neighborhood radius of the pixel point.
8. The method for extracting texture features from multi-scene video images based on the attention mechanism according to claim 2, characterized in that: Determining the global contrast of each pixel point according to the grayscale value of each pixel point and the grayscale values of all pixels within a range corresponding to the contrast neighborhood radius corresponding to each pixel point includes: Determine a second mean value of the grayscale values of all pixels within the range corresponding to the comparison neighborhood radius; The global contrast of each pixel is determined according to the grayscale value of each pixel and the second mean value within the range corresponding to the contrast neighborhood radius corresponding to each pixel.
9. The method for extracting texture features from multi-scene video images based on the attention mechanism according to claim 8, characterized in that: Determining the global contrast of each pixel point according to the grayscale value of each pixel point and the second mean value within the range corresponding to the contrast neighborhood radius corresponding to each pixel point comprises: When the grayscale value of the pixel is greater than or equal to the second mean value, determining the global contrast of the pixel to be a first value; When the grayscale value of the pixel point is less than the second mean value, the global contrast of the pixel point is determined to be a second value.
10. The method for extracting texture features from multi-scene video images based on the attention mechanism according to claim 1, characterized in that: Determining a new texture feature vector of the local image according to the global contrast, positive and negative binary pattern values, and amplitude binary pattern values of each pixel in the Gaussian filter image of each scale includes: Determine a feature vector of the Gaussian filtered image of each scale according to the global contrast, positive and negative binary pattern values, and amplitude binary pattern values of each pixel in the Gaussian filtered image of each scale; The feature vectors of the Gaussian filter images of each scale are fused to obtain a new texture feature vector.
Citation Information
Patent Citations
Defogged image denoising method based on transmissivity
CN103279931A
Image zooming method and device, computer equipment and storage medium
CN109903224A
Complete local contrast binary pattern texture image processing method
CN110766023A
Texture image classification method and system based on refined local mode
CN112488123A
Unmanned aerial vehicle crop state visual identification method for air-ground cooperation
CN117409339A