Image classification method and device

By training the target determination model, the problem that existing image judgment models cannot identify pornographic images with added sensitive noise is solved, the noise resistance of the model is improved, and the effectiveness of network supervision is enhanced.

CN112686289BActive Publication Date: 2024-11-19MICRO DREAM TECHTRONIC NETWORK TECH CHINACO
View PDF 18 Cites 0 Cited by

Patent Information

Application Number
CN202011551991.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-12-24
Publication Date
2024-11-19
Estimated Expiration
2040-12-24

AI Technical Summary

Technical Problem

Existing image recognition models cannot correctly identify images with added sensitive noise to the original pornographic images, resulting in blind spots and an inability to effectively monitor pornographic images.

Method used

By acquiring a pre-trained target determination model, it is determined whether the similarity between the first image and the second image is greater than a set similarity threshold. If it is greater, they are determined to be in the same category. The target determination model is used to classify the target images, simulating the process of criminals adding sensitive noise to pornographic images. The image determination model is then trained to improve its ability to resist sensitive noise.

Benefits of technology

This improved the target identification model's resistance to sensitive noise, reduced the risk of failing to identify pornographic images, and enhanced the governance effectiveness of network supervision.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112686289B_ABST
    Figure CN112686289B_ABST
Patent Text Reader

Abstract

The present application discloses a method and device for image classification, which relates to the field of data processing and is used to solve the blind spot problem of existing image judgment models. The method comprises: obtaining a target image to be classified; obtaining a pre-trained target judgment model for determining the image category; wherein, if the similarity between the first image and the second image is greater than a set similarity threshold, the target judgment model determines the first image and the second image as the same category; and using the target judgment model, classifying the target image. The present application is used for image classification.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing, and in particular to a method and device for image classification. Background Art

[0002] With the advent of the information age, various types of image information have exploded. Some illegal elements add sensitive noise to the original pornographic images, making it impossible for conventional network supervision models to correctly identify the pornographic images after adding sensitive noise. However, the pornographic images after adding sensitive noise are exactly the same as the original pornographic images in terms of visual experience. As a result, these pornographic images escape conventional network supervision and are rampant on the Internet.

[0003] In related technologies, conventional network supervision models usually use image judgment models to classify a large number of network images, thereby determining the categories of illegal images and achieving the purpose of supervision. However, conventional image judgment models are more sensitive to certain sensitive noises. After adding sensitive noise to pornographic images, the image judgment model classifies pornographic images as normal images, thus failing to correctly classify pornographic images. This is the blind spot problem of conventional image judgment models.

[0004] It can be seen that there is an urgent need for an image classification method to solve the blind spot problem of the existing image judgment model. Summary of the invention

[0005] The embodiments of the present application provide a method and device for image classification, so as to solve the blind spot problem of the existing image judgment model.

[0006] The present application embodiment adopts the following technical solutions:

[0007] In a first aspect, a method for classifying an image is provided, comprising:

[0008] Get the target image to be classified;

[0009] Obtaining a pre-trained target determination model for determining the category of an image; wherein if the similarity between the first image and the second image is greater than a set similarity threshold, the target determination model determines that the first image and the second image are of the same category;

[0010] The target image is classified using the target determination model.

[0011] In a second aspect, a picture classification device is provided, comprising:

[0012] An acquisition module is used to obtain the target image to be classified;

[0013] A determination module, used to obtain a pre-trained target determination model for determining the category of an image; wherein if the similarity between the first image and the second image is greater than a set similarity threshold, the target determination model determines that the first image and the second image are of the same category;

[0014] A classification module is used to classify the target image using the target determination model.

[0015] According to a third aspect, an electronic device is provided, wherein the electronic device comprises a processor and a memory, wherein the memory stores a computer program, and when the computer program is executed by the processor, the following process is implemented:

[0016] Get the target image to be classified;

