Image classification method and device, equipment, medium and program product

Through the method of removing noise, edge enhancement, image fusion and division of photos, combined with similar degrees calculation, the problem of insufficient photo classification in the existing technology has been solved, and efficient and personalized photo management has been realized, and the user experience is improved.

CN119380076APending Publication Date: 2025-01-28CHINA MOBILE INTERNET CO LTD +1
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202411397047.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-08
Publication Date
2025-01-28

AI Technical Summary

Technical Problem

The existing photo classification methods cannot effectively utilize photo content, which limits users' ability to quickly search and manage photo content based on photo content, and cannot meet users' needs for efficient and personalized photo management.

Method used

By obtaining the information of the target image collection, removing noise information and enhancing marginal information, fusion of images, determining the edge pixels, dividing the image with a degree of similarity than the preset threshold into the same category.

Benefits of technology

The intelligent and efficient classification of images in the target image set, improved the accuracy and efficiency of classification, solved the problem of chaotic photo arrangement, and provided rapid retrieval and management capabilities based on photo content, and enhanced the user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119380076A_ABST
    Figure CN119380076A_ABST
Patent Text Reader

Abstract

The invention discloses an image classification method and device, equipment, a medium and a program product. The method comprises the following steps: acquiring information of a target image set, wherein the target image set comprises a plurality of first images; noise information of the first image is removed, edge information of the first image is enhanced, and a second image is obtained; according to a pixel value change condition between adjacent pixel points in a third image, edge pixel points in the third image are determined, and the third image is obtained by fusing the second image and the corresponding first image; segmenting the third image based on the edge pixel points to obtain a background region of the third image; calculating the similarity between the background areas of the third image; and dividing the first images corresponding to the third images of which the similarity is greater than a preset similarity threshold into the same category. According to the embodiment of the invention, the rapid retrieval and management capability based on the photo content can be provided for the user, and the urgent demand of the modern user for efficient and personalized photo management is met.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of data processing technology, and in particular, relates to an image classification method, device, equipment, medium and program product. Background Art

[0002] With the continuous advancement of communication and cloud storage technologies, users are increasingly inclined to upload photos taken with cameras and mobile phones to cloud disks to enjoy convenient storage and transmission services.

[0003] However, traditional technologies only rely on the order in which photos were taken or randomly uploaded, resulting in disordered arrangement of photos in the cloud disk space, which greatly affects the efficiency of user search and browsing. In addition, although related technologies have attempted to classify photos based on user identity, they ignore the richness and diversity of the photo content itself, limiting the user's ability to quickly retrieve and manage based on photo content, and failing to meet the user's demand for efficient and personalized photo management.

[0004] Therefore, existing photo classification methods limit users' ability to quickly retrieve and manage photos based on their content, and fail to meet users' needs for efficient and personalized photo management. Summary of the invention

[0005] The embodiments of the present application provide an image classification method, apparatus, device, medium and program product, which can solve the problem that existing photo classification methods limit users' ability to quickly retrieve and manage based on photo content and cannot meet users' needs for efficient and personalized photo management.

[0006] In a first aspect, an embodiment of the present application provides an image classification method, comprising:

[0007] Acquire information of a target image set, where the target image set includes a plurality of first images;

[0008] Removing noise information from the first image and enhancing edge information from the first image to obtain a second image;

[0009] Determine edge pixel points in the third image according to a change in pixel values ​​between adjacent pixel points in the third image, wherein the third image is obtained by fusing the second image and its corresponding first image;

[0010] Segmenting the third image based on edge pixels to obtain a background area of ​​the third image, wherein the background area is the area with the largest area after segmentation of the third image;

[0011] calculating the similarity between the background regions of the third image;

[0012] The first images corresponding to the third images whose similarity is greater than a preset similarity threshold are classified into the same category.

[0013] In a possible embodiment of the first aspect, removing noise information of the first image and enhancing edge information of the first image to obtain a second image includes:

[0014] Using a preset Gaussian filter to remove noise information from the first image to obtain a fourth image;

[0015] Dividing the fourth image into N sub-regions;

[0016] Among the N sub-regions, determine the sub-region whose pixel value of the central pixel point of the region is greater than the regional pixel mean as the first sub-region, and determine the sub-region whose pixel value of the central pixel point of the region is less than the regional pixel mean as the second sub-region;

[0017] The pixel value of the central pixel point of the first sub-area is added to the first preset value, and the second preset value is subtracted from the pixel value of the central pixel point of the second sub-area to obtain a second image.

[0018] In a possible embodiment of the first aspect, determining edge pixel points in the third image according to a change in pixel values ​​between adjacent pixel points in the third image includes:

[0019] In the third image, calculating a first change rate of the pixel value of each pixel point in the first direction and a second change rate in the second direction;

[0020] Calculating a target change rate of a pixel value of a pixel point based on the first change rate and the second change rate;

[0021] Pixels whose target change rate is greater than a preset change rate threshold are determined as edge pixels.

[0022] In a possible embodiment of the first aspect, in the third image, calculating a first change rate of a pixel value of each pixel point in a first direction and a second change rate in a second direction includes:

[0023] Based on a preset first convolution kernel, calculating a first change rate of a pixel value of each pixel point in the third image in a first direction;

[0024] Based on a preset second convolution kernel, a second change rate of the pixel value of each pixel point in the third image in the second direction is calculated.

[0025] In a possible embodiment of the first aspect, calculating a target change rate of a pixel value of a pixel point based on the first change rate and the second change rate includes:

[0026] The square root of the sum of the square of the first change rate and the square of the second change rate is calculated to obtain the target change rate of the pixel value of the pixel point.

[0027] In a possible embodiment of the first aspect, segmenting the third image based on edge pixels to obtain a background area of ​​the third image includes:

[0028] Segmenting the third image based on edge pixels to obtain a first segmented area and a second segmented area;

[0029] Calculate a first area of ​​the first segmented region and a second area of ​​the second segmented region;

[0030] The segmented area corresponding to the larger area between the first area and the second area is determined as the background area of ​​the third image.

[0031] In a possible embodiment of the first aspect, calculating the similarity between background regions of the third image includes:

[0032] Calculate the regional pixel mean corresponding to the background area of ​​the third image;

[0033] Assigning pixel values ​​of pixels in the background area that are greater than or equal to the regional pixel mean to a first preset value, and assigning pixel values ​​of pixels that are less than the regional pixel mean to a second preset value, to obtain a target string corresponding to the background area, wherein the target string is obtained by combining the first preset value and the second preset value;

[0034] The similarity between the target character strings corresponding to the background area of ​​the third image is calculated.

[0035] In a possible embodiment of the first aspect, before acquiring information of the target image set, the method further includes:

[0036] Acquire information of an original image set, where the original image set includes a plurality of original color images;

[0037] Performing grayscale processing on the original color image to obtain a first image;

[0038] Based on the first image, generating a target image set;

[0039] Classifying the first images corresponding to the third images whose similarity is greater than a preset similarity threshold into the same category includes:

[0040] The original color images corresponding to the third images whose similarity is greater than a preset similarity threshold are divided into the same category.

[0041] In a possible embodiment of the first aspect, generating a target image set based on the first image includes:

[0042] Slide the preset window on the first image with a preset step length, and calculate the window pixel mean corresponding to the preset window at each sliding;

[0043] In the same first image, the number of windows whose window pixel mean is greater than a preset threshold is calculated;

[0044] The first images with the same number of windows are divided into the same target image set.

[0045] In a possible embodiment of the first aspect, before removing noise information of the first image and enhancing edge information of the first image to obtain the second image, the method further includes:

[0046] Eliminating background information in the first image;

[0047] Binarizing the pixel value of each pixel in the first image to obtain a binary image;

[0048] In the binary image, a binary region having a target shape is detected;

[0049] Calculate the overlap rate between the image information in the binary area and the preset binary face image template;

[0050] Determine that the binarized area corresponding to the overlap rate greater than a preset overlap rate threshold is a face area;

