A method and device for determining image type

By performing pixel processing and feature extraction on the images to be classified, and using the same classification model for image type recognition, the problem of high training costs and difficulty in weight setting of multiple classification models is solved, and the accuracy and stability of image type recognition are improved.

CN113761249BActive Publication Date: 2024-10-22BEIJING WODONG TIANJUN INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202010768739.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-08-03
Publication Date
2024-10-22
Estimated Expiration
2040-08-03

AI Technical Summary

Technical Problem

In the existing technology, multiple classification models with different structures need to be trained, which results in a high cost of determining the image type, and it is difficult to unify the setting method of the weight coefficients of different classification models, resulting in the classification model's defense capability and stability against attack noise. Poor, the accuracy of the identified image types is low.

Method used

Multiple first images are obtained by processing pixels in the images to be classified, and the same classification model is used to identify the image types of the multiple first images, specifically including data enhancement processing and filtering processing, and extracting features in the multiple first images. The vector is input into the classification model for classification processing, and the type of the target image is determined based on multiple classification results.

Benefits of technology

It reduces the cost of determining the image type, improves the defense capability and stability of the classification model against attack noise, and improves the accuracy of the determined image type.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113761249B_ABST
    Figure CN113761249B_ABST
Patent Text Reader

Abstract

The present invention discloses a method and device for determining the type of an image, and relates to the field of computer technology. A specific implementation of the method includes: obtaining a target image, and obtaining multiple first images based on processing pixels in the target image; extracting feature vectors in the multiple first images respectively based on a neural network model, inputting the feature vectors into a classification model for classification processing, and obtaining multiple classification results, and the multiple classification results correspond to the multiple first images; and determining the type of the target image according to the multiple classification results. This implementation reduces the cost of determining the type of the image, improves the defense capability and stability of the classification model against attack noise, and improves the accuracy of the determined image type.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a method and device for determining a picture type. Background Art

[0002] Image content review system Figure 1 As shown, the left picture is the original picture (the content of the original picture is a panda, and pictures containing pandas are artificially stipulated as illegal pictures), and the middle picture is a noise picture / attack noise. Under the condition that the information seen by the human eye remains unchanged, the noise picture is added to the original picture using the gradient ascent method to obtain the attack picture on the right. The content of the attack picture is actually a panda, but the content identified by the classification model in the picture content review system is a gibbon, so it is determined that the attack picture is not an illegal picture, and the confidence probability of the classification result is as high as 99.3%. In order to solve the above problems, the prior art uses multiple classification models with different structures to identify the type of pictures, and sets different weight coefficients for multiple models to ensure the accuracy of the determined picture type.

[0003] In the process of implementing the present invention, the inventors found that there are at least the following problems in the prior art:

[0004] In the prior art, multiple classification models with different structures need to be trained, resulting in a high cost for determining the image type. In addition, it is difficult to unify the setting method of the weight coefficients of different classification models, resulting in poor defense and stability of the classification models against attack noise, and low accuracy of the determined image type. Summary of the invention

[0005] In view of this, an embodiment of the present invention provides a method and device for determining the type of an image, by processing pixels in an image to be classified to obtain multiple first images, and using the same classification model to identify the image types of the multiple first images, thereby reducing the cost of determining the image type, improving the defense capability and stability of the classification model against attack noise, and improving the accuracy of the determined image type.

[0006] To achieve the above object, according to a first aspect of an embodiment of the present invention, a method for determining a picture type is provided, comprising:

[0007] Acquire a target image, and obtain a plurality of first images based on processing pixels in the target image;

[0008] Extracting feature vectors from the plurality of first images respectively based on the neural network model, inputting the feature vectors into the classification model for classification processing, and obtaining a plurality of classification results, wherein the plurality of classification results correspond to the plurality of first images;

[0009] The type of the target image is determined based on multiple classification results.

[0010] In one embodiment, the step of obtaining a plurality of first images based on processing pixels in a target image includes:

[0011] Data enhancement processing is performed on the target image so that the positions of pixels in the target image are offset, thereby obtaining a first image, wherein the data enhancement processing includes at least one of the following processing methods: rotation processing, reduction processing, enlargement processing and translation processing.

[0012] In one embodiment, when the data enhancement processing is at least one of rotation processing, reduction processing, and translation processing, the step of obtaining the first image based on performing data enhancement processing on the target image includes:

[0013] Processing the target image according to the offset amplitude and offset direction indicated by the data enhancement processing mode to obtain a second image, wherein the offset amplitude is determined according to the size of the target image;

[0014] Determine a non-overlapping area corresponding to the target image and the second image;

[0015] The pixel value corresponding to each pixel point in the non-overlapping area is adjusted to the pixel mean value of the target image to obtain the adjusted non-overlapping area;

[0016] The adjusted non-overlapping area and the overlapping area of ​​the second image and the target image are combined to obtain the first image.

[0017] In one embodiment, when the data enhancement processing is an enlargement processing, the step of obtaining the first image based on performing the data enhancement processing on the target image includes:

[0018] Enlarging the target image according to the enlargement ratio to obtain a second image;

[0019] An overlapping area between the second picture and the target picture is determined as the first picture.

[0020] In one embodiment, the step of obtaining a plurality of first images based on processing pixels in the target image further includes:

[0021] Based on filtering pixels in the target image, pixel values ​​corresponding to pixel points in the target image are changed, thereby obtaining a first image; wherein the filtering process includes at least one of the following processing methods: box filtering, mean filtering, Gaussian filtering, median filtering and bilateral filtering.

[0022] In one embodiment, the step of determining the type of the target image according to the multiple classification results includes:

[0023] The type of the target image is determined based on multiple classification results and voting rules.

[0024] In one embodiment, the step of determining the type of the target image according to the multiple classification results further includes:

[0025] Multiple classification results are weighted and the type of the target image is determined based on the weighted results and the result quantity threshold.

[0026] To achieve the above object, according to a second aspect of an embodiment of the present invention, a device for determining a type of a picture is provided, including:

[0027] A target image acquisition module, used to acquire a target image, and obtain a plurality of first images based on processing pixels in the target image;

[0028] A classification processing module, used to extract feature vectors from the plurality of first images respectively based on a neural network model, input the feature vectors into a classification model for classification processing, and obtain a plurality of classification results, wherein the plurality of classification results correspond to the plurality of first images;

[0029] The type determination module is used to determine the type of the target image based on multiple classification results.

[0030] To achieve the above object, according to a third aspect of an embodiment of the present invention, an electronic device is provided, including:

[0031] one or more processors;

[0032] a storage device for storing one or more programs,

[0033] When one or more programs are executed by one or more processors, the one or more processors implement any of the above methods for determining the type of an image.

[0034] To achieve the above objective, according to a fourth aspect of an embodiment of the present invention, a computer-readable medium is provided, on which a computer program is stored, and when the program is executed by a processor, any of the above methods for determining the type of a picture is implemented.

[0035] An embodiment of the above invention has the following advantages or beneficial effects: because a target image is obtained, multiple first images are obtained based on processing the pixels in the target image; feature vectors in the multiple first images are extracted respectively based on a neural network model, and the feature vectors are input into a classification model for classification processing to obtain multiple classification results, and the multiple classification results correspond to the multiple first images; the technical means of determining the type of the target image according to the multiple classification results solves the technical problems in the prior art that the cost of determining the image type is high due to the need to train multiple classification models with different structures, and the setting method of the weight coefficients of different classification models is difficult to unify, resulting in poor defense capability and stability of the classification model against attack noise, and low accuracy of the determined image type, thereby achieving the technical effect of obtaining multiple first images by processing the pixels in the image to be classified, identifying the image type of the multiple first images using the same classification model, reducing the cost of determining the image type, improving the defense capability and stability of the classification model against attack noise, and improving the accuracy of the determined image type.

[0036] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with the specific implementation manner. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] The accompanying drawings are used to better understand the present invention and do not constitute an improper limitation of the present invention.

[0038] Figure 1 It is a schematic diagram of the original image, the noise image and the final image in the prior art;

[0039] Figure 2 is a schematic diagram of the main process of the method for determining the type of a picture provided according to the first embodiment of the present invention;

[0040] Figure 3a is a schematic diagram of the main process of a method for determining a picture type provided according to a second embodiment of the present invention;

[0041] Figure 3b yes Figure 3a A schematic diagram of rotating the target image in the method;

[0042] Figure 3c yes Figure 3a A schematic diagram of enlarging and reducing a target image in the method;

[0043] Figure 3d yes Figure 3a A schematic diagram of performing translation processing on a target image in the method;

[0044] Figure 4is a schematic diagram of main modules of a device for determining a picture type provided according to an embodiment of the present invention;

[0045] Figure 5 is an exemplary system architecture diagram to which embodiments of the present invention may be applied;

[0046] Figure 6 It is a schematic diagram of the structure of a computer system of a terminal device or a server suitable for implementing an embodiment of the present invention. DETAILED DESCRIPTION

[0047] The following is a description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, including various details of the embodiments of the present invention to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and conciseness, the description of well-known functions and structures is omitted in the following description.

[0048] It should be pointed out that the embodiments of the present invention and the features in the embodiments may be combined with each other if there is no conflict.

[0049] In order to solve the problems existing in the prior art, the first embodiment of the present invention provides a method for determining the type of a picture, such as Figure 2 As shown, the method mainly includes:

[0050] Step S201, obtaining a target image, and obtaining a plurality of first images based on processing pixels in the target image.

[0051] Specifically, according to an embodiment of the present invention, by processing pixels in a target image (the target image refers to an image of the content of the image to be reviewed and / or the type of the image to be determined), so that the pixel points are shifted in position and / or the pixel values ​​corresponding to the pixel points are changed, a plurality of first images are obtained. In the process of processing the pixels in the target image, the pixel points corresponding to the attack noise are also shifted in position and / or the pixel values ​​corresponding to the pixel points are changed, thereby making the attack noise superimposed on the target image invalid. This is because the attack noise is obtained by training a specific image through the gradient boosting method of a neural network. Therefore, even if a neuron is displaced (the attack noise sending position is shifted) in the neural network input layer vector (the image is pulled into one dimension), the specific attack vector (referring to the feature vector corresponding to the attack noise) (the image is pulled into one dimension) will be invalidated, thereby improving the accuracy of subsequent type recognition of the multiple first images using the classification model.

[0052] Further, according to an embodiment of the present invention, the step of obtaining a plurality of first images based on processing pixels in the target image includes:

[0053] Data enhancement processing is performed on the target image so that the positions of pixels in the target image are offset, thereby obtaining a first image, wherein the data enhancement processing includes at least one of the following processing methods: rotation processing, reduction processing, enlargement processing and translation processing.

[0054] It should be noted that, according to an embodiment of the present invention, the data enhancement processing of the target image is performed so that the pixels in the target image are displaced by a few pixels (such as a displacement of one pixel or two pixels). A small displacement amplitude can cause the attack noise superimposed on the target image to shift, thereby rendering the attack noise ineffective. If the displacement amplitude is too large, the recognition accuracy of the classification model will be reduced.

[0055] Through the above settings, the target image is subjected to data enhancement processing so that the positions of the pixels in the target image are offset, and then the pixels in the target image are processed to obtain multiple first images. At the same time, the multiple first images obtained by performing data enhancement processing on the target image can be subsequently classified using the same classification model to obtain multiple classification results, and then the type of the target image is determined according to the multiple classification results. This avoids the situation in the prior art where multiple classification models are trained separately to generate high costs.

[0056] Preferably, according to an embodiment of the present invention, when the data enhancement processing is at least one of rotation processing, reduction processing and translation processing, the step of obtaining the first image based on performing data enhancement processing on the target image includes:

[0057] Processing the target image according to the offset amplitude and offset direction indicated by the data enhancement processing mode to obtain a second image, wherein the offset amplitude is determined according to the size of the target image;

[0058] Determine a non-overlapping area corresponding to the target image and the second image;

[0059] The pixel value corresponding to each pixel point in the non-overlapping area is adjusted to the pixel mean value of the target image to obtain the adjusted non-overlapping area;

[0060] The adjusted non-overlapping area and the overlapping area of ​​the second image and the target image are combined to obtain the first image.

[0061] Through the above settings, enhancement processing is used to shift the pixels, thereby making the attack noise obtained through targeted training invalid, thereby improving the defense capability and stability of the classification model against attack noise.

[0062] Preferably, according to an embodiment of the present invention, when the data enhancement processing is an enlargement processing, the step of obtaining the first image based on performing data enhancement processing on the target image includes:

[0063] Enlarging the target image according to the enlargement ratio to obtain a second image;

[0064] An overlapping area between the second picture and the target picture is determined as the first picture.

[0065] Through the above settings, the influence of attack noise on the target image is significantly reduced in the first image obtained, and the accuracy of the classification result obtained by the subsequent classification model in determining the image type is improved.

[0066] Alternatively, according to an embodiment of the present invention, the step of obtaining a plurality of first images based on processing pixels in the target image further includes:

[0067] Based on filtering pixels in the target image, pixel values ​​corresponding to pixel points in the target image are changed, thereby obtaining a first image; wherein the filtering process includes at least one of the following processing methods: box filtering, mean filtering, Gaussian filtering, median filtering and bilateral filtering.

[0068] It should be noted that, according to an embodiment of the present invention, the data enhancement processing of the target image is performed so that the pixel points in the target image have a difference of a few pixels (such as a difference of one pixel or a difference of two pixels). A small pixel difference can cause the attack noise superimposed on the target image to shift, thereby making the attack noise ineffective. If the pixel difference is too large, the recognition accuracy of the classification model will be reduced.

[0069] Filtering is also called smoothing, which eliminates noise by changing the pixel value. Among them, mean filtering is a typical linear filtering, which means that a template is given to the target pixel on the image, and the template includes the neighboring pixels around it (8 pixels around the target pixel as the center, forming a filtering template, that is, removing the target pixel itself), and then the average value of all pixels in the template is used to replace the original pixel value; the box filter and the mean filter kernel are basically the same, the difference is whether or not to require homogenization; median filtering is a nonlinear smoothing technology, which sets the gray value of each pixel point to the median value of all pixel points in a certain neighborhood window of the point, that is, the value of the center pixel is replaced by the middle value of all pixel values ​​(not the average value). Median filtering avoids the influence of isolated noise points in the image by selecting the middle value, and has a good filtering effect on impulse noise. In particular, while filtering out noise, it can protect the edge of the signal so that it is not blurred; Gaussian filtering is a linear smoothing filter suitable for eliminating Gaussian noise. Specifically, it is a process of weighted averaging of the entire image. The value of each pixel is obtained by weighted averaging the value of itself and other pixels in the neighborhood; Bilateral filtering is a nonlinear filtering method that constructs a weighted average based on each pixel and its domain. The weighted calculation includes two parts, of which the weighting method of the first part is the same as that of Gaussian smoothing, and the second part also belongs to Gaussian weighting, but it is not based on the spatial distance between the central pixel and other pixels, but on the brightness difference between other pixels and the central pixel.

[0070] According to an embodiment of the present invention, the target image can be processed at least once using data enhancement processing and / or filtering processing. If the target image is processed multiple times using the same processing method, the pixel points are changed differently each time. For example, if the target image is processed multiple times using rotation processing, the rotation angle or direction must be different each time.

[0071] Step S202: extract feature vectors from the multiple first images based on the neural network model, input the feature vectors into the classification model for classification processing, and obtain multiple classification results, where the multiple classification results correspond to the multiple first images.