[0017] Obtaining a pre-trained target determination model for determining the category of an image; wherein if the similarity between the first image and the second image is greater than a set similarity threshold, the target determination model determines that the first image and the second image are of the same category;

[0018] The target image is classified using the target determination model.

[0019] At least one of the above technical solutions adopted in the embodiments of the present application can achieve the following beneficial effects:

[0020] In an embodiment of the present application, a target image to be classified is obtained; a pre-trained target determination model for determining the image category is obtained; wherein, if the similarity between the first image and the second image is greater than a set similarity threshold, the target determination model determines the first image and the second image to be of the same category; and the target image is classified using the target determination model. In this way, the target determination model can improve its ability to resist sensitive noise, reduce the risk of failure in distinguishing some types of images, and thus solve the blind spot problem of the existing image determination model. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0022] Figure 1 is a flow chart of a method for image classification provided by an embodiment of the present application;

[0023] Figure 2 is a flow chart of a method for image classification provided by an embodiment of the present application;

[0024] Figure 3 is a flow chart of a method for image classification provided by an embodiment of the present application;

[0025] Figure 4 is a flow chart of a method for image classification provided by an embodiment of the present application;

[0026] Figure 5 is a flow chart of a method for image classification provided by an embodiment of the present application;

[0027] Figure 6 is a schematic diagram of a judgment process of an exemplary image judgment model provided in an embodiment of the present application;

[0028] Figure 7 is a schematic diagram of a generation process of a second designated image provided by an example of an embodiment of the present application;

[0029] Figure 8 It is a structural block diagram of a picture classification device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0030] The embodiments of the present application provide a method and device for image classification.

[0031] In order to enable those skilled in the art to better understand the technical solutions in this application, the technical solutions in the embodiments of this application will be clearly and completely described below in conjunction with the drawings in the embodiments of this application. Obviously, the described embodiments are only part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of this application.

[0032] Figure 1 is a flow chart of a method for image classification provided by an embodiment of the present application. Figure 1 As shown, a picture classification method provided by an embodiment of the present application may include: step 11, step 12, and step 13. Step 11, step 12, and step 13 are described in sequence below.

[0033] Step 11, obtain the target image to be classified.

[0034] In the embodiment of the present application, the target image is an image that needs to be classified, and may be a pre-selected specific image or a randomly selected image. The target image may be selected as needed.

[0035] Step 12, obtaining a pre-trained target determination model for determining the category of an image; wherein, if the similarity between the first image X1 and the second image X2 is greater than a set similarity threshold, the target determination model H determines that the first image and the second image are of the same category;

[0036] The second image X2 is a picture obtained by adding noise to the first image X1.

[0037] Among them, the target determination model can be specifically used to determine the type of pictures, and the types of pictures may include legal, illegal, regular pictures, pornographic pictures, etc. The classification standards of picture types do not constitute a limitation on this application.

[0038] The similarity refers to the degree of similarity between pictures, and the threshold may refer to a similarity threshold. The similarity threshold may be determined according to a predetermined similarity index.

[0039] In the embodiment of the present application, before step 12, see Figure 2 , a picture classification method provided in the embodiment of the present application may further include: step 21 and step 22. Step 21 and step 22 are described in sequence below.

[0040] Step 21: Obtain target training set;

[0041] In the embodiments of this application, see Figure 3 , step 21 may also include: obtaining multiple groups of specified picture pairs; using the obtained multiple groups of specified picture pairs as the target training set; wherein, the target group of specified picture pairs in the multiple groups of specified picture pairs can be obtained through steps 31, step 32, step 33, step 34, and step 35, and the target group of specified picture pairs is any group of specified picture pairs in the multiple groups of specified picture pairs.

[0042] Steps 31, 32, 33, 34 and 35 are explained below.

[0043] Step 31: Obtain multiple groups of designated picture pairs; wherein each group of designated picture pairs includes a first designated picture and a second designated picture whose similarity is greater than a set similarity threshold, and the second designated picture is a picture obtained by adding noise to the first designated picture.