[0051] Recognize facial information in a facial region of the first image to obtain user identity information of a user in the first image;

[0052] Based on the user identity information, the first image is classified.

[0053] Based on the same inventive concept, in a second aspect, the embodiment of the present application further provides an image classification device, comprising:

[0054] An acquisition module, used to acquire information of a target image set, where the target image set includes a plurality of first images;

[0055] A processing module, used to remove noise information of the first image and enhance edge information of the first image to obtain a second image;

[0056] A determination module, used to determine edge pixel points in the third image according to a change in pixel values ​​between adjacent pixel points in the third image, wherein the third image is obtained by fusing the second image and its corresponding first image;

[0057] A segmentation module, used to segment the third image based on edge pixels to obtain a background area of ​​the third image, wherein the background area is the area with the largest area after segmentation of the third image;

[0058] A calculation module, used for calculating the similarity between the background regions of the third image;

[0059] The classification module is used to classify the first images corresponding to the third images whose similarity is greater than a preset similarity threshold into the same category.

[0060] Based on the same inventive concept, in the third aspect, an embodiment of the present application also provides an image classification device, which includes a processor and a memory storing computer program instructions; when the processor executes the computer program instructions, it implements the first aspect, or the image classification method in any embodiment of the first aspect.

[0061] Based on the same inventive concept, in a fourth aspect, an embodiment of the present application further provides a computer storage medium, on which computer program instructions are stored. When the computer program instructions are executed by a processor, the first aspect or the image classification method in any embodiment of the first aspect is implemented.

[0062] Based on the same inventive concept, in the fifth aspect, the embodiments of the present application also provide a computer program product. When the instructions in the computer program product are executed by the processor of the device, the device can execute the image classification method in the first aspect or any embodiment of the first aspect.

[0063] The image classification method, device, equipment, medium and program product of the embodiment of the present application, the method can obtain the second image by obtaining the information of multiple first images in the target image set, then removing the noise information in each first image and enhancing the edge information in the first image. Next, the second image is fused with the original first image to form a third image, and by analyzing the change in the pixel values ​​between adjacent pixels in the third image, it can be determined which pixels in the third image are edge pixels, and then the edge pixels can be used to segment the third image, and the area with the largest area obtained by segmentation is used as the background area. Finally, the similarity between the background areas of different third images is calculated, and the first images corresponding to the third images whose similarity exceeds the preset threshold are classified into the same category, thereby achieving the classification of the first image. The embodiment of the present application effectively improves the image quality and accurately identifies the background area through steps such as denoising, edge enhancement, image fusion, edge detection and region segmentation, and then realizes intelligent and efficient classification of the first image in the target image set by calculating the background similarity, thereby improving the accuracy and efficiency of classification. It not only solves the problem of chaotic arrangement of photos, but also provides users with rapid retrieval and management capabilities based on photo content, greatly improving the user experience and meeting the urgent needs of modern users for efficient and personalized photo management. BRIEF DESCRIPTION OF THE DRAWINGS

[0064] Other features, objects and advantages of the present application will become more apparent by reading the following detailed description of non-limiting embodiments with reference to the accompanying drawings, in which the same or similar reference numerals represent the same or similar features and the accompanying drawings are not drawn to scale.

[0065] Figure 1 It is a flow chart of the image classification method provided in the embodiment of the present application;

[0066] Figure 2 It is a flow chart of removing noise information of a first image and enhancing edge information of the first image to obtain a second image in the image classification method provided in an embodiment of the present application;

[0067] Figure 3 is an example diagram of a first image and a second image in the image classification method provided in an embodiment of the present application;

[0068] Figure 4 It is a schematic flow chart of determining edge pixels in a third image according to changes in pixel values ​​between adjacent pixels in the third image in the image classification method provided in an embodiment of the present application;

[0069] Figure 5 It is a flow chart of segmenting a third image based on edge pixels to obtain a background area of ​​the third image in the image classification method provided in an embodiment of the present application;

[0070] Figure 6 It is a schematic diagram of a flow chart of calculating the similarity between background regions of a third image in the image classification method provided in an embodiment of the present application;

[0071] Figure 7 It is a flow chart of a method for classifying images provided in an embodiment of the present application, in which the first image is a grayscale image;

[0072] Figure 8 It is a schematic diagram of a process of generating a target image set based on a first image in the image classification method provided in an embodiment of the present application;

[0073] Fig. 9 This is a flow chart of classifying images based on user identity in the image classification method provided in the embodiment of the present application;

[0074] Fig.10 is a structural schematic diagram of an image classification device provided in an embodiment of the present application;

[0075] Fig.11 It is a structural schematic diagram of an image classification device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0076] The features and exemplary embodiments of various aspects of the present application will be described in detail below. In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are only configured to explain the present application and are not configured to limit the present application. For those skilled in the art, the present application can be implemented without the need for some of these specific details. The following description of the embodiments is only to provide a better understanding of the present application by illustrating the examples of the present application.

[0077] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the statement "include..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.

[0078] It should be understood that the term "and / or" used in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the associated objects before and after are in an "or" relationship.

[0079] It is obvious to those skilled in the art that various modifications and changes can be made in the present application without departing from the spirit or scope of the present application. Therefore, the present application is intended to cover modifications and changes of the present application that fall within the scope of the corresponding claims (technical solutions for protection) and their equivalents. It should be noted that the implementation methods provided in the embodiments of the present application can be combined with each other without contradiction.

[0080] Before describing the technical solutions provided by the embodiments of the present application, in order to facilitate the understanding of the embodiments of the present application, the present application first specifically describes the problems existing in the related art:

[0081] With the continuous advancement of communication and cloud storage technologies, users are increasingly inclined to upload photos taken with cameras and mobile phones to cloud disks to enjoy convenient storage and transmission services.

[0082] However, related technologies only rely on the order of shooting or random way to upload photos, resulting in disordered arrangement of photos in the cloud disk space, which greatly affects the efficiency of user search and browsing. For example, the camera first takes 5 landscape photos, then takes 5 portrait photos, and finally takes 5 landscape photos. This will cause the photos uploaded to the network cloud disk to be disorganized and inconvenient for users to view.

[0083] In addition, although some related technologies attempt to classify photos based on user identity, they ignore the richness and diversity of the photo content itself, limiting the user's ability to quickly retrieve and manage based on the photo content, and failing to meet the user's needs for efficient and personalized photo management. Therefore, when classifying photos, the related technologies lack the user's ability to quickly retrieve and manage based on the photo content, and failing to meet the user's needs for efficient and personalized photo management.

[0084] Based on this, the embodiments of the present application provide an image classification method, device, equipment, medium and program product, which effectively improves the image quality and accurately identifies the background area through steps such as denoising, edge enhancement, image fusion, edge detection and region segmentation, and then realizes intelligent and efficient classification of the first image in the target image set by calculating the background similarity, thereby improving the accuracy and efficiency of photo classification, not only solving the problem of chaotic photo arrangement, but also providing users with fast retrieval and management capabilities based on photo content, greatly improving the user experience, and meeting the urgent needs of modern users for efficient and personalized photo management.

[0085] The image classification method provided in the embodiment of the present application is described in detail below with reference to the accompanying drawings.

[0086] Figure 1 is a flow chart of an image classification method provided in an embodiment of the present application, such as Figure 1 As shown, the method may include steps S110 to S160.

[0087] S110, obtaining information of a target image set, where the target image set includes a plurality of first images.

[0088] The target image set includes a plurality of images to be classified, and the image may be referred to as a first image. The first image may be a color image or a grayscale image.

[0089] Specifically, information of the target image set in which the first image is located is obtained for subsequent classification of the first image.

[0090] S120, removing noise information of the first image and enhancing edge information of the first image to obtain a second image.

[0091] The noise information is an unwanted and randomly appearing interference signal in the first image. The noise information may come from various factors in the image acquisition process, such as sensor noise, circuit noise, errors in the transmission process, etc.