[0072] Specifically, the above-mentioned multiple first images are respectively input into the neural network model, and the feature vectors corresponding to each first image are output from the output layer of the neural network model. Since the first image is obtained by processing the pixels of the target image, the feature vector corresponding to the first image is different from the feature vector corresponding to the target image, so as to achieve interference with the attack noise. Then, the feature vectors corresponding to each first image are classified and processed by the classification model, and the classification results corresponding to each first image can be obtained. The above-mentioned setting avoids the use of multiple classification models at the same time, and reduces the cost of training multiple classification models with different structures. The classification model can be a classification model of the following structures: Logistic Regression (a classic classification model that can handle binary classification and multivariate classification), SVM (Support Vector Machine, which shows many unique advantages in solving small sample, nonlinear and high-dimensional pattern recognition, and can be extended to other machine learning problems such as function fitting), Xgboost (eXtreme Gradient Boosting) extreme gradient boosting, which is a boosting tree model, so it integrates many tree models together to form a very strong classifier), etc. The classification model is a trained model and can be trained using existing training methods.

[0073] Step S203: determining the type of the target image according to the multiple classification results.

[0074] The type of picture can be set manually. For example, during the picture review process, illegal type pictures, violation type pictures, and pornographic type pictures can be set according to relevant requirements. The above illegal type pictures, violation type pictures, and pornographic type pictures can also be set as prohibited dissemination type pictures.

[0075] Specifically, according to an embodiment of the present invention, the step of determining the type of the target image according to the multiple classification results includes:

[0076] The type of the target image is determined based on multiple classification results and voting rules.

[0077] The above voting rule is a majority voting rule, which means that only when a certain type of evaluation result obtains a number of votes greater than a certain threshold, the result will be output, otherwise the evaluation result will not be output. In the case of not outputting the evaluation result, manual intervention can be used for evaluation. This threshold number is generally an absolute majority, that is, greater than half of the total number, and is also set according to actual conditions. Through the above settings, the introduction of the majority voting rule in the process of determining the target image type improves the accuracy of the determined image type.

[0078] Alternatively, according to an embodiment of the present invention, the step of determining the type of the target image according to the multiple classification results further includes:

[0079] Multiple classification results are weighted and the type of the target image is determined based on the weighted processing result and the result quantity threshold.

[0080] Since the classification results are obtained by classifying the first image using the same classification model, the weighting here only needs to be set to 1 / N, where N is the number of classification results.

[0081] According to the technical solution of the embodiment of the present invention, a target image is obtained, and multiple first images are obtained based on processing pixels in the target image; feature vectors in the multiple first images are respectively extracted based on a neural network model, and the feature vectors are input into a classification model for classification processing to obtain multiple classification results, and the multiple classification results correspond to the multiple first images; the technical means for determining the type of the target image according to the multiple classification results solves the technical problems in the prior art that the cost of determining the image type is high due to the need to train multiple classification models with different structures, and the setting method of the weight coefficients of different classification models is difficult to unify, resulting in poor defense capability and stability of the classification model against attack noise, and low accuracy of the determined image type. Therefore, the technical effect of obtaining multiple first images by processing pixels in the image to be classified, identifying the image type of the multiple first images by using the same classification model, reducing the cost of determining the image type, improving the defense capability and stability of the classification model against attack noise, and improving the accuracy of the determined image type is achieved.

[0082] Figure 3a is a schematic diagram of the main process of the method for determining the type of a picture provided according to the second embodiment of the present invention; Figure 3a As shown, the method for determining the type of a picture provided by the embodiment of the present invention mainly includes:

[0083] Step S301, obtaining a target image.

[0084] The target image refers to the image whose content and / or type is to be determined, and is usually superimposed with attack noise that interferes with the classification model. The target image can be any image, for example, an image containing flowers, or an image containing jeans.

[0085] Step S302: When the data enhancement processing is at least one of rotation processing, reduction processing and translation processing, the target image is processed according to the offset amplitude and offset direction indicated by the data enhancement processing method to obtain a second image.

[0086] It should be noted that, according to an embodiment of the present invention, the data enhancement processing of the target image is performed so that the pixels in the target image are displaced by a few pixels (such as a displacement of one pixel or two pixels). A small displacement amplitude can cause the attack noise superimposed on the target image to shift, thereby rendering the attack noise ineffective. If the displacement amplitude is too large, the recognition accuracy of the classification model will be reduced.

[0087] Through the above settings, the target image is enhanced to make the position of the pixel points in the target image shift, such as Figure 3b , 3c 3D and 3D show schematic diagrams of rotating, reducing and translating the target image, but are not intended to limit the present invention. It should be noted that if the target image is processed multiple times (greater than or equal to twice) in the same processing method, it is necessary to adjust the offset amplitude and offset direction (such as rotation angle, rotation direction, reduction direction, reduction ratio (reduction amplitude), enlargement direction, enlargement ratio (enlargement amplitude)) each time so that each processing changes the pixel point in a different way.

[0088] According to an embodiment of the present invention, the offset amplitude is determined according to the size of the target picture.

[0089] In this embodiment, when it is specifically implemented, if the number of pixels of the target image is greater than the preset number, at least two pixels are determined as the offset; if the number of pixels of the target image is less than or equal to the preset number, one pixel is determined as the offset. Thus, each target image can be processed flexibly. In addition, the offset (offset amplitude) should not be too large so as not to affect the accuracy of image recognition. Furthermore, the preset number can be set according to demand. Generally, the offset amplitude of one pixel or two pixels can achieve the effect of the embodiment of the present invention.

[0090] Step S303: determine the non-overlapping area corresponding to the target image and the second image.