[0044] The first designated image X1 and the second designated image X2 are images for adding to the target training set. The target determination model can be generated using the images in the target training set. The noise can be noise to which common image classification models are more sensitive, random noise, etc., and the actual type of the noise does not constitute a limitation on the present application.

[0045] Among them, the pixels of the first designated image X1 can be represented as a pixel value matrix of 224×224×3 matrix dimensions, for example. It can be understood that the first designated image can have three color value channels of red (R), green (G), and blue (B), and the pixel values ​​in each channel can be represented by a two-dimensional array, and the values ​​of the two-dimensional array represent pixel values ​​between 0 and 255. For example, if the number of color value channels is set to 3, for a picture with a pixel value of 224×224, its pixels can be represented by a picture pixel value matrix of 224×224×3. In an embodiment of the present application, the specific values ​​of the pixel value matrix of the first designated image X1 can be 224×224×3, 255×225×3, and so on. The specific values ​​of the pixel value matrix of the first designated image X1 do not constitute a limitation of the present application.

[0046] It is understandable that the second designated image X2 is obtained by adding the noise to the first designated image X1. If the first designated image X1 is a pornographic image, then after the sensitive noise is added to the pornographic image, the conventional image judgment model will classify the pornographic image as a normal image, thereby causing the conventional image classification model to be unable to correctly classify the pornographic image. It is understandable that the above step 31 successfully simulates the process of criminals adding random noise to pornographic images to evade network supervision.

[0047] In the embodiments of this application, see Figure 4 In step 31, a second designated picture is obtained, and steps 41 and 42 may also be included. These steps are explained below.

[0048] Step 41: Perform convolution processing, pooling processing, and fully connected layer processing on the first designated image X1 to generate image coding.

[0049] The convolution process (Convolution, Conv) can reduce the dimension and extract features of the first specified image X1. Figure 7 , if the matrix dimension of the pixels of the first designated image X1 is 224×224×3, the first intermediate image X1 obtained after the convolution processing of the first designated image X1 11 , the matrix dimension can be reduced, for example, to 112×112×64. Therefore, after performing convolution processing on the first designated image X1, the first designated image X1 is subjected to dimensionality reduction and feature extraction to obtain the first intermediate image X1. 11 .

[0050] For details, see Figure 7, is to perform convolution processing on the first specified image X1 to complete the dimension reduction and feature extraction of the first specified image X1 to obtain the first intermediate image X 11 After that, the first intermediate image X 11 The dimension of is still very high, which is not only time-consuming to calculate, but also easy to cause overfitting. Therefore, downsampling technology is introduced, also known as pooling. The specific implementation of pooling is to obtain the first intermediate image X after the convolution operation. 11 Divide into blocks, the first intermediate image X 11 Divided into disjoint blocks, calculate the maximum or minimum value within these blocks to obtain the second intermediate image X after pooling 12 For details, please refer to Figure 7 , the first intermediate image X after the first designated image X1 is convolved 11 If the matrix dimension is 112×112×64, the second intermediate image X is obtained after pooling. 12 The matrix dimension of can be reduced, for example, to 56×56×64.

[0051] Among them, the fully connected layer processing (Fully connected, FC), for details, please refer to Figure 7 , is the process of obtaining the image code X after performing convolution and pooling on the first specified image X1. If convolution and pooling are used to map the original data of the first specified image X1 to the hidden layer feature space, the fully connected layer operation plays the role of mapping the learned "distributed feature representation" to the sample tag space.

[0052] It can be understood that after performing convolution processing, pooling processing, and full connection layer processing on the first designated image X1, the first designated image X1 can be compressed to the hidden layer to obtain the image code X.

[0053] Step 42: Perform full connection layer processing, upsampling processing, and deconvolution processing on the picture encoding to obtain the second designated picture X2.