[0092] Edge information is where features such as brightness or color in an image change significantly, which helps to understand the structure and content of the image. In image processing, enhancing edge information can make the outline of the image clearer.

[0093] Specifically, unnecessary noise information in the first image is eliminated or reduced, while the boundaries between objects in the first image, that is, edge information, are highlighted and strengthened. The resulting new image can be called a second image. Compared with the first image, the second image is not only clearer, but also has distinct edges, and is more suitable for further image classification.

[0094] S130, determining edge pixels in the third image according to a change in pixel values ​​between adjacent pixels in the third image, wherein the third image is obtained by fusing the second image and its corresponding first image.

[0095] The third image is an image generated by fusing the first image and the second image. After the first image and the second image are fused, the edge of the original image can be highlighted, thereby enhancing the contrast.

[0096] Pixel value is the process of converting continuously changing brightness or color information into discrete values ​​through the quantization process. The pixel value directly reflects the brightness or color information of each pixel in the image. For example, for a grayscale image, the pixel value is usually an integer between 0 and 255, where 0 represents black, 255 represents white, and the values ​​in between represent different degrees of gray. In a grayscale image, the size of the pixel value determines the brightness of the pixel.

[0097] The pixel value change is the difference or change in the pixel values ​​between adjacent pixels. In an image, edge areas are often shown as places where pixel values ​​change significantly. Therefore, by analyzing the pixel value changes between adjacent pixels, edge information in the image can be identified.

[0098] Edge pixels: Edge pixels are pixels located at the edge of an image. In image processing, edges are usually defined as places where features such as brightness or color in an image change significantly, that is, where pixel values ​​change significantly.

[0099] For example, the first image is a grayscale image, and the edge pixel points are places where the brightness characteristics in the grayscale image change significantly, that is, places where the pixel values ​​change significantly.

[0100] It should be noted that grayscale images only contain brightness information, not color information. In grayscale images, the difference between different objects is mainly reflected by their brightness, and the pixel value can reflect the brightness feature.

[0101] Specifically, by analyzing the changes in pixel values ​​between adjacent pixels in the third image, it is possible to identify where the pixel values ​​in the third image change significantly, that is, to identify where the brightness features in the grayscale image change significantly. Therefore, it is possible to identify and determine the edge pixels in the third image, that is, to identify and determine the boundaries of objects in the third image.

[0102] S140, segmenting the third image based on edge pixels to obtain a background area of ​​the third image, wherein the background area is the area with the largest area after segmentation of the third image.

[0103] Among them, the background area is usually the area that occupies the largest area in the image and does not contain the main objects of interest such as people, animals, buildings, etc.

[0104] Specifically, edge pixel points can be used as boundaries between different areas, and the third image can be divided into regions using edge pixel points as the basis for segmentation. Subsequently, by comparing the area sizes of these segmented regions, it can be determined that the area with the largest area is the background area, thereby being able to identify and effectively separate the background area in the third image.

[0105] S150, calculating the similarity between the background regions of the third image.

[0106] Specifically, after the background region of each third image is identified and determined, the similarities between the background regions of different third images may be calculated.

[0107] S160: Classify the first images corresponding to the third images whose similarity is greater than a preset similarity threshold into the same category.

[0108] Specifically, since the first image, the second image and the third image have a one-to-one correspondence, after finding a third image whose similarity is greater than a preset similarity threshold, the first images corresponding to the third images can be divided into the same group.

[0109] The image classification method provided in the embodiment of the present application can obtain the second image by obtaining the information of multiple first images in the target image set, then removing the noise information in each first image and enhancing the edge information in the first image. Next, the second image is fused with the original first image to form a third image, and by analyzing the change of the pixel values ​​between adjacent pixels in the third image, it can be determined which pixels in the third image are edge pixels, and then the edge pixels can be used to segment the third image, and the area with the largest area obtained by segmentation is used as the background area, and finally the similarity between the background areas of different third images is calculated, and the first images corresponding to the third images whose similarity exceeds the preset threshold are classified into the same category, thereby realizing the classification of the first image. The embodiment of the present application effectively improves the image quality and accurately identifies the background area through the steps of denoising, edge enhancement, image fusion, edge detection and regional segmentation, and then realizes the intelligent and efficient classification of the first image in the target image set by calculating the background similarity, improves the accuracy and efficiency of classification, not only solves the problem of chaotic arrangement of photos, but also provides users with the ability to quickly retrieve and manage based on the content of photos, greatly improves the user experience, and meets the urgent needs of modern users for efficient and personalized photo management.

[0110] Figure 2 It is a flow chart of removing noise information of a first image and enhancing edge information of the first image in the image classification method provided in an embodiment of the present application to obtain a second image.

[0111] In some embodiments, Figure 2 As shown, step S120 removes noise information of the first image and enhances edge information of the first image to obtain a second image, which may include steps S121 to S124.

[0112] S121, using a preset Gaussian filter to remove noise information of the first image to obtain a fourth image.

[0113] Among them, the Gaussian filter is a linear smoothing filter for image processing, which uses the Gaussian function (also known as the normal distribution function) to determine the weight of the pixels around each pixel, thereby blurring the image. This blurring process can effectively eliminate the noise information in the image while trying to keep the edge information of the image from being overly blurred.

[0114] The preset Gaussian filter means that the parameters of the filter (such as the standard deviation σ) have been set according to specific requirements or experimental results. Applying the filter to the first image, the new value of each pixel is calculated by weighted average, and finally the fourth image with noise information removed is obtained, which helps to improve the image quality and provide clearer and more accurate input for subsequent image analysis, feature extraction and other steps.

[0115] It should be noted that the inventors have found that since it is necessary to enhance the edge information of the first image, the noise information of the image will be enhanced at the same time. Therefore, the first image may be filtered to remove the noise information of the image.

[0116] Specifically, after denoising, edge enhancement technology (such as Sobel operator, Canny edge detector, etc.) is applied to highlight the edge information in the first image, which can effectively enhance the edge features of the image while reducing noise interference, providing a better basis for subsequent image classification according to background type.

[0117] S122, dividing the fourth image into N sub-regions.

[0118] Wherein, N is a positive integer, indicating the number of sub-regions into which the fourth image is divided, and the value of N can be determined according to factors such as specific application requirements, image size and complexity, etc. In actual operation, the most suitable value of N can be found through multiple experiments and adjustments.

[0119] Specifically, the fourth image may be divided into N sub-regions, each of which includes a certain number of pixels.

[0120] S123, among the N sub-regions, determine the sub-region whose pixel value of the central pixel point of the region is greater than the regional pixel mean as the first sub-region, and determine the sub-region whose pixel value of the central pixel point of the region is less than the regional pixel mean as the second sub-region.

[0121] There are multiple pixels in the sub-region, which are arranged in order of the size of the pixel values ​​of the pixels, and the pixel in the middle can be called the center pixel of the region.

[0122] The regional pixel mean is the average value of the pixel values ​​of all pixels in the sub-region.

[0123] Specifically, for each sub-region, the average value of the pixel values ​​of all pixels in the sub-region is first calculated, that is, the regional pixel mean. Subsequently, the pixel value of the central pixel of each sub-region is compared with the regional pixel mean of the sub-region where it is located. If the pixel value of the central pixel of a sub-region is higher than the regional pixel mean of the region, then the sub-region can be determined to be the first sub-region. On the contrary, if the pixel value of the central pixel of a sub-region is lower than the regional pixel mean of the region, it is classified as the second sub-region.

[0124] S124, adding the pixel value of the central pixel point of the first sub-region to the first preset value, and subtracting the second preset value from the pixel value of the central pixel point of the second sub-region to obtain a second image.

[0125] The first preset value is a pre-set positive number, which is used to perform an addition operation with the pixel value of the central pixel point of the first sub-region, and can enhance the central part of the first sub-region with relatively high brightness or pixel value in the fourth image.

