Picture classification method and device, electronic equipment and computer readable medium
By extracting and combining features from segmented images and using feature comparison values for classification, the problem of low efficiency in segmented image recognition in existing technologies is solved, achieving more efficient image data recognition and classification.
Patent Information
- Application Number
- CN202211250720.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-10-12
- Publication Date
- 2025-12-12
- Estimated Expiration
- 2042-10-12
AI Technical Summary
Existing technologies have low efficiency in recognizing multiple image segments, and key data in these segments are easily filtered out, making them difficult to effectively identify and classify.
By extracting and recognizing features from each image segment, multiple image segments are combined into a whole image for further feature extraction and recognition. The feature comparison values are then used for classification, including feature comparison and differential processing between the image segment to be classified and the standard image segment. Finally, the target image is selected for classification.
It improves the recognition rate of image data, enhances the accuracy and efficiency of image segmentation recognition, reduces redundant features in the classification process, and enhances the implicit value of the feature library.
Smart Images

Figure CN115457333B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of network technology and data security, in particular to a picture classification method, a picture classification device, an electronic device, and a computer readable medium. BACKGROUND
[0002] Network technology includes a lot of important data, and pictures are one of the main forms of important data. Currently, picture recognition is mainly based on the overall features of pictures. However, sometimes a picture is often shared, used or transmitted in the form of multiple split pictures. At this time, each split picture needs to be identified.
[0003] Currently, multiple split pictures are identified by regarding the multiple split pictures as independent and complete pictures, and then implementing identification through preprocessing and neural network algorithms. This method has low picture classification efficiency, and only has identification effect for complete pictures or approximately complete pictures. Many key data of split pictures are directly filtered.
[0004] Therefore, how to identify and classify pictures is a problem to be solved. SUMMARY
[0005] Embodiments of the present application provide a picture classification method and device, an electronic device, and a computer readable medium, which can extract and identify features of each split picture, and combine multiple split pictures into an overall picture to extract and identify features, thereby improving the recognition rate of picture data.
[0006] In a first aspect, embodiments of the present application provide a picture classification method, which includes: obtaining a group of split pictures to be classified; wherein the group of split pictures to be classified includes multiple split pictures to be classified, which are obtained by splitting a picture to be classified; performing feature comparison between the multiple split pictures to be classified and standard split pictures contained in multiple group of standard split pictures, to obtain a first feature comparison value of each group of standard split pictures for the multiple split pictures to be classified; selecting a target picture from a preset overall picture set according to the multiple first feature comparison values; wherein the preset overall picture set includes standard pictures corresponding to the multiple group of standard split pictures, respectively; performing feature comparison between the picture to be classified and the target picture, to obtain a second feature comparison value, and classifying the picture to be classified according to the second feature comparison value.
[0007] In an embodiment of the present application, based on the foregoing scheme, for each standard slice group, the plurality of to-be-classified slices are respectively compared with the standard slices of the same identification number in the standard slice group to obtain a feature comparison value between the to-be-classified slice and the standard slice of the same identification number, and the feature comparison values between the to-be-classified slices and the standard slices of each identification number are summed to obtain the first feature comparison value.
[0008] In an embodiment of the present application, based on the foregoing scheme, the smallest first feature comparison value is determined from the plurality of first feature comparison values; if the smallest first feature comparison value is smaller than a preset threshold value, a standard picture corresponding to the smallest first feature comparison value is selected from the preset overall picture set, and the selected standard picture is taken as the target picture.
[0009] In an embodiment of the present application, based on the foregoing scheme, it is detected whether the second feature comparison value is smaller than or equal to a preset feature comparison threshold value; if the second feature comparison value is smaller than or equal to the preset feature comparison threshold value, it is determined that the to-be-classified picture belongs to the category corresponding to the target picture; if the second feature comparison value is greater than the preset feature comparison threshold value, it is determined that the to-be-classified picture does not belong to the category corresponding to the target picture.
[0010] In an embodiment of the present application, based on the foregoing scheme, the standard slices contained in the plurality of standard slice groups are feature data corresponding to the standard slices, and the feature data is obtained after feature extraction processing is performed on the standard slices.
[0011] In an embodiment of the present application, based on the foregoing scheme, feature extraction processing is performed on the plurality of to-be-classified slices to obtain feature data corresponding to the to-be-classified slices; the feature data corresponding to the to-be-classified slices is compared with the feature data of the standard slices contained in the plurality of standard slice groups to obtain a first feature comparison value of the plurality of to-be-classified slices for each standard slice group.
[0012] In an embodiment of the present application, based on the foregoing scheme, each to-be-classified slice is subjected to difference processing to obtain a plurality of to-be-classified slice difference image sets; a to-be-classified slice difference image is determined from each to-be-classified slice difference image set as a feature image to obtain a plurality of to-be-classified slice difference feature images; and feature extraction is performed on each to-be-classified slice difference feature image to obtain feature data corresponding to the to-be-classified slice.
[0013] In an embodiment of the present application, based on the foregoing scheme, the standard pictures contained in the preset overall picture set are feature data corresponding to the standard pictures, and the feature data is obtained after feature extraction processing is performed on the standard pictures.
[0014] In an embodiment of the present application, based on the foregoing scheme, feature extraction is performed on the picture to be classified to obtain feature data corresponding to the picture to be classified; the feature data corresponding to the picture to be classified is compared with the feature data corresponding to the target picture to obtain the second feature comparison value.
[0015] In an embodiment of the present application, based on the foregoing scheme, difference processing is performed on the picture to be classified to obtain a set of difference images to be classified; a difference image to be classified is determined from the set of difference images to be classified as a feature image to obtain a difference feature image to be classified; feature extraction is performed on the difference feature image to be classified to obtain feature data corresponding to the picture to be classified.
[0016] In a second aspect, an embodiment of the present application provides an electronic device, including one or more processors; a memory for storing one or more programs, when the one or more programs are executed by the one or more processors, the electronic device implements the picture classification method as described above.
[0017] In a third aspect, an embodiment of the present application provides a computer readable medium having a computer program stored thereon, when the computer program is executed by a processor, the picture classification method as described above is implemented.
[0018] In a fourth aspect, an embodiment of the present application provides a computer program product including computer instructions, when the computer instructions are executed by a processor, the picture classification method as described above is implemented.
[0019] In the technical scheme provided by the embodiments of the present application:
[0020] Through the embodiments of the present application, a plurality of standard pictures can be obtained first, feature extraction is performed on each standard picture to obtain feature data corresponding to the plurality of standard pictures; further, feature extraction is performed on a plurality of standard patches corresponding to each standard picture to obtain feature data of the plurality of standard patches. The two kinds of feature data can be saved in a preset overall picture set. When a group of pictures to be classified is received, feature extraction is performed on all patches in the group to obtain feature data of the patches to be classified, and all patches in the group are combined into a picture to be classified, and feature extraction is also performed on the picture to be classified to obtain feature data of the picture to be classified. Further, feature comparison is performed between the plurality of patches to be classified and the standard patches contained in the plurality of groups of standard patches to obtain first feature comparison values; a target picture is selected from the preset overall picture set according to the plurality of first feature comparison values, and feature comparison is performed between the picture to be classified and the target picture to obtain a second feature comparison value. In this way, the picture to be classified can be classified according to the second feature comparison value. Through the method, the recognition rate of picture data can be improved.
[0021] It should be understood that the foregoing general description and the following detailed description are only exemplary and explanatory and are not restrictive of the application. BRIEF DESCRIPTION OF DRAWINGS
[0022] Figure 1 is a schematic diagram of a computer-implemented framework to which embodiments of the present application can be applied;
[0023] Figure 2 is a flowchart of a picture classification method according to an example embodiment of the present application;
[0024] Figure 3 is a schematic diagram of a relationship between a set of slices to be classified and a set of preset overall pictures according to an example embodiment of the present application;
[0025] Figure 4 is a flowchart of a picture classification method according to another example embodiment of the present application;
[0026] Figure 5 is a flowchart of a picture classification method according to another example embodiment of the present application;
[0027] Figure 6 is a flowchart of a picture classification method according to another example embodiment of the present application;
[0028] Figure 7 is a flowchart of a picture classification method according to another example embodiment of the present application;
[0029] Figure 8 is a flowchart of a picture classification method according to another example embodiment of the present application;
[0030] Figure 9 is a flowchart of a picture classification method according to another example embodiment of the present application;
[0031] Figure 10 is a flowchart of a picture classification method according to another example embodiment of the present application;
[0032] Figure 11 is a flowchart of a picture classification method according to another example embodiment of the present application;
[0033] Figure 12 is a block diagram of a picture classification apparatus according to an embodiment of the present application;
[0034] Figure 13 is a structural schematic diagram of a computer system of an electronic device suitable for implementing embodiments of the present application. DETAILED DESCRIPTION
[0035] The exemplary embodiments will be described in detail below with reference to the drawings. In the following description, the same numbers are used to denote the same elements throughout the several views. The following description of exemplary embodiments is not representative of all possible embodiments consistent with the present application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of the present application as detailed in the appended claims.
[0036] The block diagrams shown in the drawings are merely functional entities, and do not necessarily have to correspond to physically independent entities. That is, the functional entities can be implemented in software, or in one or more hardware modules or integrated circuits, or in different network and / or processor devices and / or microcontroller devices.
[0037] The flowcharts shown in the drawings are merely exemplary illustrations, and do not necessarily include all contents and operations / steps, nor do they have to be executed in the order described. For example, some operations / steps can be further divided, and some operations / steps can be combined or partially combined, so that the actual execution order can be changed according to the actual situation.
[0038] It should also be noted that "multiple" as mentioned in the present application means two or more. The association relationship of "and / or" describes the associated objects, which means that there can be three relationships, for example, A and / or B can mean that A exists alone, A and B exist together, and B exists alone. The character " / " generally means that the associated objects before and after are in an "or" relationship.
[0039] The following describes the professional terms and professional knowledge related to the embodiments of the present application:
[0040] An image pyramid is a structure for explaining an image in multiple resolutions, which generates N images with different resolutions by performing multi-scale pixel sampling on an original image. The image with the highest level of resolution is placed at the bottom, arranged in a pyramid shape, and above it is a series of images with gradually reduced pixels (size), up to the top of the pyramid, which contains only one pixel point image, thus constituting a traditional image pyramid.
[0041] A Gaussian pyramid is a technique used in image processing, computer vision, and signal processing. The Gaussian pyramid is essentially a multi-scale representation of a signal, that is, a Gaussian blur is performed on the same signal or image multiple times, and down-sampling is performed, so as to generate multiple sets of signals or images at different scales for subsequent processing. For example, in image recognition, different sizes of the content to be found can be prevented by comparing images at different scales.
[0042] The difference of Gaussian (DOG) pyramid is built on the basis of the Gaussian pyramid, and the purpose of generating the Gaussian pyramid can be to build the DOG pyramid. The first group and the first layer of the DOG pyramid is obtained by subtracting the first group and the first layer from the second group and the second layer of the Gaussian pyramid. In this way, each difference image is generated group by group and layer by layer, and all the difference images constitute the difference pyramid.
[0043] The picture classification method and device, electronic equipment and computer readable medium provided in the embodiments of the present application relate to the technical field of computer security, and will be described in detail below.
[0044] Please refer to Figure 1 , Figure 1 is a schematic diagram of a computer implementation framework involved in the present application. The computer implementation framework can include a slicing module 110, a difference processing module 120, a feature extraction module 130, and a classification module 140. The slicing module 110 can slice an overall picture, where the overall picture is a complete picture, and the slicing module 110 can split the overall picture into multiple picture slices. The number N of the split picture slices can be set by a person skilled in the art, and the embodiments of the present application are not limited. In the embodiments of the present application, for the convenience of description, the number N of the slices is assumed to be the same, that is, the number of slices for different overall pictures is consistent.
[0045] The difference processing module 120 can perform difference processing on an overall picture or a sliced picture. The difference processing can include constructing a Gaussian pyramid for each picture by using a Gaussian filter function, and then calculating a corresponding difference of Gaussian (DOG) pyramid according to each Gaussian pyramid. Each difference pyramid can include M difference pictures, and the M can also be set by a person skilled in the art, and the embodiments of the present application are not limited. In the embodiments of the present application, for the convenience of description, the M is assumed to be the same, that is, the number of difference images obtained by performing difference processing on different pictures is consistent.
[0046] The feature extraction module 130 can perform feature extraction on each difference feature map to obtain corresponding feature data. The feature extraction can include but is not limited to extracting main features such as outlines and corner points of the difference feature map by using the Gaussian difference. The specific feature extraction method can be designed by a person skilled in the art, and the embodiments of the present application are not limited.
[0047] The classification module 140 can classify the pictures according to the feature comparison values. Specifically, the feature comparison values can be obtained by comparing the features of the to-be-classified slice group and the multiple slices in the preset overall picture set, and then the to-be-classified slice group can be classified according to the feature comparison values.
[0048] Figure 2 This is a flowchart illustrating an image classification method according to an exemplary embodiment. Figure 2 As shown, in an exemplary embodiment, the method may include steps S210 to S240, and the execution entity of this application embodiment may be a computer. The detailed method is described below:
[0049] Step S210: Obtain the segment group to be classified; wherein, the segment group to be classified includes multiple segments to be classified, and the multiple segments to be classified are obtained by splitting the image to be classified.
[0050] The group of segments to be classified may include N segments, which can be combined into a single image to be classified, i.e., a complete image. The combination method can be based on the principle of most similar features, and this application does not limit the specific method used.
[0051] like Figure 3 The diagram illustrates the relationship between a group of images to be classified and a preset overall image set, as shown in an embodiment of this application. The preset overall image set may include standard image 1, standard image 2...standard image 8, where standard image 1 can be divided into standard segments 11, 12, 13, 14,..., 16. The group of images to be classified includes segments 1, 2, 3, 4,..., 6. In other words, Figure 3 In the example shown, the preset overall image set includes 8 standard images, and each standard image can be divided into 6 segments.
[0052] Step S220: Compare the features of multiple segments to be classified with the standard segments contained in multiple standard segment groups to obtain the first feature comparison value of multiple segments to be classified for each standard segment group.
[0053] In one embodiment of this application, before performing the feature comparison, each of the multiple segments to be classified can be preprocessed. Preprocessing may include digitization, geometric transformation, normalization, and smoothing, etc. Specific preprocessing methods can be set by those skilled in the art to facilitate subsequent processing; this embodiment of the application does not limit the specific methods.
[0054] In this step, before comparing the features of multiple unclassified segments with those of standard segments contained in multiple standard segment groups, the multiple unclassified segments can be differentially processed to obtain multiple sets of differentially derived images. Further, multiple differential feature maps of the unclassified segments are determined from these sets. By extracting features from each differential feature map of the unclassified segments, the feature data corresponding to the multiple unclassified segments is obtained.
[0055] In this step, before the feature comparison between the plurality of standard slice groups and the plurality of to-be-classified slices, the feature data of each standard slice in the plurality of standard slice groups is obtained. The method for obtaining the feature data of each standard slice can be: performing differential processing on the standard slices contained in the plurality of standard slice groups, and each standard slice can obtain a corresponding standard differential image set. A standard slice differential image feature map is selected from the standard slice differential image set, and feature extraction is performed on the standard slice differential image feature map to obtain the feature data of each standard slice. Each standard slice group in the plurality of standard slice groups can correspond to a standard image, and a plurality of standard images can be pre-stored in a preset overall image set.
[0056] Further, the feature data of the plurality of to-be-classified slices is compared with the feature data of the standard slices in the plurality of standard slice groups to obtain a first feature comparison value of each standard slice group for the plurality of to-be-classified slices.
[0057] Step S230: selecting a target image from the preset overall image set according to the plurality of first feature comparison values; wherein the preset overall image set includes standard images corresponding to the plurality of standard slice groups respectively.
[0058] Specifically, the smallest first feature comparison value can be determined from the plurality of first feature comparison values. Further, the standard image corresponding to the smallest first feature comparison value is selected from the preset overall image set, and the selected standard image is taken as the target image.
[0059] Step S240: performing feature comparison between the to-be-classified image and the target image to obtain a second feature comparison value, and classifying the to-be-classified image according to the second feature comparison value.
[0060] Before the feature comparison between the to-be-classified image and the target image, the feature data of the target image can be obtained. The method for obtaining the feature data of the target image can be: performing differential processing on the target image to obtain a plurality of target differential images, selecting a target differential feature map from the plurality of target differential images, and performing feature extraction on the target differential feature map to obtain the feature data of the target image. The same operation can be performed on all standard images in the preset overall image set to obtain the feature data of each standard image.
[0061] It should be noted that the feature extraction operation can be performed on each standard image in the preset overall image set to obtain the feature data of the plurality of standard images. Further, the feature data corresponding to the plurality of to-be-classified slices and the feature data of the plurality of standard images can be associated and stored in a feature library.
[0062] Further, the to-be-classified picture is compared with the target picture in features to obtain a second feature comparison value. The to-be-classified picture can be classified according to the second feature comparison value.
[0063] In the embodiment of the application, a plurality of standard pictures can be acquired first, and feature extraction is performed on each standard picture to obtain feature data corresponding to the plurality of standard pictures. Further, feature extraction is performed on a plurality of standard patches corresponding to each standard picture to obtain feature data of the plurality of standard patches. The two kinds of feature data can be stored in a preset overall picture set. When a group of to-be-classified patches is received, feature extraction is performed on all the patches in the group to obtain feature data of the to-be-assigned patches, and all the patches in the group are combined into a to-be-classified picture, and feature extraction is performed on the to-be-classified picture to obtain feature data of the to-be-classified picture. Further, the plurality of to-be-classified patches are compared with standard patches contained in a plurality of standard patch groups in features to obtain a plurality of first feature comparison values, a target picture is selected from the preset overall picture set according to the plurality of first feature comparison values, and the to-be-classified picture is compared with the target picture in features to obtain a second feature comparison value. In this way, the to-be-classified picture can be classified according to the second feature comparison value. Through the method, the recognition rate of picture data can be improved.
[0064] Figure 4 is Figure 2 The step S220 in the embodiment shown in the flowchart in an exemplary embodiment. As shown in Figure 4 The process of comparing the plurality of to-be-classified patches with the standard patches contained in the plurality of standard patch groups in features to obtain the first feature comparison values of the plurality of to-be-classified patches for each standard patch group in an exemplary embodiment can include the step S410, which is described in detail as follows:
[0065] The step S410: for each standard patch group, the plurality of to-be-classified patches are compared with the standard patches of the same identification number in the standard patch group in features to obtain the feature comparison values between the to-be-classified patches and the standard patches of the same identification number, and the feature comparison values between the to-be-classified patches and the standard patches of each identification number are summed to obtain the first feature comparison value.
[0066] Exemplarily, as Figure 3As shown, feature comparison can be performed between the segment to be classified (segment 1) and standard segment 11 in standard segment group 1. The identifier of segment 1 is 1, and the identifier of standard segment 11 is also 1. The identifier of segment 2 to be classified is 2, and the identifier of standard segment 12 is also 2, and so on. It should be noted that "1" in standard segment 12 indicates that standard segment 12 is associated with standard image 1, and "2" indicates that this standard segment is the segment with identifier 2 of standard image 1. Further, feature comparison can be performed between segment 2 to be classified and standard segment 12 in standard segment group 1, and so on, resulting in 6 feature comparison values for this group of standard segments. Summing these 6 feature comparison values yields the first feature comparison value 1.
[0067] Furthermore, the feature comparison is performed between the segment to be classified 1 and the standard segment 21 in the standard segment group; the feature comparison is performed between the segment to be classified 2 and the standard segment 22 in the standard segment group 1, and so on. In this way, 6 feature comparison values for the standard segment group 2 can be obtained. The summation of the 6 feature comparison values can be used to obtain the first feature comparison value 2.
[0068] By analogy, eight first feature comparison values can be obtained.
[0069] In this embodiment of the application, multiple segments to be classified are compared with multiple standard segments in the standard segment group to obtain multiple first feature comparison values, which is beneficial for classifying the multiple segments to be classified.
[0070] Figure 5 yes Figure 2 The flowchart of step S230 in the illustrated embodiment is shown in an exemplary embodiment. Figure 5 As shown in an exemplary embodiment, the process of selecting a target image from a preset overall image set based on multiple first feature comparison values may include steps S510 to S520, which are described in detail below:
[0071] Step S510: If the smallest first feature comparison value is less than a preset threshold, then determine the smallest first feature comparison value from multiple first feature comparison values.
[0072] For example, by means of Figure 4 As shown in the steps, the smallest first feature alignment value can be determined from the eight first feature alignment values. This smallest first feature alignment value can be denoted as Z. part , (k is the total number of images in the preset overall image set). For those based on Figure 3 In the example shown,
[0073] In an embodiment of the present application, it can be determined whether the smallest first feature comparison value is less than a preset threshold value. If it is less than or equal to the preset threshold value, i.e., Z part ≤ H1, it indicates that the combination of the to-be-classified patches is similar to the target picture, where H1 is the preset threshold value. If Z part > H1, it indicates that the combination of the to-be-classified patches is not similar to the target picture.
[0074] Step S520: selecting a standard picture corresponding to the smallest first feature comparison value from the preset overall picture set, and taking the selected standard picture as the target picture.
[0075] For example, the smallest first feature comparison value in the eight first feature comparison values is the first feature comparison value 3, which means that the feature of the standard patch group 3 is closest to that of the to-be-classified patch group, and thus the standard picture 3 can be determined as the target picture.
[0076] In an embodiment of the present application, the target picture can be determined according to the smallest first feature comparison value in the plurality of first feature comparison values by the feature data comparison method.
[0077] Figure 6 is Figure 2 The flowchart of step S240 in the embodiment shown in FIG. 2 is shown in an exemplary embodiment. As shown in FIG. 6, in an exemplary embodiment, the process of classifying the to-be-classified picture according to the second feature comparison value can include steps S610 to S630, which are described in detail as follows. Figure 6
[0078] Step S610: detecting whether the second feature comparison value is less than or equal to a preset feature comparison threshold value.
[0079] The preset feature comparison threshold value can be set by a person skilled in the art, and can be changed according to a specific application scenario, which is not limited in the embodiment of the present application.
[0080] The second feature comparison value can be denoted as Z whole , Z whole = |Feature wholeU - Feature wholeV |, where V represents the target picture.
[0081] Step S620: if the second feature comparison value is less than or equal to the preset feature comparison threshold value, it is determined that the to-be-classified picture belongs to the category corresponding to the target picture.
[0082] Z whole ≤ H2, it is determined that the to-be-classified picture belongs to the category corresponding to the target picture, where H2 is the preset feature comparison threshold value.
[0083] Step S630: If the second feature comparison value is greater than the preset feature comparison threshold, then it is determined that the image to be classified does not belong to the category corresponding to the target image.
[0084] That is, Z whole When H2 is greater than H2, it is determined that the image to be classified does not belong to the category corresponding to the target image.
[0085] In this embodiment of the application, Z can be whole Comparing with H2 is helpful for classifying images.
[0086] Figure 7 yes Figure 2 The flowchart of step S220 in the illustrated embodiment is shown in an exemplary embodiment. Figure 7 As shown, in an exemplary embodiment, the process of comparing the features of multiple segments to be classified with the standard segments contained in multiple standard segment groups to obtain the first feature comparison value of the multiple segments to be classified for each standard segment group may include steps S710 to S720, which are described in detail below:
[0087] Step S710: Perform feature extraction processing on multiple segments to be classified to obtain feature data corresponding to the segments to be classified.
[0088] Among them, the standard segments contained in the multiple standard segment groups are the feature data corresponding to the standard segments, and the feature data are obtained after feature extraction processing of the standard segments.
[0089] A standard piecewise group can correspond to a feature data set. The feature data set of a standard piecewise group q can be denoted as Feature. wpartq ={Feature partq1 Feature partq2 ...Feature partqN}. Here, q is the identifier of a standard fragment group, and N is the number of fragments included in a standard fragment group. For example, Figure 3 As shown, the feature data set of standard fragment group 3. wpart3 ={Feature part31 Feature part32 ...Feature part36 For example, the feature data set of labeled slice group 5. wpart5 ={Feature part51 Feature part52 ...Feature part56}, and so on.
[0090] Similarly, the feature data set of the to-be-classified shard group can be denoted as Feature partU , wherein Feature partU = {Feature partU1 , Feature partU2 , …, Feature partUN}. Exemplarily, in Feature Figure 3 , Feature partU = {Feature partU1 , Feature partU2 , …, Feature partU6}.
[0091] Step S720: performing feature comparison between the feature data corresponding to the to-be-classified shard and the feature data of the standard shards contained in the plurality of standard shard groups, to obtain a first feature comparison value of each standard shard group for the plurality of to-be-classified shards.
[0092] Specifically, the to-be-classified shard 1 can be compared with the standard shard 11 in the standard shard group 1, that is, Feature partU1 is compared with Feature part11 , Feature partU2 is compared with Feature part12 , and so on. In this way, six feature comparison values for the standard shard group 1 can be obtained, and the sum operation of the six feature comparison values can obtain the first feature comparison value 1.
[0093] Further, the to-be-classified shard 1 can be compared with the standard shard 21 in the standard shard group, and the to-be-classified shard 2 can be compared with the standard shard 22 in the standard shard group 1, and so on. That is, Feature partU1 is compared with Feature part21 , Feature partU2 is compared with Feature part22 , and so on. In this way, six feature comparison values for the standard shard group 2 can be obtained, and the sum operation of the six feature comparison values can obtain the first feature comparison value 2.
[0094] In this way, eight first feature comparison values, that is, the first feature comparison value 1, the first feature comparison value 2, …, and the first feature comparison value 8, can be obtained.
[0095] In the embodiments of the present application, performing feature comparison between the feature data corresponding to the to-be-classified shard and the feature data of the standard shards contained in the plurality of standard shard groups is beneficial to classifying the to-be-classified shard group.
[0096] In the embodiments of the present application, performing feature comparison between the feature data corresponding to the to-be-classified shard and the feature data of the standard shards contained in the plurality of standard shard groups is beneficial to classifying the to-be-classified shard group.Figure 8 is Figure 7 The step S710 in the example embodiment is shown in a flowchart. As shown in the example embodiment, the process of feature extraction on the plurality of to-be-classified fragments can include steps S810 to S830, which are described in detail as follows: Figure 8
[0097] Step S810: differential processing is performed on each to-be-classified fragment to obtain a plurality of to-be-classified fragment differential image sets.
[0098] Each to-be-classified fragment differential image set can include a plurality of to-be-classified fragment differential images, and the clarity of each to-be-classified fragment differential image can be different.
[0099] Step S820: a to-be-classified fragment differential image is determined from each to-be-classified fragment differential image set as a feature image to obtain a plurality of to-be-classified fragment differential feature images.
[0100] Specifically, a to-be-classified fragment differential image can be determined from each to-be-classified fragment differential image set as a feature image according to the principle of maximum clarity and same clarity. For example, the to-be-classified fragment differential image set corresponding to the to-be-classified fragment 1 includes five to-be-classified fragment differential images with clarity of 5, 6, 7, 8, and 9; the to-be-classified fragment differential image set corresponding to the to-be-classified fragment 2 includes five to-be-classified fragment differential images with clarity of 4, 5, 6, 7, and 8; and the to-be-classified fragment differential image set corresponding to the to-be-classified fragment 3 includes five to-be-classified fragment differential images with clarity of 6, 7, 8, 9, and 10. Then, the to-be-classified fragment differential image with clarity of 8 in each to-be-classified fragment differential image set is determined as the feature image.
[0101] It should be noted that if the clarity of the feature image extracted from the differential image set corresponding to each to-be-classified fragment is inconsistent, the number of computer operations will increase exponentially when subsequent feature comparison is performed.
[0102] Step S830: feature extraction is performed on each to-be-classified fragment differential feature image to obtain feature data corresponding to the to-be-classified fragment.
[0103] The method of extracting features can be performed by a neural network learning method, which is not limited in the example embodiment. The feature data can include size, size, and other information, which is not limited in the example embodiment.
[0104] In the example embodiment, differential processing is performed on each to-be-classified fragment to obtain a plurality of to-be-classified fragment differential image sets, and a plurality of to-be-classified fragment differential feature images are determined from the plurality of to-be-classified fragment differential image sets based on the principle of same clarity and maximum, which is beneficial to reduce the operation amount of subsequent feature comparison operation.
[0105] Figure 9 yes Figure 2 The flowchart of step S240 in the illustrated embodiment is shown in an exemplary embodiment. Figure 9 As shown, in an exemplary embodiment, the process of comparing the features of the image to be classified with the target image to obtain a second feature comparison value may include steps S810 to S830, which are described in detail below:
[0106] Step S910: Perform feature extraction processing on the image to be classified to obtain the feature data corresponding to the image to be classified.
[0107] The standard images contained in the preset overall image set are the feature data corresponding to the standard images. The feature data is obtained after feature extraction processing of the standard images.
[0108] A standard image can correspond to a standard feature data point. The feature data of standard image i can be denoted as Feature. wholei .For example, Figure 3 The feature data of the standard image 3 shown is as follows: whole3 And so on.
[0109] Similarly, the set of feature data of the images to be classified can be denoted as Feature. wholeU .
[0110] Step S920: Compare the feature data corresponding to the image to be classified with the feature data corresponding to the target image to obtain the second feature comparison value.
[0111] As described in step S610, the second feature alignment value can be recorded as Z. whole Z whole =|Feature wholeU -Feature wholeV |. Wherein, V represents the target image.
[0112] In this embodiment, the feature data corresponding to the image to be classified can be compared with the feature data corresponding to the target image to further determine whether the image to be classified is similar to the target image after the image to be classified is combined into an image to be classified, which is beneficial for classifying the image to be classified.
[0113] Figure 10 yes Figure 10 The flowchart of step S910 in the illustrated embodiment is shown in an exemplary embodiment. Figure 11 As shown in an exemplary embodiment, the process of feature extraction for the image to be classified may include steps S1010 to S1030, which are described in detail below:
[0114] Step S1010: performing differential processing on the picture to be classified to obtain a set of to-be-classified differential images.
[0115] Each set of to-be-classified differential images can include multiple to-be-classified differential images, and the resolution of each to-be-classified differential image can be different.
[0116] Step S1020: determining one to-be-classified differential image from the set of to-be-classified differential images as a feature image to obtain a to-be-classified differential feature image.
[0117] It should be noted that the feature data corresponding to the target picture is obtained by performing feature extraction on the target feature image corresponding to the target picture, and the resolution of the target feature image is known. Therefore, one to-be-classified differential image can be determined from the set of to-be-classified differential images as a feature image according to the resolution of the target feature image. The resolution of the to-be-classified differential feature image can be the same as or different from the resolution of the target feature image. In the embodiment of the present application, even if the resolution of the to-be-classified differential feature image is different from the resolution of the target feature image, the difference between the feature data of the two will not be too large, that is, the final recognition result will not be affected.
[0118] Step S1030: performing feature extraction on the to-be-classified differential feature image to obtain feature data corresponding to the picture to be classified.
[0119] In the embodiment of the present application, feature extraction can be performed on the picture to be classified to obtain feature data of the picture to be classified, which is beneficial to further comparing the feature data of the picture to be classified with the feature data of the target picture to more accurately classify the to-be-classified slice group.
[0120] Figure 11 is a flowchart illustrating another picture classification method according to an example embodiment. As shown in Figure 11 , the Figure 12 may be used to describe the complete steps of the picture classification method. The method can include steps S1110 to S1190, which are described in detail as follows.
[0121] Step S1110: inputting multiple standard pictures.
[0122] Step S1120: performing slice processing on each standard picture to obtain multiple standard slice groups.
[0123] Step S1130: performing difference processing on each standard slice group and each standard picture to obtain a plurality of standard slice difference image sets and a plurality of standard picture difference image sets; determining a plurality of standard slice feature maps from the plurality of standard slice difference image sets, determining a plurality of standard picture feature maps from the plurality of standard picture difference image sets, and performing feature extraction respectively to obtain a plurality of standard slice feature sets and a plurality of standard picture feature data.
[0124] Step S1140: saving the plurality of standard slice feature sets and the plurality of standard picture feature data in a feature library, and constructing an association between the standard slice feature library and the standard picture feature library.
[0125] Step S1150: obtaining a to-be-classified slice group.
[0126] Step S1160: performing difference processing on a plurality of to-be-classified slices in the to-be-classified slice group, and performing feature extraction based on the feature image to obtain a plurality of to-be-classified slice feature data.
[0127] Step S1170: performing feature comparison between the plurality of to-be-classified slices and a plurality of standard slices contained in a plurality of standard slice groups to obtain a first feature comparison value of each standard slice group for the plurality of to-be-classified slices.
[0128] Step S1180: if a smallest first feature comparison value in the plurality of first feature comparison values is less than or equal to a preset threshold, selecting a target picture from the preset overall picture set according to the smallest first feature comparison value.
[0129] Wherein, less than or equal to the preset threshold is to reach the preset threshold; greater than the preset threshold is not to reach the preset threshold.
[0130] Step S1190: combining the to-be-classified slice group into a to-be-classified picture, performing feature comparison between the to-be-classified picture and the target picture to obtain a second feature comparison value, and classifying the to-be-classified picture according to the second feature comparison value.
[0131] Wherein, the specific content of steps S1110-S1190 has been described in the foregoing embodiments, which will not be repeated here.
[0132] Through the embodiments of the present application, the recognition rate of picture data can be improved.
[0133] Figure 12 is a structural schematic diagram of a picture classification device according to an exemplary embodiment. As shown in Figure 13 , in an exemplary embodiment, the picture classification device comprises:
[0134] The acquisition unit 1210 is configured to acquire a to-be-classified shard group, wherein the to-be-classified shard group includes a plurality of to-be-classified shards, and the plurality of to-be-classified shards are obtained by splitting a to-be-classified picture;
[0135] The comparison unit 1220 is configured to perform feature comparison on the plurality of to-be-classified shards and standard shards contained in a plurality of standard shard groups, to obtain a first feature comparison value of each standard shard group for the plurality of to-be-classified shards;
[0136] The processing unit 1230 is configured to select a target picture from a preset overall picture set according to the plurality of first feature comparison values, wherein the preset overall picture set includes standard pictures corresponding to the plurality of standard shard groups respectively;
[0137] The comparison unit 1220 is further configured to perform feature comparison on the to-be-classified picture and the target picture, to obtain a second feature comparison value, and classify the to-be-classified picture according to the second feature comparison value.
[0138] The above structure can improve the shard picture data recognition rate, reduce the redundant features in picture rough classification, and improve the implicit value of the feature library.
[0139] In one embodiment, the comparison unit 1220 is further configured to, for each standard shard group, perform feature comparison on the plurality of to-be-classified shards and standard shards with the same identification number in the standard shard group, to obtain a feature comparison value between the to-be-classified shards and the standard shards with the same identification number, and perform summation operation on the feature comparison values between the to-be-classified shards and the standard shards with each identification number, to obtain the first feature comparison value.
[0140] In one embodiment, the processing unit 1230 is further configured to determine a smallest first feature comparison value from the plurality of first feature comparison values, and if the smallest first feature comparison value is smaller than a preset threshold, select a standard picture corresponding to the smallest first feature comparison value from the preset overall picture set, and take the selected standard picture as the target picture.
[0141] In one embodiment, the detection unit 1240 is configured to detect whether the second feature comparison value is smaller than or equal to a preset feature comparison threshold, and if the second feature comparison value is smaller than or equal to the preset feature comparison threshold, determine that the to-be-classified picture belongs to a category corresponding to the target picture, and if the second feature comparison value is greater than the preset feature comparison threshold, determine that the to-be-classified picture does not belong to the category corresponding to the target picture.
[0142] In one embodiment, the standard shards contained in the plurality of standard shard groups are feature data corresponding to the standard shards, and the feature data is obtained by performing feature extraction processing on the standard shards;
[0143] In an embodiment, the processing unit 1230 is further configured to perform feature extraction processing on the plurality of to-be-classified patches to obtain feature data corresponding to the to-be-classified patches.
[0144] The comparison unit 1220 is further configured to perform feature comparison on the feature data corresponding to the to-be-classified patches and the feature data of the standard patches contained in the plurality of standard patch groups to obtain a first feature comparison value of the plurality of to-be-classified patches for each standard patch group.
[0145] In an embodiment, the processing unit 1230 is further configured to perform difference processing on each to-be-classified patch to obtain a plurality of to-be-classified patch difference image sets, determine a to-be-classified patch difference image from each to-be-classified patch difference image set as a feature map to obtain a plurality of to-be-classified patch difference feature maps, and perform feature extraction on each to-be-classified patch difference feature map to obtain the feature data corresponding to the to-be-classified patch.
[0146] In an embodiment, the standard picture contained in the preset overall picture set is feature data corresponding to the standard picture, and the feature data is obtained by performing feature extraction processing on the standard picture.
[0147] In an embodiment, the processing unit 1230 is further configured to perform feature extraction processing on the to-be-classified picture to obtain feature data corresponding to the to-be-classified picture.
[0148] The comparison unit 1220 is further configured to perform feature comparison on the feature data corresponding to the to-be-classified picture and the feature data corresponding to the target picture to obtain a second feature comparison value.
[0149] In an embodiment, the processing unit 1230 is further configured to perform difference processing on the to-be-classified picture to obtain a to-be-classified difference image set, determine a to-be-classified difference image from the to-be-classified difference image set as a feature map to obtain a to-be-classified difference feature map, and perform feature extraction on the to-be-classified difference feature map to obtain the feature data corresponding to the to-be-classified picture.
[0150] It should be noted that the picture classification apparatus provided in the above embodiments and the picture classification method provided in the above embodiments belong to the same concept, and the specific manner in which each module and unit performs operations has been described in detail in the method embodiments, which will not be described here.
[0151] Embodiments of the present application also provide an electronic device, including: one or more processors; a storage device configured to store one or more programs, when the one or more programs are executed by the one or more processors, the electronic device implements the picture classification method provided in each of the above embodiments.
[0152] Figure 13A structural diagram of a computer system of an electronic device suitable for implementing the embodiments of the present application is shown.
[0153] It should be noted that, Figure 13 The computer system 1300 of the electronic device shown is only an example and should not bring any limitation to the functions and usage range of the embodiments of the present application.
[0154] As shown, the computer system 1300 includes a central processing unit (CPU) 1301 which can perform various appropriate actions and processes according to programs stored in a read-only memory (ROM) 1302 or loaded from a storage portion 1308 into a random access memory (RAM) 1303, such as performing the methods in the above embodiments. Various programs and data required for system operation are also stored in the RAM 1303. The CPU 1301, the ROM 1302, and the RAM 1303 are connected to each other through a bus 1304. An input / output (I / O) interface 1305 is also connected to the bus 1304.
[0155] The following components are connected to the I / O interface 1305: an input portion 1306 including a keyboard, a mouse, and the like; an output portion 1307 including a cathode ray tube (CRT), a liquid crystal display (LCD), and the like, and a speaker, and the like; a storage portion 1308 including a hard disk, and the like; and a communication portion 1309 including a network interface card such as a LAN (Local Area Network) card, a modem, and the like. The communication portion 1309 performs communication processing via a network such as the Internet. A drive 1310 is also connected to the I / O interface 1305 as necessary. A removable recording medium 1311 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, and the like is attached to the drive 1310 as necessary, so that a computer program read therefrom is installed in the storage portion 1308 as necessary.
[0156] In particular, according to embodiments of the present application, the processes described above with reference to the flowcharts can be implemented as a computer software program. For example, embodiments of the present application include a computer program product comprising a computer program carried on a computer readable medium, the computer program containing computer programs for executing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network by the communication section 1309, and / or installed from the detachable medium 1311. When the computer program is executed by the central processing unit (CPU) 1301, various functions defined in the system of the present application are executed.
[0157] It should be noted that the computer readable medium shown in the embodiments of the present application can be a computer readable signal medium or a computer readable storage medium or any combination of the two. The computer readable storage medium may, for example, be an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or apparatus, or any combination of the above. More specific examples of the computer readable storage medium can include, but are not limited to, an electrical connection having one or more wires, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a flash memory, an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, the computer readable storage medium can be any tangible medium that contains or stores a program that can be used by or in connection with an instruction execution system, apparatus or device. In the present application, the computer readable signal medium can include a data signal carried in a baseband or as a part of a carrier wave, which carries computer readable computer programs. Such a propagated data signal can take many forms, including but not limited to, an electromagnetic signal, an optical signal or any suitable combination of the above. The computer readable signal medium can also be any computer readable medium that can send, propagate or transfer programs for use by or in connection with an instruction execution system, apparatus or device. The computer programs contained in the computer readable medium can be transmitted by any suitable medium, including but not limited to wireless, wired, or the like, or any suitable combination of the above.
[0158] The flowcharts and block diagrams in the drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present application. In this regard, each block in the flowcharts or block diagrams can represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical functions. It should also be noted that in some alternative implementations, the functions noted in the blocks can occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently or the blocks may be executed in the reverse order, depending on the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustrations, and combinations thereof, can be implemented by special purpose hardware-based systems that perform the specified functions or operations, or combinations of special purpose hardware and computer instructions.
[0159] The units described in the embodiments of the present application can be implemented by software, or by hardware, or by a combination of software and hardware. The units described can be located in a single processor, or can be distributed over a plurality of processors.
[0160] Another aspect of the present application provides a computer readable storage medium, having stored thereon a computer program, which, when executed by a processor, implements the picture classification method as above. The computer readable storage medium can be included in the electronic device described in the above embodiments, or can exist separately and not be assembled into the electronic device.
[0161] Another aspect of the present application provides a computer program product or computer program, which comprises computer instructions. The computer instructions are stored in a computer readable storage medium. A processor of a computer device reads the computer instructions from the computer readable storage medium, and the processor executes the computer instructions, so that the computer device executes the picture classification method provided in the above embodiments.
[0162] The above merely illustrates the preferred exemplary embodiments of the present application, and is not intended to limit the implementation of the present application. Those skilled in the art can easily make corresponding modifications or variations according to the main idea and spirit of the present application, and the protection scope of the present application should be subject to the protection scope as claimed in the claims.
Claims
1. A picture classification method characterized by, The method comprises the following steps: obtaining a to-be-classified shard group; wherein the to-be-classified shard group comprises a plurality of to-be-classified shards, which are obtained by splitting a to-be-classified picture; performing feature comparison between the plurality of to-be-classified shards and standard shards contained in a plurality of standard shard groups, to obtain a first feature comparison value of each standard shard group for the plurality of to-be-classified shards; selecting a target picture from a preset overall picture set according to the plurality of first feature comparison values; wherein the preset overall picture set comprises standard pictures corresponding to the plurality of standard shard groups respectively; performing feature comparison between the to-be-classified picture and the target picture, to obtain a second feature comparison value, and classifying the to-be-classified picture according to the second feature comparison value; the step of performing feature comparison between the plurality of to-be-classified shards and standard shards contained in a plurality of standard shard groups, to obtain a first feature comparison value of each standard shard group for the plurality of to-be-classified shards, comprises the following steps: for each standard shard group, performing feature comparison between the plurality of to-be-classified shards and standard shards with the same identification number in the standard shard group, to obtain a feature comparison value between to-be-classified shards and standard shards with the same identification number, and performing summation operation on the feature comparison values between to-be-classified shards and standard shards with each identification number, to obtain the first feature comparison value.
2. The method of claim 1, wherein, the step of selecting a target picture from a preset overall picture set according to the plurality of first feature comparison values, comprises the following steps: determining a smallest first feature comparison value from the plurality of first feature comparison values; if the smallest first feature comparison value is smaller than a preset threshold value, selecting a standard picture corresponding to the smallest first feature comparison value from the preset overall picture set, and taking the selected standard picture as the target picture.
3. The method of claim 1, wherein, the step of classifying the to-be-classified picture according to the second feature comparison value, comprises the following steps: detecting whether the second feature comparison value is smaller than or equal to a preset feature comparison threshold value; if the second feature comparison value is smaller than or equal to the preset feature comparison threshold value, determining that the to-be-classified picture belongs to a category corresponding to the target picture; if the second feature comparison value is greater than the preset feature comparison threshold value, determining that the to-be-classified picture does not belong to the category corresponding to the target picture.
4. The method according to any one of claims 1 to 3, characterized in that, the standard shards contained in the plurality of standard shard groups are feature data corresponding to the standard shards, which are obtained by performing feature extraction processing on the standard shards; the step of performing feature comparison between the plurality of to-be-classified shards and standard shards contained in a plurality of standard shard groups, to obtain a first feature comparison value of each standard shard group for the plurality of to-be-classified shards, comprises the following steps: performing feature extraction processing on the plurality of to-be-classified shards, to obtain feature data corresponding to the to-be-classified shards; for each standard shard group, performing feature comparison between the feature data of the plurality of to-be-classified shards and the feature data of standard shards with the same identification number in the standard shard group, to obtain a feature comparison value between to-be-classified shards and standard shards with the same identification number, and performing summation operation on the feature comparison values between to-be-classified shards and standard shards with each identification number, to obtain the first feature comparison value.
5. The method of claim 4, wherein, The feature extraction processing on the plurality of to-be-classified patches comprises: performing differential processing on each to-be-classified patch to obtain a plurality of to-be-classified patch differential image sets; determining one to-be-classified patch differential image from each to-be-classified patch differential image set as a feature map to obtain a plurality of to-be-classified patch differential feature maps; performing feature extraction on each to-be-classified patch differential feature map to obtain feature data corresponding to the to-be-classified patch.
6. The method according to any one of claims 1 to 3, characterized in that, The standard picture contained in the preset overall picture set is feature data corresponding to the standard picture, and the feature data is obtained by performing feature extraction processing on the standard picture. The feature comparison between the to-be-classified picture and the target picture to obtain a second feature comparison value comprises: performing feature extraction processing on the to-be-classified picture to obtain feature data corresponding to the to-be-classified picture; performing feature comparison between the feature data corresponding to the to-be-classified picture and the feature data corresponding to the target picture to obtain the second feature comparison value.
7. The method of claim 6, wherein, The feature extraction processing on the to-be-classified picture comprises: performing differential processing on the to-be-classified picture to obtain a to-be-classified differential image set; determining one to-be-classified differential image from the to-be-classified differential image set as a feature map to obtain a to-be-classified differential feature map; performing feature extraction on the to-be-classified differential feature map to obtain feature data corresponding to the to-be-classified picture.
8. An image classification apparatus characterized by comprising: comprise: an acquisition unit, configured to acquire a to-be-classified patch group; wherein the to-be-classified patch group comprises a plurality of to-be-classified patches, and the plurality of to-be-classified patches are obtained by splitting a to-be-classified picture; a comparison unit, configured to perform feature comparison between the plurality of to-be-classified patches and standard patches contained in a plurality of standard patch groups to obtain first feature comparison values of the plurality of to-be-classified patches for each standard patch group; a processing unit, configured to select a target picture from a preset overall picture set according to the plurality of first feature comparison values; wherein the preset overall picture set comprises standard pictures corresponding to the plurality of standard patch groups, respectively; the comparison unit is further configured to perform feature comparison between the to-be-classified picture and the target picture to obtain a second feature comparison value, and to classify the to-be-classified picture according to the second feature comparison value; the feature comparison between the plurality of to-be-classified patches and the standard patches contained in the plurality of standard patch groups to obtain the first feature comparison values of the plurality of to-be-classified patches for each standard patch group comprises: for each standard patch group, performing feature comparison between the plurality of to-be-classified patches and standard patches with the same identification number in the standard patch group to obtain feature comparison values between to-be-classified patches and standard patches with the same identification number, and performing summation operation on the feature comparison values between to-be-classified patches and standard patches with each identification number to obtain the first feature comparison value.
9. An electronic device, comprising: comprise: one or more processors; a memory for storing one or more programs, which, when executed by the electronic device, cause the electronic device to implement the picture classification method according to any one of claims 1 to 7.
10. A computer readable medium having stored thereon a computer program, characterized in that, The computer program, which is executed by a processor, implements the picture classification method as claimed in any one of claims 1 to 7.
Citation Information
Patent Citations
Optimizing multi-class image classification using patch features
CN107209860A
Pedestrian re-identification method, device, computer device and storage medium
CN109271870A