[0054] The upsampling process (uppooling) can be found in Figure 7 , is the third intermediate picture X obtained after the picture encoding X is processed by the fully connected layer 21 , after upsampling, we get the fourth intermediate image X 22 . Fourth middle picture X 22 The matrix dimensions in the third intermediate image X 21 It can be further increased on this basis, for example, from 56×56×64 to 112×112×64.

[0055] Among them, the deconvolution process (deconv) can be found in Figure 7 , is in the third middle picture X 21 After upsampling, the fourth intermediate image X is obtained. 22 After that, the fourth middle picture X 22 After deconvolution processing, the second designated image X2 is obtained. The matrix dimension of the second designated image X2 can be further increased based on the fourth intermediate image. For example, the matrix dimension of the second designated image X2 can be 224×224×3.

[0056] The matrix dimension of the first designated picture may be the same as the matrix dimension of the second designated picture.

[0057] It can be understood that the first designated image X1 is used as an input image and the self-encoding process is implemented for the first designated image X1 through the above steps 41 and 42, which is equivalent to the first designated image X1 realizing self-replication. However, after the self-encoding steps 41 and 42, sensitive noise is introduced on the basis of the first designated image X1 to generate the second designated image X2. In this way, the similarity between the first designated image X1 and the second designated image X2 is preliminarily guaranteed, and the second designated image X2 introduces random noise on the basis of the first designated image X1.

[0058] Step 32: determining a classification label Y1 of the first designated image X1 according to the classification result of the image judgment model on the first designated image, where the classification label Y1 of the first designated image indicates the category of the first designated image;

[0059] It is understandable that, see Figure 6 , the image judgment model D is used to judge the first designated image X1 to obtain a first target category, and obtain a classification label Y1 of the first designated image X1, the classification label Y1 of the first designated image X1 indicating the first target category. It can be understood that if the first designated image X1 is a pornographic image, the image judgment model D judges the first designated image X1, and the classification label Y1 of the first designated image X1 can be determined as an illegal image.

[0060] Step 33: Determine a classification label of the second designated image according to the classification result of the image judgment model on the second designated image, where the classification label of the second designated image indicates the category of the second designated image.

[0061] It is understandable that, see Figure 7, the image judgment model D is used to judge the second designated image X2 to obtain the second target category, and the classification label Y2 of the second designated image is obtained, and the classification label Y2 of the second designated image X2 indicates the second target category. It can be understood that if the first designated image X1 is a pornographic image, the second designated image X2 is obtained by adding sensitive noise to the first designated image X1. Therefore, when the conventional image judgment model D judges the second designated image X2, the classification label Y2 of the second designated image X2 indicating the second target category will be determined as a legal image.

[0062] Understandably, see Figure 7 , the second target category is different from the first target category and can be characterized by a first constraint condition, the first constraint condition can be recorded as Loss1, and the mathematical expression of Loss1 can be:

[0063]

[0064] Among them, y i represents the label of the i-th sample, the positive class is 1 and the negative class is 0; p i represents the probability that the i-th sample is predicted to be a positive class; N represents the actual number of samples.

[0065] Step 34: when the classification label of the second designated image is the same as the classification label of the first designated image, the current group of designated image pairs is discarded; when the classification label of the second designated image is different from the classification label of the first designated image, the classification label of the second designated image is modified to the classification label of the first designated image;

[0066] It can be understood that the classification label Y2 of the second designated image X2 is modified to a designated label Y1, and the designated label Y1 indicates the first target category.

[0067] Step 35: The first designated picture X1, the classification label Y1 of the first designated picture X1, the second designated picture X2, and the modified classification label Y1 of the second designated picture are used as the target group designated picture pair.

[0068] Step 22: Based on the target training set, the deep learning-based image judgment model is trained until the image judgment model determines that two images with a similarity greater than a set similarity threshold are of the same category, and the training is completed to obtain the target judgment model.