[0126] The second preset value is a preset positive number, which is used to perform a subtraction operation with the pixel value of the central pixel point of the second sub-region, and can weaken the central part of the second sub-region with relatively low brightness or pixel value in the fourth image.

[0127] Specifically, different pixel value adjustment operations can be performed on the central pixels of the first sub-area and the second sub-area. The pixel value of the central pixel of the first sub-area can be added to a preset positive value (first preset value), so that the central pixel of the first sub-area can be further increased in brightness or pixel value, so that it is more prominent in the image. On the contrary, the pixel value of the central pixel of the second sub-area can be subtracted from a preset positive value (second preset value), so that the central pixel of the second sub-area can be reduced in brightness or pixel value, so that it becomes relatively darker or weakened in the image, and the resulting new image can be called a second image. In the second image, the central pixel of the first sub-area with relatively high brightness or pixel value in the original image is enhanced, while the central pixel of the second sub-area with relatively low brightness or pixel value is suppressed.

[0128] For example, each first image is Gaussian filtered to obtain a filtered fourth image, and the fourth image is Laplace transformed to obtain a transformed second image. After the second image is fused with the corresponding first image, a sharpened third image can be obtained. Among them, the use of Laplace transform can enhance the details and edges of the image, but it will also enhance the image noise. Therefore, in the embodiment of the present application, Gaussian filter is first performed on the first image to remove the image noise, and then Laplace transform is performed on the filtered image. The principle of Laplace transform is that when the pixel value of the center pixel of the region is lower than the average pixel value in its neighborhood, the pixel value of the center pixel of the region is further reduced; when the pixel value of the center pixel of the region is higher than the average pixel value in its neighborhood, the pixel value of the center pixel of the region is further increased, thereby achieving image sharpening. The first image and the second image after Laplace transform can be seen in Figure 3 , the original first image is merged with the second image after Laplace transformation, so that the edge of the original first image can be highlighted, thereby enhancing the contrast to obtain the third image.

[0129] The embodiment of the present application obtains the fourth image by first removing the noise information of the first image using a Gaussian filter. Then, the fourth image is divided into N sub-regions, and the image is divided into two types of sub-regions based on pixel value comparison, for example, the sub-region where the pixel value of the central pixel point of the region is greater than the regional pixel mean is determined as the first sub-region, and the sub-region where the pixel value of the central pixel point of the region is less than the regional pixel mean is determined as the second sub-region. Then, the pixel values ​​of the central pixels of the two types of sub-regions are adjusted respectively, the pixel values ​​of the central pixels of the first sub-region with relatively high brightness or pixel value in the fourth image are enhanced, and the pixel values ​​of the central pixels of the second sub-region with relatively low brightness or pixel value in the fourth image are suppressed, thereby obtaining the second image. The second image finally obtained not only effectively reduces noise interference, but also significantly enhances the edge information of the image, and the key features in the image are more prominent, providing higher quality input for subsequent image classification, thereby improving the accuracy and efficiency of image classification.

[0130] Figure 4 It is a flow chart of determining edge pixels in a third image according to changes in pixel values ​​between adjacent pixels in the third image in the image classification method provided in an embodiment of the present application.

[0131] In some embodiments, Figure 4 As shown, step S130 determines edge pixels in the third image according to changes in pixel values ​​between adjacent pixels in the third image, and may include steps S131 to S133.

[0132] S131, in the third image, calculating a first change rate of the pixel value of each pixel point in the first direction and a second change rate in the second direction.

[0133] The first direction is a direction in which pixel values ​​in the image change, for example, it may be a horizontal direction, such as from left to right or from right to left, or any other specified direction.

[0134] The first change rate is the change rate between the pixel value of each pixel and the pixel value of its adjacent pixel in the first direction, reflecting the change trend and speed of the pixel value of the image in the first direction. A high change rate usually indicates an edge or detail in the image.

[0135] The second change rate is the difference or change rate between the pixel value of each pixel and the pixel value of its adjacent pixel in the second direction, reflecting the change trend and speed of the pixel value of the image in the second direction.

[0136] The second direction is another direction in which the pixel values ​​in the image change, for example, it may be a vertical direction, from top to bottom or from bottom to top, or any other specified direction that does not coincide with the first direction.

[0137] Specifically, for each pixel point in the third image, the degree of change of its pixel value in the first direction and the second direction, that is, the first change rate in the first direction and the second change rate in the second direction are calculated respectively.

[0138] S132, calculating a target change rate of the pixel value of the pixel point based on the first change rate and the second change rate.

[0139] Specifically, the target change rate can be calculated based on the first change rate of each pixel in the first direction and the second change rate in the second direction. The target change rate is a comprehensive consideration of the degree of change of the pixel in the first direction and the second direction, which can be obtained by weighted averaging, taking the maximum value, the minimum value, etc. It can more comprehensively evaluate the changes in the pixel values ​​around the pixel, and then be used for subsequent image classification tasks to improve the accuracy and effect of image classification.

[0140] S133, determining that a pixel point whose target change rate is greater than a preset change rate threshold is an edge pixel point.

[0141] The preset change rate threshold can be set according to actual needs. By setting the preset change rate threshold, the sensitivity of edge detection can be flexibly controlled.

[0142] Specifically, after the target change rate of each pixel is calculated, the target change rate may be compared with a preset change rate threshold, and the pixel whose target change rate is greater than the preset change rate threshold is regarded as an edge pixel.

[0143] For example, the edge of the contrast-enhanced photo is extracted using the Sobel operator, Prewitt operator or Canny operator. The specific process is: convolve the contrast-enhanced third image with the convolution kernel GX in the first direction and the convolution kernel GY in the second direction corresponding to the Sobel operator, Prewitt operator or Canny operator, that is, J1 = I*GX, J2 = I*GY, I is the contrast-enhanced third image, GX is the convolution kernel in the first direction, GY is the convolution kernel in the second direction, J1 is the convolution result in the first direction, that is, the first change rate, and J2 is the convolution result in the second direction, that is, the second change rate. According to formula 1, the target change rate of the pixel value of the pixel point can be calculated based on the first change rate and the second change rate:

[0144]

[0145] Where G is the target change rate. When the target change rate is greater than the preset change rate threshold, the pixel corresponding to the target change rate belongs to the edge pixel. Based on the edge pixel, two regions can be distinguished, and the areas of the two regions are calculated respectively, and the larger area is taken as the background area.

[0146] The embodiments of the present application can more accurately identify edge information in an image by comprehensively considering the pixel value change rates (such as the first change rate and the second change rate) of pixel points in different directions (such as the first direction and the second direction), thereby finding the contours of objects in the image or the boundaries between different areas, thereby improving the accuracy of edge detection and enhancing the accuracy of image classification.

[0147] In some embodiments, step S131 calculates the first change rate of the pixel value of each pixel point in the third image in the first direction and the second change rate in the second direction, which may include steps S1311 and S1312.

[0148] S1311, based on a preset first convolution kernel, calculating a first change rate of the pixel value of each pixel point in the third image in a first direction.

[0149] The preset convolution kernel can be used to slide through each pixel point and its neighborhood in the third image, and convolution obtains the degree of change of the pixel value between each pixel point and its adjacent pixel points in a specific direction (such as horizontal direction or vertical direction), that is, the rate of change. The rate of change reflects the changing trend and speed of the pixel value of the image in a specific direction.

[0150] The first convolution kernel and the second convolution kernel are optimized for a specific direction and can more effectively identify significant changes in pixel values ​​in that direction, namely, edges.

[0151] Specifically, based on the preset first convolution kernel, the first change rate of the pixel value of each pixel point in the third image in the first direction (such as the horizontal direction) is calculated, which can quantify the degree of change of the pixel value between each pixel point and its adjacent pixel points in the first direction.

[0152] S1312: Calculate a second rate of change of the pixel value of each pixel point in the third image in the second direction based on a preset second convolution kernel.