[0091] like Figure 3d As shown, taking the parallel translation of the target image as an example, the box shown by the dotted line is the target image. When the target image is translated to the right, the area shown by the solid line is the second image. At this time, the area formed by the left dotted line and the left solid line is the non-overlapping area corresponding to the target image and the second image.

[0092] Step S304: Adjust the pixel value corresponding to each pixel point in the non-overlapping area to the pixel mean value of the target image to obtain an adjusted non-overlapping area.

[0093] Specifically, the pixel value corresponding to each pixel point in the target image is obtained, the pixel value of each pixel point in the target image is added to obtain the total pixel value; the total pixel value is divided by the number of pixels in the target image to obtain the pixel mean of the target image, and the pixel mean is used as the pixel value corresponding to each pixel point in the non-overlapping area.

[0094] Step S305 , combining the adjusted non-overlapping area and the overlapping area between the second image and the target image to obtain a first image.

[0095] The first image is obtained by processing the target image through at least one of rotation processing, reduction processing and translation processing obtained through the above steps S302 to S305. Because the pixel positions in the first image are slightly changed, the neural network model can still extract the features of the normal image normally, but for the image superimposed with attack noise, the attack noise will be invalid, thereby improving the recognition accuracy of the subsequent classification model.

[0096] Step S306: When the data enhancement process is an enlargement process, the target image is enlarged according to the enlargement ratio to obtain a second image.

[0097] Step S307: determine that the overlapping area between the second picture and the target picture is the first picture.

[0098] The first image obtained by processing the target image through the enlargement process obtained through the above steps S306 to S307 is also made invalid by adjusting the pixel position.

[0099] Step S308: filtering the pixels in the target image so that the pixel values ​​corresponding to the pixels in the target image are changed, thereby obtaining a first image.

[0100] Through the above settings, filtering processing, also known as smoothing processing, is used to change the size of pixel values, thereby changing the activation state of each layer of the neural network model, so that the feature vector of the first image is different from the feature vector of the target image, thereby achieving the technical effect of eliminating noise, making the noisy image invalid, and improving the defense capability and stability of the classification model against attack noise.

[0101] According to an embodiment of the present invention, the target image can be processed at least once using data enhancement processing and / or filtering processing. If the target image is processed multiple times using the same processing method, the pixel points are changed differently each time. For example, if the target image is processed multiple times using rotation processing, the rotation angle or direction must be different each time.

[0102] Step S309, extracting feature vectors from the multiple first images respectively based on the neural network model, inputting the feature vectors into the classification model for classification processing, and obtaining multiple classification results, where the multiple classification results correspond to the multiple first images.

[0103] Specifically, the above-mentioned multiple first images are respectively input into the neural network model, and the feature vectors corresponding to each first image are output from the output layer of the neural network model. Since the first image is obtained by processing the pixels of the target image, the feature vector corresponding to the first image is different from the feature vector corresponding to the target image, so as to achieve interference with the attack noise. Then, the feature vectors corresponding to each first image are classified and processed by the classification model, and the classification results corresponding to each first image can be obtained. The above-mentioned setting avoids the use of multiple classification models at the same time, and reduces the cost of training multiple classification models with different structures. The classification model can be a classification model of the following results: Logistic Regression (a classic classification model that can handle binary classification and multivariate classification), SVM (Support Vector Machine, which shows many unique advantages in solving small sample, nonlinear and high-dimensional pattern recognition, and can be extended to other machine learning problems such as function fitting), Xgboost (eXtreme Gradient Boosting) extreme gradient boosting, which is a boosting tree model, so it integrates many tree models together to form a very strong classifier).

[0104] Step S310, determining the type of the target image according to multiple classification results and voting rules.

[0105] The above voting rules refer to majority voting rules, which means that only when a certain type of evaluation result obtains a number of votes greater than a certain threshold, the result will be output, otherwise the evaluation result will not be output. In the case of not outputting the evaluation result, manual intervention can be used for evaluation. This threshold number is generally an absolute majority, that is, greater than half of the total number, and is also set according to actual conditions. Through the above settings, the introduction of the majority voting rule in the process of determining the target image type improves the accuracy of the determined image type.

[0106] The type of picture can be set manually. For example, during the picture review process, illegal type pictures, violation type pictures, and pornographic type pictures can be set according to relevant requirements. The above illegal type pictures, violation type pictures, and pornographic type pictures can also be set as prohibited dissemination type pictures.

[0107] According to an embodiment of the present invention, the above classification result may be the probability that the target image type is a prohibited image. For each first image, if the probability is greater than the first probability, the first image corresponding to the probability is a prohibited image. The number of types of prohibited images corresponding to all first images is counted. If the number of first images that are prohibited images is greater than or equal to the first number (majority voting principle), the type of the target image is determined to be a prohibited image. If the number of first images that are prohibited images is less than or equal to the second number, the type of the target image is determined to be not a prohibited image. The first number is greater than the second number. If the number of first images that are prohibited images is greater than the second number and less than the first number, the type of the target image is determined to be an unrecognizable type.