[0069] Among them, the target training set includes multiple groups of target designated picture pairs, each group of target designated picture pairs includes a first designated picture and a classification label of the first designated picture, a second designated picture and a classification label of the second designated picture, the similarity between the first designated picture and the second designated picture is greater than a set similarity threshold, and the classification label of the first designated picture and the classification label of the second designated picture indicate the same category. After the training of the picture judgment model is completed, the target judgment model is obtained.

[0070] Among them, the picture judgment model is a picture judgment model based on deep learning.

[0071] Among them, the image judgment model D can be an image classification network based on a residual network (for example, Resnet-50), or an image classification model based on a convolutional neural network, etc. The image classification network adopted by the image judgment model D does not constitute a limitation on the present application.

[0072] It is understandable that the initial image judgment model D will mistakenly judge the second designated image X2 after adding sensitive noise as a legitimate image. However, through ordinary human eye observation, it is difficult to distinguish the subtle differences between the first designated image X1 and the second designated image X2. It can even be said that the visual experience brought by the first designated image X1 and the second designated image X2 is exactly the same. This is the blind spot problem of the conventional image judgment model D.

[0073] It can be understood that after training the image judgment model D based on the target training set, the target judgment model is obtained, which can effectively improve the generalization ability of the image judgment model D. The target judgment model determines that the second designated image X2 after adding sensitive noise is an illegal image. In addition, the target judgment model can efficiently identify illegal images after adding noise, which can effectively prevent illegal images from being rampant on the Internet.

[0074] Optionally, the target determination model may be a pornographic image determination model, and the similarity between the first designated image and the second designated image is determined based on a structural similarity index (SSIM) algorithm.

[0075] The structural similarity algorithm is an indicator for measuring the similarity between two images.

[0076] Specifically, if two images x1 and x2 are given, the structural similarity SSIM of the two images can be calculated as follows:

[0077]

[0078] In the above formula, μ x1Represents the average pixel value of image x1, μ x2 Represents the average pixel value of image x2;

[0079] σ x1x2 Represents the covariance of the pixels of image x1 and image x2; σ x1 Represents the standard deviation of the pixels in image x1, σ x2 Represents the standard deviation of the pixels in image x2; c1 and c2 are constants to avoid systematic errors caused by the denominator being zero.

[0080] It can be understood that the SIMM indicator can be used as the second constraint condition. If the SIMM indicator is used as the second constraint condition, the SIMM indicator can be marked as Loss2.

[0081] Understandably, see Figure 7 The first constraint condition Loss1 and the second constraint condition Loss2 mentioned above can be combined to form the loss function of the system. The mathematical expression of the loss function can be expressed as:

[0082] Loss = aLoss1 + (1-a) Loss2

[0083] Where a is a constant and is used to adjust the weights of Loss1 and Loss2. For example, a can be set to 0.5.

[0084] Step 13: classify the target image using the target determination model.

[0085] In this way, through the image classification method provided by this application, the process of criminals adding sensitive noise to pornographic images is simulated, and the traditional image judgment model is effectively trained to obtain a trained target judgment model. The target judgment model's ability to resist sensitive noise can be greatly improved, thereby reducing the risk of failure of the network supervision model to distinguish pornographic images, and thus effectively improving the governance efficiency of network supervision.

[0086] Figure 5 is a flowchart of a method for image classification provided by an embodiment of the present application. Figure 5 , a picture classification method provided in an embodiment of the present application may include the following steps:

[0087] Step 50: Get the target image.

[0088] Step 51: Get the first specified picture.

[0089] Step 52: Perform convolution processing, pooling processing, and fully connected layer processing on the first designated image to generate image coding.

[0090] Step 53: Perform full connection layer processing, upsampling processing, and deconvolution processing on the picture encoding to obtain the second designated picture.