[0153] Specifically, based on the preset second convolution kernel, the second change rate of the pixel value of each pixel point in the third image in the second direction (such as the vertical direction) is calculated, which can quantify the degree of change of the pixel value between each pixel point and its adjacent pixel points in the second direction.

[0154] The embodiment of the present application can independently calculate the pixel value change rate of each pixel point in the third image in two different directions (such as the horizontal direction and the vertical direction) by using the preset first convolution kernel and the second convolution kernel respectively, and can comprehensively and accurately capture the edge information of the image in multiple directions. Therefore, by combining the change rate in the two directions, the edge features of the image can be more carefully portrayed, and the edge features in the image can be extracted with high precision.

[0155] In some embodiments, step S132 calculates the target change rate of the pixel value of the pixel point based on the first change rate and the second change rate, and may include step S1321.

[0156] S1321, calculate the square root of the sum of the square of the first change rate and the square of the second change rate to obtain the target change rate of the pixel value of the pixel point.

[0157] Specifically, the target change rate may be obtained by summing the square of a first change rate of a pixel point in the first direction and the square of a second change rate of a pixel point in the second direction, and calculating the square root of the sum.

[0158] The embodiments of the present application can comprehensively evaluate the degree of change in the pixel value of a pixel point in a first direction and a second direction (such as horizontal and vertical directions), and express it as a target change rate, thereby effectively integrating the change rates in different directions into a unified metric, and can perform comprehensive measurement, thereby reflecting the overall intensity or severity of the change in the pixel value of the pixel point.

[0159] Figure 5 It is a flow chart of segmenting a third image based on edge pixels to obtain a background area of ​​the third image in the image classification method provided in an embodiment of the present application.

[0160] In some embodiments, Figure 5 As shown, step S140 segments the third image based on edge pixels to obtain a background area of ​​the third image, which may include steps S141 to S143.

[0161] S141, segmenting the third image based on edge pixels to obtain a first segmented area and a second segmented area.

[0162] Specifically, after finding the pixels in the third image that show significant pixel value changes (i.e., high change rates), that is, the edge pixels located on the boundaries of different objects or regions, the third image can be segmented based on the edge pixels to obtain a first segmented region and a second segmented region.

[0163] S142, calculating a first area of ​​the first segmented region and a second area of ​​the second segmented region.

[0164] Specifically, the area of ​​the first segmented region may be calculated, which may be referred to as the first area, and the area of ​​the second segmented region may be calculated, which may be referred to as the second area. For example, each pixel may be regarded as a basic unit in an image, and its area is fixed, so the first area of ​​the first segmented region and the second area of ​​the second segmented region may be calculated by counting the total number of all pixels in the first segmented region and the second segmented region.

[0165] S143: Determine a segmented area corresponding to a larger area between the first area and the second area as a background area of ​​the third image.

[0166] Specifically, after determining the first area and the second area, it is possible to identify which of the two areas is larger. The larger area usually corresponds to the background portion of the image. Therefore, by comparing the first area and the second area, the segmented area corresponding to the larger area can be determined as the background area of ​​the third image, thereby being able to accurately identify the background area of ​​the image.

[0167] The embodiment of the present application combines the change rates in different directions to accurately identify the edge pixels in the third image, and then segments the third image based on the edge pixels to obtain different segmented regions. The areas of the different segmented regions are then compared to determine the background area, thereby accurately and effectively identifying the background portion of the image.

[0168] Figure 6 It is a flowchart of calculating the similarity between background areas of a third image in the image classification method provided in an embodiment of the present application.

[0169] In some embodiments, Figure 6 As shown, step S150 calculates the similarity between the background regions of the third image and may include steps S151 to S153.

[0170] S151, calculating the regional pixel mean corresponding to the background area of ​​the third image.

[0171] The regional pixel mean is obtained by dividing the sum of the pixel values ​​of all pixels in the entire background area by the total number of pixels, which can reflect the overall brightness of the background area.

[0172] Specifically, the pixel mean of the entire background area in the third image, ie, the regional pixel mean, is calculated.

[0173] S152, assigning pixel values ​​of pixel points in the background area that are greater than or equal to the regional pixel mean to a first preset value, and assigning pixel values ​​of pixel points that are less than the regional pixel mean to a second preset value, to obtain a target character string corresponding to the background area, wherein the target character string is obtained by combining the first preset value and the second preset value.

[0174] Specifically, the pixel values ​​of all pixels in the background area are compared with the regional pixel mean value. If the pixel value is greater than or equal to the regional pixel mean value, the pixel value of the pixel is replaced with a first preset value, for example, the first preset value is 1. On the contrary, if the pixel value is less than the regional pixel mean value, it is replaced with a second preset value, for example, the second preset value is 0. Thus, the background area can be converted into a binary image composed of the first preset value and the second preset value. Then, the first preset value and the second preset value in the binary image are arranged according to the positions of the pixels, and a character string composed of two preset values ​​can be obtained, which can be called a target character string.

[0175] S153, calculating the similarity between the target character strings corresponding to the background area of ​​the third image.

[0176] Specifically, after the background area of ​​each third image is quantized into a target string, the similarity of the background area of ​​the third image can be measured by calculating the similarity between different target strings. For example, the target string consists of n 0s / 1s, and the target strings corresponding to the background areas of the two third images are "01111...011" and "01111...000" respectively. The characters of the two target strings can be compared from left to right to see if they are equal. If there are 5 unequal characters, the similarity is (n-5) / n.

[0177] For example, a hash value with a fixed number of bits is generated for the background area of ​​each third image using a hash algorithm, that is, pixel values ​​of pixels in the background area that are greater than or equal to the regional pixel mean are assigned to a first preset value, and pixel values ​​of pixels that are less than the regional pixel mean are assigned to a second preset value, to obtain a hash value corresponding to the background area, which is the target string. The hash values ​​corresponding to the background areas of the two third images are compared. If the number of different data bits is less than or equal to 6, it means that the two photos are highly similar, and the two images are divided into the same group of photo scenes.

[0178] The embodiment of the present application first calculates the regional pixel mean of the background area of ​​the third image as a reference for the brightness level, and then, through binarization processing, sets the pixel value greater than or equal to the regional pixel mean to a first preset value, and sets the pixel value less than the regional pixel mean to a second preset value, thereby converting complex pixel data into a concise 0 / 1 string, i.e., a target string, greatly reducing the amount of data to be processed. Finally, by comparing the similarity between the target strings, the similarity of the background areas of different third images can be quickly and accurately evaluated, reducing the computational complexity and improving the robustness and reliability of the similarity evaluation.

[0179] Figure 7It is a flow chart of the image classification method provided in the embodiment of the present application in which the first image is a grayscale image.

[0180] In some embodiments, Figure 7 As shown, before obtaining the information of the target image set in step S110, the image classification method further includes steps S171 to S173.

[0181] S171, obtaining information of an original image set, where the original image set includes a plurality of original color images.

[0182] Specifically, information of the original image set in which the original color image is located is obtained.

[0183] S172, performing grayscale processing on the original color image to obtain a first image.

[0184] Specifically, the color information of the original color image is removed, and the brightness information of the original color image is retained, and the obtained new grayscale image can be called the first image.

[0185] S173, generating a target image set based on the first image.

[0186] Specifically, after grayscale processing of each original color image, a target image set can be obtained.

[0187] Step S160 classifies the first images corresponding to the third images whose similarities are greater than a preset similarity threshold into the same category, which may include step S161.

[0188] S161: Classify the original color images corresponding to the third images whose similarity is greater than a preset similarity threshold into the same category.

[0189] Specifically, since the original color image, the first image, the second image and the third image have a one-to-one correspondence, after finding the third image whose similarity is greater than a preset similarity threshold, the original color images corresponding to the third image can be divided into the same group.

[0190] The embodiment of the present application uses a preprocessing step, including obtaining an original image set of original color images and performing grayscale processing to obtain a first image, and then generating a target image set based on the first image, which effectively simplifies the complexity of image data while retaining key information. In the classification process, by calculating the similarity of the background area of ​​the third image, and classifying the original color images corresponding to the third images with similarities higher than a preset threshold into the same category, fast and accurate classification of images of different background types is achieved, which can improve classification efficiency and ensure the accuracy of classification results.