[0108] In specific implementation, the first number and the second number can be set manually. The smaller the absolute value of the difference between the first number and the second number, the greater the amount of manual intervention, and the lower the accuracy of the type of the determined target image. The larger the absolute value of the difference between the first number and the second number, the smaller the amount of manual intervention, and the higher the accuracy of the type of the determined target image. For example, the first number is 15 and the second number is 5. In addition, the first number is less than the number of first images, and the second number is greater than zero. The first probability can be set, for example, to 0.6. If the accuracy of the classification model is higher (that is, the better the performance), the lower the first probability, the smaller the absolute value (thereby reducing the manual workload); if the accuracy of the classification model is lower, the higher the first probability, and the larger the absolute value. The first information and the second information can be set, and the first information is different from the second information. The first information can be 1 and the second information can be 0. Specifically, for target images whose types cannot be identified by the classification model, the type corresponding to the target image can be manually determined; if the target image is manually determined to be a prohibited image, 1 is manually input, and when 1 is received, the embodiment of the present invention determines that the type of the target image is a prohibited image; if the target image is manually determined not to be a prohibited image, 0 is manually input, and when 0 is received, the embodiment of the present invention determines that the type of the target image is not a prohibited image.

[0109] In this embodiment, the range formed by the first number and the second number and the relationship between the number of first pictures that are prohibited from dissemination are used to determine whether the type of the target picture is a prohibited from dissemination picture, and a reliable target picture type is directly output to improve the accuracy of the determined target picture type.

[0110] Step S311 , weighting the multiple classification results, and determining the type of the target image according to the weighted classification results and the result quantity threshold.

[0111] Since the classification results are obtained by classifying the first image using the same classification model, the weighting here only needs to be set to 1 / N, where N is the number of classification results.

[0112] According to the technical solution of the embodiment of the present invention, a target image is obtained, and multiple first images are obtained based on processing pixels in the target image; feature vectors in the multiple first images are respectively extracted based on a neural network model, and the feature vectors are input into a classification model for classification processing to obtain multiple classification results, and the multiple classification results correspond to the multiple first images; the technical means for determining the type of the target image according to the multiple classification results solves the technical problems in the prior art that the cost of determining the image type is high due to the need to train multiple classification models with different structures, and the setting method of the weight coefficients of different classification models is difficult to unify, resulting in poor defense capability and stability of the classification model against attack noise, and low accuracy of the determined image type. Therefore, the technical effect of obtaining multiple first images by processing pixels in the image to be classified, identifying the image type of the multiple first images by using the same classification model, reducing the cost of determining the image type, improving the defense capability and stability of the classification model against attack noise, and improving the accuracy of the determined image type is achieved.

[0113] Figure 4 is a schematic diagram of main modules of an apparatus for determining a picture type according to an embodiment of the present invention; Figure 4 As shown, the apparatus 400 for determining the type of a picture provided by the embodiment of the present invention mainly includes:

[0114] The target image acquisition module 401 is used to acquire a target image and obtain a plurality of first images based on processing pixels in the target image.

[0115] Specifically, according to an embodiment of the present invention, multiple first images are obtained by processing pixels in a target image (the target image refers to an image whose content is to be reviewed and / or the type of the image to be determined) so that the pixel points are shifted in position and / or the pixel values ​​corresponding to the pixel points are changed. In the process of processing the pixels in the target image, the pixel points corresponding to the attack noise are also shifted in position and / or the pixel values ​​corresponding to the pixel points are changed, thereby making the attack noise superimposed on the target image ineffective, thereby improving the accuracy of subsequent type recognition of the multiple first images using the classification model.

[0116] Further, according to an embodiment of the present invention, the target image acquisition module 401 is also used for:

[0117] Data enhancement processing is performed on the target image so that the positions of pixels in the target image are offset, thereby obtaining a first image, wherein the data enhancement processing includes at least one of the following processing methods: rotation processing, reduction processing, enlargement processing and translation processing.

[0118] Through the above settings, the target image is subjected to data enhancement processing so that the positions of the pixels in the target image are offset, and then the pixels in the target image are processed to obtain multiple first images. At the same time, the multiple first images obtained by performing data enhancement processing on the target image can be subsequently classified using the same classification model to obtain multiple classification results, and then the type of the target image is determined according to the multiple classification results. This avoids the situation in the prior art where multiple classification models are trained separately to generate high costs.

[0119] Preferably, according to an embodiment of the present invention, when the data enhancement processing is at least one of rotation processing, reduction processing and translation processing, the target image acquisition module 401 is further used to:

[0120] Processing the target image according to the offset amplitude and offset direction indicated by the data enhancement processing mode to obtain a second image, wherein the offset amplitude is determined according to the size of the target image;

[0121] Determine a non-overlapping area corresponding to the target image and the second image;

[0122] The pixel value corresponding to each pixel point in the non-overlapping area is adjusted to the pixel mean value of the target image to obtain the adjusted non-overlapping area;

[0123] The adjusted non-overlapping area and the overlapping area of ​​the second image and the target image are combined to obtain the first image.

[0124] Through the above settings, enhancement processing is used to shift the pixels, thereby making the attack noise obtained through targeted training invalid, thereby improving the defense capability and stability of the classification model against attack noise.

[0125] Preferably, according to an embodiment of the present invention, when the data enhancement processing is an enlargement processing, the target image acquisition module 401 is further used to:

[0126] Enlarging the target image according to the enlargement ratio to obtain a second image;

[0127] An overlapping area between the second picture and the target picture is determined as the first picture.

[0128] Through the above settings, the influence of attack noise on the target image is significantly reduced in the first image obtained, and the accuracy of the classification result obtained by the subsequent classification model in determining the image type is improved.