[0091] Step 54: Use the image judgment model to judge the first designated image to obtain a first target category, and obtain a classification label of the first designated image, where the classification label of the first designated image indicates the first target category.

[0092] Step 55: Use the image judgment model to judge the second designated image to obtain a second target category, and obtain a classification label of the second designated image, wherein the classification label of the second designated image indicates the second target category; wherein the second target category is different from the first target category.

[0093] Step 56: Modify the classification label of the second designated image to a designated label, where the designated label indicates the first target category.

[0094] Step 57: Add the first designated picture, the classification label of the first designated picture, the second designated picture, and the designated label of the second designated picture to the target training set.

[0095] Step 58: Based on the target training set, the image judgment model D is trained to obtain a target judgment model.

[0096] Step 59: Classify the target image using the target determination model.

[0097] It should be pointed out that the above step 50 is not necessarily executed before step 51, and the above step 50 can also be executed after step 58. The specific execution order of the above steps does not constitute a limitation to the present application.

[0098] The embodiment of the present application provides a method for image classification, which obtains a target image to be classified; determines a target judgment model; wherein the target judgment model is a judgment model that judges a first image and a second image as being of the same category, the similarity between the first image and the second image is greater than a threshold, and the second image is a picture obtained by adding noise to the first image; and uses the target judgment model to classify the target image. In this way, through the image classification method provided by the present application, the ability of the target judgment model to resist sensitive noise can be improved, thereby reducing the risk of failure of the network supervision model to distinguish pornographic images, thereby effectively improving the governance efficiency of network supervision.

[0099] Figure 8 is a structural block diagram of a picture classification device provided in an embodiment of the present application. Figure 8, an image classification device provided in an embodiment of the present application may include:

[0100] An acquisition module 802 is used to acquire a target image to be classified;

[0101] The determination module 804 is used to obtain a pre-trained target determination model for determining the category of an image; wherein if the similarity between the first image and the second image is greater than a set similarity threshold, the target determination model determines that the first image and the second image are of the same category;

[0102] The second picture is a picture obtained by adding noise to the first picture;

[0103] The classification module 806 is used to classify the target image using the target determination model.

[0104] Optionally, before the determining module 804 acquires the pre-trained target determination model, the acquiring module 802 may also be used to:

[0105] Get the target training set;

[0106] The image classification device further includes a training module, which is used to: train the image judgment model based on deep learning based on the target training set, until the image judgment model judges two images with a similarity greater than a set similarity threshold as being of the same category, and the training is completed to obtain the target judgment model;

[0107] The target training set includes multiple groups of specified picture pairs, each group of specified picture pairs includes a first specified picture and a classification label of the first specified picture, a second specified picture and a classification label of the second specified picture, the similarity between the first specified picture and the second specified picture is greater than a set similarity threshold, and the classification label of the first specified picture and the classification label of the second specified picture indicate the same category.

[0108] Optionally, in the process of acquiring the target training set, the acquisition module 802 may be specifically used to:

[0109] Acquire multiple groups of designated picture pairs; wherein each group of designated picture pairs includes a first designated picture and a second designated picture whose similarity is greater than a set similarity threshold, and the second designated picture is a picture obtained by adding noise to the first designated picture;

[0110] For any set of specified image pairs:

[0111] Determine a classification label of the first designated image according to a classification result of the first designated image by the image judgment model, where the classification label of the first designated image indicates a category of the first designated image;

[0112] Determine a classification label of the second designated image according to a classification result of the second designated image by the image judgment model, where the classification label of the second designated image indicates a category of the second designated image;

[0113] When the classification label of the second designated picture is the same as the classification label of the first designated picture, discarding the current group of designated picture pairs;

[0114] When the classification label of the second designated image is different from the classification label of the first designated image, modifying the classification label of the second designated image to the classification label of the first designated image;

[0115] The first designated picture, the classification label of the first designated picture, the second designated picture, and the modified classification label of the second designated picture are used as the target designated picture pair.