[0191] Figure 8It is a flowchart of generating a target image set based on a first image in the image classification method provided in an embodiment of the present application.

[0192] In some embodiments, Figure 8 As shown, step S173 generates a target image set based on the first image, and may include steps S1731 to S1733.

[0193] S1731, sliding a preset window on the first image with a preset step length, and calculating a window pixel mean corresponding to the preset window during each sliding.

[0194] The preset window is a window of a preset size, which may be a rectangular area. The size of the preset window may be set according to actual needs, and is not limited in the embodiments of the present application.

[0195] The preset step length is the distance that the preset window moves each time. The preset compensation can be set according to actual needs and is not limited in the embodiments of the present application.

[0196] Specifically, a window of a preset size is gradually slid on the first image with a fixed step size. Each time the window slides to a new position, the average of the pixel values ​​of all pixels in the window is calculated. The average value can be called the window pixel mean, which reflects the average brightness of the pixels in the current coverage area of ​​the window.

[0197] S1732, in the same first image, calculating the number of windows whose window pixel mean is greater than a preset threshold.

[0198] Specifically, the window pixel mean of each preset window in the first image is compared with a preset threshold, and the number of windows whose window pixel mean is greater than the preset threshold is counted.

[0199] S1733, dividing the first images with the same number of windows into the same target image set.

[0200] Specifically, if two or more first images have the same number of windows, it means that the illumination intensity of their background environments is similar and they belong to the same category or set, and they can be classified into the same target image set.

[0201] For example, each original color image in the cloud disk can be converted into a grayscale image, i.e., the first image, and then a 10×10 or 20×20 window is used to slide on the first image with a preset step size. Each time the window slides to a new position, the pixel mean of all pixels in the window, i.e., the window pixel mean, is detected. The number of windows whose window pixel mean is greater than or equal to the first threshold is detected, and the first images with the same number of windows are grouped together. For example, the number of windows whose window pixel mean of the first image in the cloud disk is greater than or equal to the first threshold is 4, and the number of windows whose window pixel mean of the fifth image is greater than or equal to the first threshold is 4, then the first photo and the fifth photo can be divided into the same target image set.

[0202] It should be noted that if the number of windows whose window pixel means of two first images are greater than the preset threshold is the same, it means that the two first images have similar ambient brightness and are likely to belong to the same background environment, and can be divided into the same group.

[0203] In the embodiment of the present application, a preset window is slid on the first image and the window pixel mean is calculated, and then the number of windows greater than the preset threshold value can be counted according to the comparison result of the window pixel mean value and the preset threshold value. Subsequently, the first images with the same number of windows can be classified into the same target image set, so that images with similar lighting environments or background brightness can be identified and grouped.

[0204] It should be noted that the embodiments of the present application can not only classify based on the background information in the image, but also classify based on the user identity information in the image.

[0205] Fig. 9 It is a flow chart of classifying images based on user identity in the image classification method provided in an embodiment of the present application.

[0206] In some embodiments, Fig. 9 As shown, before removing noise information of the first image and enhancing edge information of the first image in step S120 to obtain the second image, the image classification method further includes steps S181 to S187.

[0207] S181, eliminating background information in the first image.

[0208] Specifically, before classifying the first image based on the user identity, the background information in the first image can be eliminated first. Thus, when the first image is classified based on the user identity, since the background information in the background area in the image is eliminated, the background area will not affect the face recognition in the image, thereby improving the accuracy of user identity recognition.

[0209] For example, background suppression can be achieved by using bottom hat transformation. The formula for bottom hat transformation is: B(f) = f·bf. Where f is the grayscale image after grayscale conversion, f·b is the closing operation on f, and B(f) represents the photo after background suppression.

[0210] S182, binarizing the pixel value of each pixel in the first image to obtain a binary image.

[0211] Among them, the binarization processing is to compare the pixel value of the pixel point with the preset value. For example, when the pixel value of the pixel point is greater than or equal to the preset value, the pixel value is replaced by 1; when the pixel value of the pixel point is less than the preset value, the pixel value is replaced by 0.

[0212] Specifically, the pixel value of each pixel in the first image may be converted into one of two possible values, thereby generating a binary image.

[0213] S183, in the binary image, detecting a binary area having a target shape.

[0214] The target shape is the shape of a human face, which may be a circular area or an elliptical area.

[0215] Specifically, according to the pixel value of each pixel point in the binary image, a region whose regional outline is a target shape can be detected, and this region can be called a binary region.

[0216] S184, calculating the overlap rate between the image information in the binarized area and the preset binarized face image template.

[0217] The binary face image template is a specific binary face image that has been binarized and is used as a standard or reference.

[0218] Specifically, the pixel values ​​of the binarized area and the corresponding position in the binarized face template are compared one by one, and the number of pixels with the same pixel value is counted. Then, the number of pixels is divided by the total number of pixels in the binarized face template, and the result is the overlap rate. The higher the overlap rate, the more similar the image information in the binarized area is to the preset face template in terms of shape, contour, etc.

[0219] S185, determining that the binarized area corresponding to the overlap rate greater than a preset overlap rate threshold is a face area.

[0220] Specifically, if the overlap rate between the binarized region and the preset binarized face template exceeds a preset overlap rate threshold, then it can be determined that the binarized region is a face region.

[0221] For example, each pixel in the first image after the bottom hat transformation is compared with a preset value. If the pixel value of the pixel is greater than or equal to the preset value, the pixel value of the pixel is set to 1; if the pixel value of the pixel is less than the preset value, the pixel value of the pixel is set to 0. After comparing all the pixels with the preset values, a binary image is obtained. Then, the Hough transform is used to detect the circular or elliptical area in the binary image to obtain the binary area to be selected. The overlap rate between the binary area and the preset binary face image template, that is, the overlap ratio, is calculated. If the overlap rate is greater than the preset overlap rate threshold, the binary area to be selected is used as the face area.

[0222] S186, identifying facial information in the facial area of ​​the first image, and obtaining user identity information of the user in the first image.

[0223] Specifically, after the face region in the first image is determined, the face information in the face region may be further extracted to obtain the identity information of the user in the image.

[0224] For example, a grayscale image of the face part is extracted from the first image according to the face area, and face recognition is performed on the grayscale image of the face part using a PCA method or a LBP method to obtain user identity information.

[0225] S187, classify the first image based on the user identity information.

[0226] Specifically, after obtaining the user identity information in the first image, the first images with the same user identity may be classified into the same category.

[0227] The embodiments of the present application effectively improve the accuracy of image classification based on user identity by eliminating background information, performing binarization processing, detecting and confirming face areas, and identifying user identity information.

[0228] Based on the same inventive concept, the present application also provides an image classification device, such as Fig.10 As shown, the device 1000 may include an acquisition module 1100 , a processing module 1200 , a determination module 1300 , a segmentation module 1400 , a calculation module 1500 and a classification module 1600 .

[0229] An acquisition module 1100 is used to acquire information of a target image set, where the target image set includes a plurality of first images;

[0230] The processing module 1200 is used to remove noise information of the first image and enhance edge information of the first image to obtain a second image;

[0231] A determination module 1300, configured to determine edge pixels in the third image according to a change in pixel values ​​between adjacent pixels in the third image, wherein the third image is obtained by fusing the second image and its corresponding first image;

[0232] A segmentation module 1400 is used to segment the third image based on edge pixels to obtain a background area of ​​the third image, wherein the background area is the area with the largest area after segmentation of the third image;

[0233] A calculation module 1500, configured to calculate the similarity between background regions of the third image;

[0234] The classification module 1600 is used to classify the first images corresponding to the third images whose similarity is greater than a preset similarity threshold into the same category.