[0129] Alternatively, according to an embodiment of the present invention, the target image acquisition module 401 is further used for:

[0130] Based on filtering pixels in the target image, pixel values ​​corresponding to pixel points in the target image are changed, thereby obtaining a first image; wherein the filtering process includes at least one of the following processing methods: box filtering, mean filtering, Gaussian filtering, median filtering and bilateral filtering.

[0131] Filtering is also called smoothing, which eliminates noise by changing the pixel value.

[0132] The classification processing module 402 is used to extract feature vectors from the multiple first images based on the neural network model, input the feature vectors into the classification model for classification processing, and obtain multiple classification results, which correspond to the multiple first images.

[0133] Specifically, the above-mentioned multiple first images are respectively input into the neural network model, and the feature vectors corresponding to each first image are output from the output layer of the neural network model. Since the first image is obtained by processing the pixels of the target image, the feature vector corresponding to the first image is different from the feature vector corresponding to the target image, so as to achieve interference with the attack noise, and then the classification model is used to classify the feature vectors corresponding to each first image, and the classification results corresponding to each first image can be obtained. The above setting avoids the use of multiple classification models at the same time and reduces the cost of training multiple classification models with different structures.

[0134] The type determination module 403 is used to determine the type of the target image according to the multiple classification results.

[0135] Specifically, according to an embodiment of the present invention, the type determination module 403 is further used to:

[0136] The type of the target image is determined based on multiple classification results and voting rules.

[0137] The majority voting rule means that only when a certain type of evaluation result obtains a number of votes greater than a certain threshold, the result will be output, otherwise the evaluation result will not be output. In the case of not outputting the evaluation result, manual intervention can be used for evaluation. This threshold number is generally an absolute majority, that is, greater than half of the total number, and is also set according to actual conditions. Through the above settings, the majority voting rule is introduced in the process of determining the target image type to improve the accuracy of the determined image type.

[0138] Alternatively, according to an embodiment of the present invention, the type determination module 403 is further configured to:

[0139] Multiple classification results are weighted and the type of the target image is determined based on the weighted processing result and the result quantity threshold.

[0140] Since the classification results are obtained by classifying the first image using the same classification model, the weighting here only needs to be set to 1 / N, where N is the number of classification results.

[0141] According to the technical solution of the embodiment of the present invention, a target image is obtained, and multiple first images are obtained based on processing pixels in the target image; feature vectors in the multiple first images are respectively extracted based on a neural network model, and the feature vectors are input into a classification model for classification processing to obtain multiple classification results, and the multiple classification results correspond to the multiple first images; the technical means for determining the type of the target image according to the multiple classification results solves the technical problems in the prior art that the cost of determining the image type is high due to the need to train multiple classification models with different structures, and the setting method of the weight coefficients of different classification models is difficult to unify, resulting in poor defense capability and stability of the classification model against attack noise, and low accuracy of the determined image type. Therefore, the technical effect of obtaining multiple first images by processing pixels in the image to be classified, identifying the image type of the multiple first images by using the same classification model, reducing the cost of determining the image type, improving the defense capability and stability of the classification model against attack noise, and improving the accuracy of the determined image type is achieved.

[0142] Figure 5 An exemplary system architecture 500 is shown to which the method for recognizing a picture or the apparatus for recognizing a picture according to the embodiments of the present invention may be applied.

[0143] like Figure 5 As shown, system architecture 500 may include terminal devices 501, 502, 503, a network 504 and a server 505. Network 504 is used to provide a medium for communication links between terminal devices 501, 502, 503 and server 505. Network 504 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.

[0144] Users can use terminal devices 501, 502, 503 to interact with server 505 through network 504 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 501, 502, 503, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (only as examples).

[0145] The terminal devices 501 , 502 , and 503 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, desktop computers, and the like.

[0146] The server 505 may be a server that provides various services, such as a backend management server (only an example) that provides support for shopping websites browsed by users using the terminal devices 501, 502, and 503. The backend management server may analyze and process the received target image and other data, and feed back the classification result (such as the first image, the classification result, and the type of the target image - only an example) to the terminal device.

[0147] It should be noted that the method for identifying a picture provided in the embodiment of the present invention is executed by the server 505 or the terminal, and accordingly, the device for identifying a picture is set in the server 505 or the terminal.

[0148] It should be understood that Figure 5 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.

[0149] Reference below Figure 6 , which shows a schematic diagram of the structure of a computer system 600 of a terminal device suitable for implementing an embodiment of the present invention. Figure 6 The terminal device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.

[0150] like Figure 6 As shown, the computer system 600 includes a central processing unit (CPU) 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage part 608 into a random access memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the system 600 are also stored. The CPU 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.

[0151] The following components are connected to the I / O interface 605: an input section 606 including a keyboard, a mouse, etc.; an output section 607 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 608 including a hard disk, etc.; and a communication section 609 including a network interface card such as a LAN card, a modem, etc. The communication section 609 performs communication processing via a network such as the Internet. A drive 610 is also connected to the I / O interface 605 as needed. A removable medium 611, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 610 as needed, so that a computer program read therefrom is installed into the storage section 608 as needed.

[0152] In particular, according to the embodiments disclosed in the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present invention include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 609, and / or installed from the removable medium 611. When the computer program is executed by the central processing unit (CPU) 601, the above-mentioned functions defined in the system of the present invention are executed.