[0116] Optionally, the target determination model is a pornographic picture determination model. In the process of acquiring the second designated picture, the acquisition module 802 may be specifically used to:

[0117] Performing convolution processing, pooling processing, and fully connected layer processing on the first designated image to generate an image code;

[0118] The picture encoding is subjected to full connection layer processing, upsampling processing, and deconvolution processing to obtain the second designated picture.

[0119] Optionally, the target determination model is a pornographic picture determination model, and the similarity between the first designated picture and the second designated picture is determined based on a structural similarity algorithm.

[0120] Among them, the image classification device corresponds to the image classification method. The specific implementation process of the above steps can refer to the above description and will not be repeated here.

[0121] In addition, an embodiment of the present application further provides an electronic device, which may include a processor and a memory, wherein the memory may store a computer program, and when the computer program is executed by the processor, the following process may be implemented:

[0122] Get the target image to be classified;

[0123] Obtaining a pre-trained target determination model for determining the category of an image; wherein, if the similarity between a first image and a second image is greater than a set similarity threshold, the target determination model determines that the first image and the second image are of the same category, and the second image is an image obtained by adding noise to the first image;

[0124] The target image is classified using the target determination model.

[0125] Among them, the specific implementation process of the above steps can refer to the above picture classification method, which will not be repeated here.

[0126] An electronic device provided in an embodiment of the present application obtains a target image to be classified; obtains a pre-trained target determination model for determining the category of an image; wherein, if the similarity between a first image and a second image is greater than a set similarity threshold, the target determination model determines the first image and the second image to be of the same category; and classifies the target image using the target determination model. In this way, through a method for image classification provided in the present application, the ability of the target determination model to resist sensitive noise can be improved, thereby reducing the risk of failure of the network supervision model to distinguish pornographic images, thereby effectively improving the governance efficiency of network supervision.

[0127] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.

[0128] The present invention is described with reference to flowcharts and / or block diagrams of methods, apparatuses, and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as a combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the process in the flowchart. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0129] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0130] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0131] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0132] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.

[0133] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.

[0134] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.

[0135] The embodiments of the present invention are described above in conjunction with the accompanying drawings, but the present invention is not limited to the above-mentioned specific implementation modes, which are merely illustrative rather than restrictive. Under the guidance of the present invention, ordinary technicians in this field can also make many forms without departing from the scope of protection of the present invention and the claims, all of which are within the protection of the present invention.

Claims

1. A method for image classification, characterized in that: The method comprises: Get the target image to be classified; Obtaining a pre-trained target determination model for determining the category of an image; wherein if the similarity between the first image and the second image is greater than a set similarity threshold, the target determination model determines that the first image and the second image are of the same category; Using the target determination model, classifying the target image; The training process of the target determination model includes: Acquire a target training set, wherein the target training set includes multiple groups of target designated picture pairs, each group of target designated picture pairs includes a first designated picture and a classification label of the first designated picture, a second designated picture and a classification label of the second designated picture, a similarity between the first designated picture and the second designated picture is greater than a set similarity threshold, the classification label of the first designated picture and the classification label of the second designated picture indicate the same category, and the similarity between the first designated picture and the second designated picture is determined based on a structural similarity algorithm; Based on the target training set, the deep learning-based image judgment model is trained until the image judgment model determines that two images with a similarity greater than a set similarity threshold are of the same category, and the training is completed to obtain a target judgment model; The process of acquiring the target training set includes: Acquire multiple groups of designated picture pairs; wherein each group of designated picture pairs includes a first designated picture and a second designated picture whose similarity is greater than a set similarity threshold, and the second designated picture is a picture obtained by adding noise to the first designated picture; For any set of specified image pairs: Determine a classification label of the first designated image according to a classification result of the first designated image by the image judgment model, where the classification label of the first designated image indicates a category of the first designated image; Determine a classification label of the second designated image according to a classification result of the second designated image by the image judgment model, where the classification label of the second designated image indicates a category of the second designated image; When the classification label of the second designated picture is the same as the classification label of the first designated picture, discarding the current group of designated picture pairs; When the classification label of the second designated image is different from the classification label of the first designated image, modifying the classification label of the second designated image to the classification label of the first designated image; The first designated picture, the classification label of the first designated picture, the second designated picture, and the modified classification label of the second designated picture are used as the target designated picture pair.