[0235] In some embodiments, the processing module is used to remove noise information of the first image and enhance edge information of the first image to obtain a second image, which can be specifically used to:

[0236] Using a preset Gaussian filter to remove noise information from the first image to obtain a fourth image;

[0237] Dividing the fourth image into N sub-regions;

[0238] Among the N sub-regions, determine the sub-region whose pixel value of the central pixel point of the region is greater than the regional pixel mean as the first sub-region, and determine the sub-region whose pixel value of the central pixel point of the region is less than the regional pixel mean as the second sub-region;

[0239] The pixel value of the central pixel point of the first sub-area is added to the first preset value, and the second preset value is subtracted from the pixel value of the central pixel point of the second sub-area to obtain a second image.

[0240] In some embodiments, the determination module is used to determine edge pixel points in the third image according to the change of pixel values ​​between adjacent pixel points in the third image, and can be specifically used to:

[0241] In the third image, calculating a first change rate of the pixel value of each pixel point in the first direction and a second change rate in the second direction;

[0242] Calculating a target change rate of a pixel value of a pixel point based on the first change rate and the second change rate;

[0243] Pixels whose target change rate is greater than a preset change rate threshold are determined as edge pixels.

[0244] In some embodiments, the calculation module is used to calculate the first change rate of the pixel value of each pixel point in the first direction and the second change rate in the second direction in the third image, which can be specifically used to:

[0245] Based on a preset first convolution kernel, calculating a first change rate of a pixel value of each pixel point in the third image in a first direction;

[0246] Based on a preset second convolution kernel, a second change rate of the pixel value of each pixel point in the third image in the second direction is calculated.

[0247] In some embodiments, the calculation module is used to calculate the target change rate of the pixel value of the pixel point based on the first change rate and the second change rate, which can be specifically used to:

[0248] The square root of the sum of the square of the first change rate and the square of the second change rate is calculated to obtain the target change rate of the pixel value of the pixel point.

[0249] In some embodiments, the segmentation module is used to segment the third image based on edge pixels to obtain a background area of ​​the third image, which can be specifically used for:

[0250] Segmenting the third image based on edge pixels to obtain a first segmented area and a second segmented area;

[0251] Calculate a first area of ​​the first segmented region and a second area of ​​the second segmented region;

[0252] The segmented area corresponding to the larger area between the first area and the second area is determined as the background area of ​​the third image.

[0253] In some embodiments, the calculation module is used to calculate the similarity between the background regions of the third image, and can be specifically used to:

[0254] Calculate the regional pixel mean corresponding to the background area of ​​the third image;

[0255] Assigning pixel values ​​of pixels in the background area that are greater than or equal to the regional pixel mean to a first preset value, and assigning pixel values ​​of pixels that are less than the regional pixel mean to a second preset value, to obtain a target string corresponding to the background area, wherein the target string is obtained by combining the first preset value and the second preset value;

[0256] The similarity between the target character strings corresponding to the background area of ​​the third image is calculated.

[0257] In some embodiments, before the acquisition module is used to acquire information of the target image set, the device further includes a generation module:

[0258] The acquisition module is further used to acquire information of an original image set, where the original image set includes a plurality of original color images;

[0259] The processing module is further used to perform grayscale processing on the original color image to obtain a first image;

[0260] A generating module, used for generating a target image set based on the first image;

[0261] The classification module is used to classify the first images corresponding to the third images whose similarity is greater than a preset similarity threshold into the same category, and can be specifically used to:

[0262] The original color images corresponding to the third images whose similarity is greater than a preset similarity threshold are divided into the same category.

[0263] In some embodiments, the generating module is used to generate a target image set based on the first image, and can be specifically used to:

[0264] Slide the preset window on the first image with a preset step length, and calculate the window pixel mean corresponding to the preset window at each sliding;

[0265] In the same first image, the number of windows whose window pixel mean is greater than a preset threshold is calculated;

[0266] The first images with the same number of windows are divided into the same target image set.

[0267] In some embodiments, before the processing module is used to remove noise information of the first image and enhance edge information of the first image to obtain the second image, the device further includes a cleaning module, a detection module and a recognition module:

[0268] A cleaning module, used for removing background information in the first image;

[0269] A processing module, used for performing binarization processing on the pixel value of each pixel point in the first image to obtain a binary image;

[0270] A detection module, used for detecting a binary region having a target shape in a binary image;

[0271] A calculation module, used for calculating the coincidence rate between the image information in the binarized area and the preset binarized face image template;

[0272] A determination module, used to determine that a binary region corresponding to an overlap rate greater than a preset overlap rate threshold is a face region;

[0273] A recognition module, used to recognize face information in a face area of ​​the first image, and obtain user identity information of a user in the first image;

[0274] The classification module is further used to classify the first image based on the user identity information.

[0275] Each module in the image classification device provided in the embodiment of the present application can realize Figures 1 to 9The functions of each step of the provided image classification method and the ability to achieve the corresponding technical effects are described briefly and will not be repeated here.

[0276] Fig.11 A schematic diagram of the hardware structure of an image classification device provided in an embodiment of the present application is shown.

[0277] The image classification device may include a processor 1101 and a memory 1102 storing computer program instructions.

[0278] Specifically, the processor 1101 may include a central processing unit (CPU), or an application specific integrated circuit (ASIC), or may be configured to implement one or more integrated circuits of the embodiments of the present application.

[0279] The memory 1102 may include a large capacity memory for data or instructions. By way of example and not limitation, the memory 1102 may include a hard disk drive (HDD), a floppy disk drive, a flash memory, an optical disk, a magneto-optical disk, a magnetic tape, or a universal serial bus (USB) drive, or a combination of two or more of these. Where appropriate, the memory 1102 may include removable or non-removable (or fixed) media. Where appropriate, the memory 1102 may be internal or external to the image classification device. In a particular embodiment, the memory 1102 is a non-volatile solid-state memory.

[0280] The memory may include a read-only memory (ROM), a random access memory (RAM), a magnetic disk storage medium device, an optical storage medium device, a flash memory device, an electrical, optical or other physical / tangible memory storage device. Therefore, generally, the memory includes one or more tangible (non-transitory) computer-readable storage media (e.g., memory devices) encoded with software including computer-executable instructions, and when the software is executed (e.g., by one or more processors), it is operable to perform the operations described with reference to the method according to one aspect of the present disclosure.

[0281] The processor 1101 reads and executes computer program instructions stored in the memory 1102 to implement any one of the image classification methods in the above embodiments.

[0282] In one example, the image classification device may further include a communication interface 1103 and a bus 1104. Fig.11 As shown, the processor 1101, the memory 1102, and the communication interface 1103 are connected via a bus 1104 and communicate with each other.

[0283] The communication interface 1103 is mainly used to implement communication between various modules, devices, units and / or equipment in the embodiments of the present application.

[0284] The bus 1104 includes hardware, software or both, coupling the components of the image classification device to each other. For example, but not limitation, the bus may include an accelerated graphics port (Accelerated Graphics Port, AGP) or other graphics bus, an enhanced industry standard architecture (Extended Industry Standard Architecture, EISA) bus, a front side bus (Front Side Bus, FSB), a Hyper Transport (Hyper Transport, HT) interconnect, an industry standard architecture (Industry Standard Architecture, ISA) bus, an infinite bandwidth interconnect, a low pin count (Linear Predictive Coding, LPC) bus, a memory bus, a micro channel architecture (MicroChannel Architecture, MCA) bus, a peripheral component interconnect (Peripheral Component Interconnect, PCI) bus, a PCI-Express (Peripheral Component Interconnect-X, PCI-X) bus, a serial advanced technology attachment (Serial Advanced Technology Attachment, SATA) bus, a video electronics standard association local (VESA Local Bus, VLB) bus or other suitable buses or a combination of two or more of these. Where appropriate, the bus 1104 may include one or more buses. Although embodiments of the present application describe and illustrate a particular bus, the present application contemplates any suitable bus or interconnect.