[0153] It should be noted that the computer-readable medium shown in the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.

[0154] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a unit, a program segment, or a part of a code, and the above-mentioned unit, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0155] The modules involved in the embodiments of the present invention may be implemented in software or hardware. The modules described may also be provided in a processor, for example, may be described as: a processor including a target image acquisition module, a classification processing module, and a type determination module. The names of these modules do not, in some cases, constitute limitations on the modules themselves, for example, the target image acquisition module may also be described as "a module for acquiring a target image, and obtaining a plurality of first images based on processing pixels in the target image".

[0156] As another aspect, the present invention also provides a computer-readable medium, which may be included in the device described in the above embodiment; or it may exist independently without being assembled into the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by a device, the device includes: obtaining a target image, and obtaining multiple first images based on processing pixels in the target image; extracting feature vectors from the multiple first images respectively based on a neural network model, inputting the feature vectors into a classification model for classification processing, and obtaining multiple classification results, and the multiple classification results correspond to the multiple first images; determining the type of the target image according to the multiple classification results.

[0157] According to the technical solution of the embodiment of the present invention, a target image is obtained, and multiple first images are obtained based on processing pixels in the target image; feature vectors in the multiple first images are respectively extracted based on a neural network model, and the feature vectors are input into a classification model for classification processing to obtain multiple classification results, and the multiple classification results correspond to the multiple first images; the technical means for determining the type of the target image according to the multiple classification results solves the technical problems in the prior art that the cost of determining the image type is high due to the need to train multiple classification models with different structures, and the setting method of the weight coefficients of different classification models is difficult to unify, resulting in poor defense capability and stability of the classification model against attack noise, and low accuracy of the determined image type. Therefore, the technical effect of obtaining multiple first images by processing pixels in the image to be classified, identifying the image type of the multiple first images by using the same classification model, reducing the cost of determining the image type, improving the defense capability and stability of the classification model against attack noise, and improving the accuracy of the determined image type is achieved.

[0158] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A method for determining the type of a picture, characterized in that: include: Acquire a target image, and obtain a plurality of first images based on processing pixels in the target image; Specifically including: performing data enhancement processing on the target image so that the position of the pixel points in the target image is shifted; and / or, based on filtering processing on the pixels in the target image, so that the pixel values ​​corresponding to the pixel points in the target image are changed, thereby obtaining the first image; wherein the data enhancement processing includes at least one of the following processing methods: rotation processing, reduction processing, enlargement processing and translation processing; the filtering processing includes at least one of the following processing methods: box filtering processing, mean filtering processing, Gaussian filtering processing, median filtering processing and bilateral filtering processing; Extracting feature vectors from the plurality of first images respectively based on a neural network model, inputting the feature vectors into a classification model for classification processing, and obtaining a plurality of classification results, wherein the plurality of classification results correspond to the plurality of first images; The type of the target image is determined according to the multiple classification results.

2. The method for determining the type of a picture according to claim 1, characterized in that: When the data enhancement processing is at least one of rotation processing, reduction processing and translation processing, the step of obtaining the first image based on performing data enhancement processing on the target image includes: Processing the target image according to the offset amplitude and offset direction indicated by the data enhancement processing mode to obtain a second image, wherein the offset amplitude is determined according to the size of the target image; Determine a non-overlapping area corresponding to the target image and the second image; Adjusting the pixel value corresponding to each pixel point in the non-overlapping area to the pixel mean value of the target image to obtain an adjusted non-overlapping area; The adjusted non-overlapping area and the overlapping area between the second image and the target image are combined to obtain the first image.

3. The method for determining the type of picture according to claim 1, characterized in that: When the data enhancement processing is an enlargement processing, the step of obtaining the first image based on performing the data enhancement processing on the target image includes: Enlarging the target image according to the enlargement ratio to obtain a second image; An overlapping area between the second picture and the target picture is determined as the first picture.

4. The method for determining the type of picture according to claim 1, characterized in that: The step of determining the type of the target image according to the multiple classification results comprises: The type of the target image is determined according to the multiple classification results and the voting rule.

5. The method for determining the type of picture according to claim 1, characterized in that: The step of determining the type of the target image according to the multiple classification results further includes: The multiple classification results are weighted, and the type of the target image is determined according to the weighted result and a result quantity threshold.

6. A device for determining the type of a picture, characterized in that: include: A target image acquisition module, used for acquiring a target image, and obtaining a plurality of first images based on processing pixels in the target image; Specifically used for: performing data enhancement processing on the target image so that the position of the pixel points in the target image is offset; and / or, based on filtering processing on the pixels in the target image, so that the pixel values ​​corresponding to the pixel points in the target image are changed, thereby obtaining the first image; wherein the data enhancement processing includes at least one of the following processing methods: rotation processing, reduction processing, enlargement processing and translation processing; the filtering processing includes at least one of the following processing methods: box filtering processing, mean filtering processing, Gaussian filtering processing, median filtering processing and bilateral filtering processing; A classification processing module, used for respectively extracting feature vectors from the plurality of first images based on a neural network model, inputting the feature vectors into a classification model for classification processing, and obtaining a plurality of classification results, wherein the plurality of classification results correspond to the plurality of first images; A type determination module is used to determine the type of the target image according to the multiple classification results.

7. An electronic device, characterized in that: include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 5.

8. A computer readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 5 is implemented.