2. The image classification method according to claim 1, characterized in that: The second designated image is obtained by: Performing convolution processing, pooling processing, and fully connected layer processing on the first designated image to generate an image code; The picture encoding is subjected to full connection layer processing, upsampling processing, and deconvolution processing to obtain the second designated picture.

3. The image classification method according to claim 1, characterized in that: The target determination model is a pornographic picture determination model.

4. A picture classification device, characterized in that: The device comprises: An acquisition module is used to obtain the target image to be classified; A determination module, used to obtain a pre-trained target determination model for determining the category of an image; wherein if the similarity between the first image and the second image is greater than a set similarity threshold, the target determination model determines that the first image and the second image are of the same category; A classification module, used to classify the target image using the target determination model; Before the determination module acquires the pre-trained target determination model, the acquisition module is further used to: acquire a target training set; The image classification device further includes a training module, which is used to: train the image judgment model based on deep learning based on the target training set, until the image judgment model judges two images with a similarity greater than a set similarity threshold as being of the same category, and the training is completed to obtain the target judgment model; The target training set includes multiple groups of target designated picture pairs, each group of target designated picture pairs includes a first designated picture and a classification label of the first designated picture, a second designated picture and a classification label of the second designated picture, the similarity between the first designated picture and the second designated picture is greater than a set similarity threshold, the classification label of the first designated picture and the classification label of the second designated picture indicate the same category, and the similarity between the first designated picture and the second designated picture is determined based on a structural similarity algorithm; In the process of acquiring the target training set, the acquisition module is specifically used to: Acquire multiple groups of designated picture pairs; wherein each group of designated picture pairs includes a first designated picture and a second designated picture whose similarity is greater than a set similarity threshold, and the second designated picture is a picture obtained by adding noise to the first designated picture; For any set of specified image pairs: Determine a classification label of the first designated image according to a classification result of the first designated image by the image judgment model, where the classification label of the first designated image indicates a category of the first designated image; Determine a classification label of the second designated image according to a classification result of the second designated image by the image judgment model, where the classification label of the second designated image indicates a category of the second designated image; When the classification label of the second designated picture is the same as the classification label of the first designated picture, discarding the current group of designated picture pairs; When the classification label of the second designated image is different from the classification label of the first designated image, modifying the classification label of the second designated image to the classification label of the first designated image; The first designated picture, the classification label of the first designated picture, the second designated picture, and the modified classification label of the second designated picture are used as the target designated picture pair.

5. The image classification device according to claim 4, characterized in that: The target determination model is a pornographic picture determination model. In the process of obtaining the second specified picture, the acquisition module is specifically used to: Performing convolution processing, pooling processing, and fully connected layer processing on the first designated image to generate an image code; The picture encoding is subjected to full connection layer processing, upsampling processing, and deconvolution processing to obtain the second designated picture.

6. An electronic device, characterized in that: The electronic device comprises a processor and a memory, wherein the memory stores a computer program, and when the computer program is executed by the processor, the method according to any one of claims 1 to 3 is implemented.

Citation Information

Patent Citations

  • Method for identifying unsuitable content in colour digital image

    CN101901346A

  • Image classifying method based on transfer learning multiple attractor cellular automata (MACA)

    CN104680178A

  • Garbage classification method, device and system based on image identification

    CN107092914A

  • Image processing method, image processing device and terminal equipment

    CN108921806A

  • Model training method and device, apparatus and storage medium

    CN109034218A