[0285] The device can perform the image classification method in the embodiment of the present application based on each unit / component in the image classification device, thereby realizing the combination of Figures 1 to 9 Describes how images are classified.

[0286] In addition, in combination with the image classification method in the above embodiment, the embodiment of the present application can provide a computer storage medium for implementation. The computer storage medium stores computer program instructions; when the computer program instructions are executed by a processor, any image classification method in the above embodiment is implemented.

[0287] The present application also provides a computer program product. When the instructions in the computer program product are executed by a processor of an electronic device, the electronic device executes each process of implementing any one of the above-mentioned image classification method embodiments.

[0288] It should be clear that the present application is not limited to the specific configuration and processing described above and shown in the figures. For the sake of simplicity, a detailed description of the known method is omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of the present application is not limited to the specific steps described and shown, and those skilled in the art can make various changes, modifications and additions, or change the order between the steps after understanding the spirit of the present application.

[0289] The functional blocks shown in the above-described block diagram can be implemented as hardware, software, firmware or a combination thereof. When implemented in hardware, it can be, for example, an electronic circuit, an application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), appropriate firmware, plug-in, function card, etc. When implemented in software, the elements of the present application are programs or code segments used to perform the required tasks. The program or code segment can be stored in a machine-readable medium, or transmitted on a transmission medium or communication link by a data signal carried in a carrier. "Machine-readable medium" may include any medium capable of storing or transmitting information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, read-only memory (Read-Only Memory, ROM), flash memory, erasable read-only memory (Erasable Read Only Memory, EROM), floppy disks, compact disc read-only memory (Compact Disc Read-Only Memory, CD-ROM), optical discs, hard disks, optical fiber media, radio frequency (Radio Frequency, RF) links, etc. The code segment can be downloaded via a computer network such as the Internet, an intranet, etc.

[0290] It should also be noted that the exemplary embodiments mentioned in this application describe some methods or systems based on a series of steps or devices. However, this application is not limited to the order of the above steps, that is, the steps can be performed in the order mentioned in the embodiment, or in a different order from the embodiment, or several steps can be performed simultaneously.

[0291] Aspects of the present disclosure are described above with reference to the flowchart and / or block diagram of the method, device (system) and computer program product according to the embodiment of the present disclosure. It should be understood that each box in the flowchart and / or block diagram and the combination of each box in the flowchart and / or block diagram can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device to produce a machine so that these instructions executed by the processor of the computer or other programmable data processing device enable the implementation of the function / action specified in one or more boxes of the flowchart and / or block diagram. Such a processor can be, but is not limited to, a general-purpose processor, a special-purpose processor, a special application processor, or a field programmable logic circuit. It can also be understood that each box in the block diagram and / or flowchart and the combination of boxes in the block diagram and / or flowchart can also be implemented by dedicated hardware that performs a specified function or action, or can be implemented by a combination of dedicated hardware and computer instructions.

[0292] The above are only specific implementation methods of the present application. Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working processes of the systems, modules and units described above can refer to the corresponding processes in the aforementioned method embodiments, and will not be repeated here. It should be understood that the protection scope of the present application is not limited to this. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed in this application, and these modifications or replacements should be included in the protection scope of this application.

Claims

1. A method for classifying an image, characterized in that: include: Acquire information of a target image set, where the target image set includes a plurality of first images; removing noise information of the first image and enhancing edge information of the first image to obtain a second image; Determining edge pixel points in the third image according to a change in pixel values ​​between adjacent pixel points in the third image, wherein the third image is obtained by fusing the second image and its corresponding first image; Segmenting the third image based on the edge pixels to obtain a background area of ​​the third image, wherein the background area is the area with the largest area after segmentation of the third image; calculating the similarity between the background regions of the third image; The first images corresponding to the third images whose similarity is greater than a preset similarity threshold are classified into the same category.

2. The method according to claim 1, characterized in that The removing noise information of the first image and enhancing edge information of the first image to obtain a second image includes: Using a preset Gaussian filter to remove noise information from the first image to obtain a fourth image; Dividing the fourth image into N sub-regions; Among the N sub-regions, determine a sub-region in which the pixel value of the central pixel point of the region is greater than the regional pixel mean as the first sub-region, and determine a sub-region in which the pixel value of the central pixel point of the region is less than the regional pixel mean as the second sub-region; The pixel value of the central pixel point of the first sub-area is added to the first preset value, and the second preset value is subtracted from the pixel value of the central pixel point of the second sub-area to obtain a second image.

3. The method according to claim 1, characterized in that The step of determining edge pixels in the third image according to a change in pixel values ​​between adjacent pixels in the third image comprises: In the third image, calculating a first change rate of the pixel value of each pixel point in the first direction and a second change rate in the second direction; Calculating a target change rate of the pixel value of the pixel point based on the first change rate and the second change rate; The pixel point whose target change rate is greater than a preset change rate threshold is determined as an edge pixel point.

4. The method according to claim 3, characterized in that: The step of calculating, in the third image, a first change rate of the pixel value of each pixel point in the first direction and a second change rate in the second direction includes: Based on a preset first convolution kernel, calculating a first change rate of a pixel value of each pixel point in the third image in a first direction; Based on a preset second convolution kernel, a second change rate of the pixel value of each pixel point in the third image in the second direction is calculated.

5. The method according to claim 3, characterized in that: The calculating the target change rate of the pixel value of the pixel point based on the first change rate and the second change rate includes: The square root of the sum of the square of the first change rate and the square of the second change rate is calculated to obtain a target change rate of the pixel value of the pixel point.

6. The method according to claim 1, characterized in that The step of segmenting the third image based on the edge pixels to obtain a background area of ​​the third image includes: Segmenting the third image based on the edge pixels to obtain a first segmented area and a second segmented area; Calculating a first area of ​​the first segmented region and a second area of ​​the second segmented region; A segmented area corresponding to a larger area between the first area and the second area is determined as a background area of ​​the third image.

7. The method according to claim 1, characterized in that The calculating the similarity between the background regions of the third image comprises: Calculating a regional pixel mean corresponding to the background area of ​​the third image; Assigning pixel values ​​of pixels in the background area that are greater than or equal to the average pixel value of the area to a first preset value, and assigning pixel values ​​of pixels that are less than the average pixel value of the area to a second preset value, to obtain a target character string corresponding to the background area, wherein the target character string is obtained by combining the first preset value and the second preset value; The similarity between the target character strings corresponding to the background area of ​​the third image is calculated.

8. The method according to claim 1, characterized in that Before acquiring the information of the target image set, the method further includes: Acquire information of an original image set, where the original image set includes a plurality of original color images; Performing grayscale processing on the original color image to obtain the first image; Based on the first image, generating a target image set; The classifying the first images corresponding to the third images whose similarity is greater than a preset similarity threshold into the same category includes: The original color images corresponding to the third images whose similarity is greater than a preset similarity threshold are divided into the same category.

9. The method according to claim 8, characterized in that The step of generating a target image set based on the first image includes: Slide a preset window on the first image with a preset step length, and calculate a window pixel mean corresponding to the preset window at each sliding; In the same first image, calculating the number of windows whose window pixel mean is greater than a preset threshold; The first images having the same number of windows are divided into the same target image set.

10. The method according to any one of claims 1 to 9, characterized in that: Before removing the noise information of the first image and enhancing the edge information of the first image to obtain the second image, the method further includes: Eliminating background information in the first image; Binarizing the pixel value of each pixel in the first image to obtain a binary image; In the binary image, detecting a binary region having a target shape; Calculating the overlap rate between the image information in the binarized area and a preset binarized face image template; Determine that the binarized area corresponding to the overlap rate greater than a preset overlap rate threshold is a face area; Recognize facial information in a facial region of the first image to obtain user identity information of a user in the first image; Based on the user identity information, the first image is classified.

Citation Information

Cited By

  • Abnormality identification method for disc brake hydraulic station

    CN120431563A

  • An anomaly identification method for disc brake hydraulic station

    CN120431563B