Data processing method, image detection method and related equipment
By chunking and feature extraction of images and adjusting image detection model parameters, the problem of difficulty in detecting AI images in the prior art is solved, accurate identification of AI images is achieved, and the risk of copyright infringement is reduced.
Patent Information
- Application Number
- CN202411276999.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-11
- Publication Date
- 2024-12-27
AI Technical Summary
The prior art is difficult to accurately detect whether images are images generated by artificial intelligence, resulting in challenges in copyright protection and content supervision.
By chunking the image, a sample image without text information and a sample image including text information are generated, feature vectors are extracted and features with preset proportions are discarded, and the image detection model parameters are adjusted so that the model pays more attention to image blocks with rich texture features. , eliminates text information interference and achieves accurate detection of AI images.
It improves the accuracy and generalization ability of the image detection model, can accurately determine whether the image is an image generated by artificial intelligence, and reduces the risk of copyright infringement.
Smart Images

Figure CN119206336A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a data processing method, an image detection method and related equipment. Background Art
[0002] With the rapid development of artificial intelligence (AI), such as artificial intelligence generated content (AIGC), the images it generates are becoming more and more realistic. While bringing a lower threshold for creation, it also poses great challenges to content supervision and copyright protection. Therefore, it is becoming increasingly important to detect whether an image is an AI image. Summary of the invention
[0003] In view of the above content, it is necessary to provide a data processing method, an image detection method and related equipment that can solve the technical problem of difficulty in accurately detecting whether an image is an AI image.
[0004] On the one hand, an embodiment of the present application provides a data processing method, which includes: dividing a sample image into blocks to obtain sample image blocks including text information and sample image blocks not including text information, generating a first sample image and a second sample image based on the sample image blocks and the texture complexity of the sample image blocks, the first sample image not including text information, and the second sample image including text information; performing feature extraction on the first sample image and the second sample image to obtain a first feature vector of the first sample image and a second feature vector of the second sample image, and discarding a preset proportion of features in the second feature vector to obtain a third feature vector; splicing the first feature vector and the third feature vector to obtain a first splicing vector, and obtaining a classification probability that the sample image is an AI image according to the first splicing vector; determining a loss value according to the classification probability and the category label of the sample image, and adjusting the parameters of the image detection model according to the loss value.
[0005] In the data processing method of this embodiment, by discarding the features of a preset proportion in the second feature vector corresponding to the second sample image, the number of texture features in the first feature vector can be kept constant and the number of texture features in the second feature vector can be changed to obtain the third feature vector, which is equivalent to the control variable method. Since the number of texture features in the first feature vector remains constant and the number of texture features in the second feature vector changes, the image detection model can learn that the importance of the first feature vector is greater than the importance of the third feature vector, so that different learning weights can be assigned to the first feature vector and the third feature vector, and the image detection model can pay more attention to learning the first feature vector. Considering that the image detection model will pay more attention to learning the sample image blocks with rich texture features relative to the sample image blocks with sparse texture features, and the more text information, the richer the texture features are. Therefore, the difference in text information in the image may cause the image detection model to pay too much attention to and learn the features with more text information in the image, while ignoring the features with less text information in the image. This learning bias caused by the difference in text information will lead to poor accuracy and generalization ability of the image detection model. Since the first sample image does not include text information, the image detection model is made to learn the first feature vector corresponding to the first sample image that does not include text information, which can eliminate the interference of text information on the learning of the image detection model, so that the image detection model can accurately detect the sample image. The classification probability can represent the possibility that the image detection model predicts that the sample image is an AI image, and the category label of the sample image can represent the actual category corresponding to the sample image. Therefore, the loss value can reflect the gap between the prediction of the image detection model and the actual category. The parameters of the image detection model are adjusted through the loss value, so that the adjusted image detection model can learn how to accurately detect whether the image is an AI image, thereby accurately determining whether the image is an AI image.
[0006] On the one hand, the present application provides an image detection method, which includes: dividing an image to be detected into blocks to obtain detection image blocks including text information and detection image blocks not including text information, generating a first detection image and a second detection image based on the detection image blocks and the texture complexity of the detection image blocks, wherein the first detection image does not include text information, and the second detection image includes text information, performing feature extraction on the first detection image and the second detection image through an image detection model to obtain a first detection vector and a second detection vector, the image detection model is obtained through the data processing method, the first detection vector and the second detection vector are spliced to obtain a second splicing vector, and the detection probability that the image to be detected is the AI image is obtained according to the second splicing vector, and according to the detection probability, determining whether the image to be detected is the AI image.
[0007] In the image detection method provided in the embodiment of the present application, since the image detection model can accurately detect whether an image is an AI image, when the image detection model is used to detect the image to be detected, it can be accurately determined whether the image to be detected is an AI image.
[0008] On the other hand, the present application provides an electronic device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the data processing method or the image detection method when executing the computer program.
[0009] On the other hand, the present application provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the data processing method or the image detection method is implemented.
[0010] On the other hand, the present application provides a computer program product, including a computer program, which, when executed by a processor, implements any of the data processing methods described above, or implements any of the image detection methods described above. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments of the present application will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0012] Figure 1 It is a flow chart of a data processing method provided in one embodiment of the present application.
[0013] Figure 2 This is a flowchart of a method for generating a first sample image provided by an embodiment of the present application.
[0014] Figure 3 It is a flowchart of a data processing method provided in one embodiment of the present application.
[0015] Figure 4 It is a flow chart of an image detection method provided in one embodiment of the present application.
[0016] Figure 5 This is a flowchart of a method for generating a first detection image provided in one embodiment of the present application.
[0017] Figure 6 It is a flowchart of an image detection method provided in one embodiment of the present application.
[0018] Fig. 7A It is a structural diagram of a data processing device provided in one embodiment of the present application.
[0019] Figure 7B It is a structural schematic diagram of an image detection device provided in one embodiment of the present application.
[0020] Figure 8 It is a schematic diagram of the structure of an electronic device provided in one embodiment of the present application. DETAILED DESCRIPTION
[0021] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0022] In the following, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of indicated technical features. Thus, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. In the description of the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or explanations. Any embodiment or design described as "exemplary" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a concrete way.
[0023] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those generally understood by those skilled in the art in the technical field in this application. The terms used in the specification of this application are only for the purpose of describing specific embodiments and are not intended to limit this application. It should be understood that, unless otherwise specified in this application, "at least one" refers to one or more. "Multiple" refers to two or more than two. For example, at least one of a, b or c can represent: a, b, c, a and b, a and c, b and c, a, b and c seven situations.
[0024] With the rapid development of artificial intelligence technology, artificial intelligence is increasingly being used in the generation of advertising materials and other delivery materials. While this change improves the efficiency of delivery material generation, it also brings some potential risks. Since artificial intelligence can learn and imitate a large amount of image data, the images generated by artificial intelligence may contain unauthorized copyright content, such as trademarks, patent patterns, or copyrighted photographic works. If the images generated by artificial intelligence are directly used as delivery materials for advertising and other activities, there may be a risk of infringement. Therefore, it is becoming increasingly important to detect whether an image is generated by artificial intelligence.
[0025] In the related art, the high texture feature vector is often subtracted from the low texture feature vector, and the features obtained after the subtraction are classified to determine whether the image is an image generated by AIGC. The high texture feature can be a feature vector including more texture features, and the low texture feature vector can be a feature vector including fewer texture features. This method will cause the model to assign the same learning weight to the high texture feature vector and the low texture feature vector during the training process, making it difficult to fully learn the high texture feature vector, resulting in poor performance of the trained model, and making it difficult to accurately detect whether the image is an image generated by AIGC.
[0026] In order to solve the above technical problems, the embodiments of the present application provide a data processing method and an image detection method, which can accurately detect whether an image is an image generated by artificial intelligence. For ease of understanding, the technical solutions provided by the embodiments of the present application are described in detail below in conjunction with the accompanying drawings.
[0027] The present application will describe the technical solution of the present application in detail through specific embodiments below. It should be noted that the following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments.
[0028] like Figure 1 FIG. 1 is a flow chart of a data processing method provided by an embodiment of the present application. According to different requirements, the order of each step in the flow chart can be adjusted according to actual requirements, and some steps can be omitted. The data processing method is applied to electronic equipment.
[0029] S11, dividing the sample image into blocks to obtain sample image blocks including text information and sample image blocks not including text information, and generating a first sample image and a second sample image based on the sample image blocks and texture complexity of the sample image blocks.
[0030] In some embodiments of the present application, the sample image may be a delivery material (such as an advertising material, etc.), and the delivery material may include images generated by artificial intelligence and images generated by non-artificial intelligence. For ease of explanation, the images generated by artificial intelligence are referred to as AI images, and the images generated by non-artificial intelligence are referred to as non-AI images. Delivery materials often have specific text, patterns, and visual elements to increase their appeal. AI images include, but are not limited to, images generated by models or algorithms such as Artificial Intelligence Generated Content (AIGC), Generative Adversarial Networks (GANs), and Diffusion Models. Non-AI images include images generated by users through tools such as drawing and cameras, such as hand-drawn illustrations and photos.
[0031] There may be multiple sample images, each of which has a corresponding category label, and the category label is used to indicate the true category / actual category of the sample image. The actual categories may include: AI images, non-AI images. Category labels may be in the form of numbers, letters, or a combination of numbers and letters, and this application does not limit this. For example, category labels may include "1" and "0", where the actual category indicated by the category label "1" may be "AI image", and the sample image corresponding to the category label "1" is an AI image, and the actual category indicated by the category label "0" may be "non-AI image", and the sample image corresponding to the category label "0" is a non-AI image.
[0032] In some embodiments of the present application, the electronic device may receive image data input by a user as a sample image, or the electronic device may read image data in a folder under a preset path as a sample image, or the electronic device may obtain a sample image from a database of a server. The present application does not limit the method for obtaining the sample image.
[0033] In some embodiments of the present application, the sample image is used to adjust the parameters of the image detection model, that is, to train and optimize the image detection model. In order to make the sample image meet the requirements of the image detection model for the size of the input image, after obtaining the sample image, the sample image can be scaled so that the size of the scaled sample image meets the requirements of the image detection model for the input image. For example, if the image detection model requires the size of the input image to be 256*256, the electronic device can scale the size of the sample image to 256*256.
[0034] In some embodiments of the present application, the electronic device may perform block processing on the sample image according to the block parameters to obtain multiple sample image blocks. The block parameters may include the number of sample image blocks and the size of the sample image blocks, wherein the number of blocks determines the values of the multiple sample image blocks obtained by block processing, and the size of the blocks determines the width and height of each image block in the multiple sample image blocks. The image sizes of the multiple sample image blocks are the same, and the multiple sample image blocks have pixels at corresponding positions. For example, if the size of the scaled sample image is 256*256, if the number of blocks in the block parameters is 64, and the size of the blocks is 4*4, 64 sample image blocks can be obtained by using the block parameters to block the 256*256 sample image, and the width and height of each sample image block in the multiple sample image blocks are both 4 pixels.
[0035] Considering that in order to increase the attractiveness, various types of text information are often distributed in various areas of the delivery material, and the texture information of the text boundary is rich, the texture information of the text will affect the calculation of the texture complexity of the sample image block. For example, when the delivery material includes a large amount of text, the number of sample image blocks with rich texture features in the sample image block will account for the vast majority, while the number of sample image blocks with sparse texture features is relatively small. Relative to the sample image blocks with sparse texture features, the image detection model will pay more attention to learning the sample image blocks with rich texture features, and the more text information means the richer the texture features. Therefore, the difference in text information in the image may cause the image detection model to pay too much attention to and learn the features with more text information in the image, while ignoring the features with less text information in the image. This learning bias caused by the difference in text information will lead to poor accuracy and generalization ability of the image detection model. Therefore, in order to eliminate the learning bias caused by the difference in text information, it is necessary to distinguish the sample image blocks including text information and the sample image blocks not including text information in the multiple sample image blocks obtained by dividing the sample image into blocks.
[0036] In some embodiments of the present application, the electronic device can identify the location of the text information in the sample image, and classify the multiple sample image blocks into sample image blocks including text information and sample image blocks not including text information according to the location. The location of the text information can be the vertex coordinates of the text box corresponding to the text information in the sample image. The electronic device can identify the text information in the sample image, and select the text information to obtain the vertex coordinates of the text box. The present application does not limit the method of identifying the location of the text information.
[0037] For example, the electronic device can use an optical character recognition (OCR) algorithm to identify text information in a sample image, and select the text information to obtain a text box, determine the sample image block that includes the vertex coordinates of the text box among the multiple sample image blocks as a sample image block that includes text information, and determine the sample image block that does not include the vertex coordinates of the text box as a sample image block that does not include text information.
[0038] In some embodiments of the present application, after the sample image blocks are divided into sample image blocks including text information and sample image blocks not including text information, further division can be performed on the sample image blocks not including text information. For example, the electronic device determines a threshold value according to the texture complexity of the sample image blocks not including text information; and classifies the sample image blocks not including text information into a first sample image block and a second sample image block, wherein the texture complexity of the first sample image block is greater than or equal to the threshold value, and the texture complexity of the second sample image block is less than the threshold value.
[0039] The texture complexity can be used to measure the amount of texture information in a sample image block that does not include text information. For example, a higher texture complexity corresponds to more texture information in a sample image block, and a lower texture complexity corresponds to less texture information in a sample image block.
[0040] The electronic device may use various methods to calculate the texture complexity of each sample image block that does not include text information, and the present application does not limit the method for calculating the texture complexity.
[0041] For example, the method for calculating the texture complexity of each sample image block excluding text information can refer to the following formula (1):
[0042]
[0043] Among them, I div represents the texture complexity, M represents the width or height of the sample image block excluding text information, and x i,j represents the pixel value of the pixel in the i-th row and j-th column of the sample image block that does not contain text information, x i,j+1 represents the pixel value of the pixel at the i-th row and j+1-th column in the sample image block that does not contain text information, x i+1,j represents the pixel value of the pixel at the i+1th row and jth column in the sample image block that does not contain text information, x i+1,j+1 The pixel value of the pixel at the i+1th row and j+1th column in the sample image block that does not include text information.
[0044] In some embodiments of the present application, the texture complexity of a sample image block including text information may be set to zero by default.
[0045] The threshold may be an average value of the texture complexity of sample image blocks that do not include text information, or may be a median value of the texture complexity of sample image blocks that do not include text information, etc., and no limitation is made here.
[0046] In this embodiment, the threshold is calculated by the texture complexity of all sample image blocks that do not include text information, so that the threshold can be representative. According to the threshold, the sample image blocks that do not include text information are divided into first sample image blocks and second sample image blocks, which can not only improve the classification accuracy, but also obtain the first sample image blocks with richer texture information, so as to obtain the first sample image according to the first sample image blocks later.
[0047] In some embodiments of the present application, after dividing a sample image block that does not include text information into a first sample image block and a second sample image block, a first sample image and a second sample image are generated based on the sample image block and the texture complexity of the sample image block, and the generated first sample image does not include text information, and the second sample image includes text information.
[0048] The first sample image does not include text information. Specifically, the first sample image can be a sample image generated based on a first sample image block that does not include text information and whose texture complexity is greater than or equal to a threshold. The second sample image includes text information. Specifically, the second sample image can be an image generated based on a sample image block that includes text information, or can be an image generated based on a second sample image block that does not include text information and whose texture complexity is less than or equal to a threshold. Each sample image has the same image size as the first sample image and the second sample image.
[0049] Optionally, the first sample image corresponds to a first sample image block, and the second sample image corresponds to a sample image block including text information and a second sample image block. Exemplarily, the generating of the first sample image and the second sample image based on the sample image block and the texture complexity of the sample image block includes: generating the first sample image according to the first sample image block, and generating the second sample image according to the sample image block including text information and the second sample image block.
[0050] Optionally, when generating the first sample image according to the first sample image block, and generating the second sample image according to the second sample image block, the third sample image block may be generated according to the first sample image block, and the first sample image may be generated according to the first sample image block and the third sample image block, the fourth sample image block may be generated according to the second sample image block, and the second sample image may be generated according to the second sample image block and the fourth sample image block. Alternatively, the electronic device may obtain the third sample image block by splicing or fusing a plurality of first sample image blocks, and obtain the first sample image by splicing, fusing or combining the first sample image block and the third sample image block. The generation methods of the fourth image block and the third image block are substantially the same, and the generation methods of the second sample image and the first sample image are substantially the same, so the present application will not repeat the description.
[0051] In this embodiment, since the first sample image contains rich texture information and is free from interference caused by text information, the training of the model can be optimized through the first sample image, so that the model can learn richer texture information, thereby enabling the image detection model to accurately detect the image.
[0052] S12, performing feature extraction on the first sample image and the second sample image to obtain a first feature vector of the first sample image and a second feature vector of the second sample image, and discarding features of a preset proportion in the second feature vector to obtain a third feature vector.
[0053] In some embodiments of the present application, an image detection model may be used to extract features from the first sample image and the second sample image. The image detection model may include a feature extraction layer and a classification layer. For example, the feature extraction layer may include a convolution layer, a dropout layer, a pooling layer, an activation function layer, etc.
[0054] Parameters such as the number of channels, quantity, and step size of the convolution kernel in the convolution layer can be customized, and this application does not impose any restrictions on this. The convolution layer is used to extract features from the first sample image and the second sample image to obtain a first feature vector corresponding to the first sample image and a second feature vector corresponding to the second sample image.
[0055] The Dropout layer is used to randomly discard the features in the second feature vector to obtain a third feature vector. The Dropout layer can discard the features in the second feature vector according to a preset ratio. The preset ratio is the ratio of the discarded features, and the discarded features will not be used as input for the next layer. Among them, the preset ratio can be customized, and this application does not limit this. For example, the preset ratio can be 0.1 (10%), 0.2 (20%) or 0.5 (50%), etc.
[0056] The pooling layer is used to reduce the spatial dimensions (width and height) of the first eigenvector and the third eigenvector, thereby reducing the amount of calculation and the amount of parameters and maintaining important feature information. The pooling layer can be a maximum pooling (Max Pooling) and / or an average pooling (Average Pooling) layer, etc.
[0057] The activation function layer can be ReLU, Sigmoid or Tanh, etc., which is not limited in this application. The activation function can be used to control the output range, alleviate gradient disappearance and gradient explosion, and accelerate the convergence speed of the image detection model.
[0058] The classification layer may be a fully connected layer (FC), and the activation functions in the fully connected layer include but are not limited to: Sigmoid and softmax. The classification layer classifies the first eigenvector and the third eigenvector to obtain the probability that the sample image is an AI image.
[0059] The above description of the structure of the image detection model is only an example, and is not limited to this in practical applications. For example, the image detection model may also include a normalization layer (LayerNorm, LN).
[0060] The above-mentioned method of extracting features from the first sample image and the second sample image is only an example and is not limited thereto in practical applications. For example, in other embodiments, features of the first sample image and the second sample image can be extracted respectively by using a pre-trained model such as Bidirectional Encoder Representations from Transformer (BERT) to obtain a first feature vector and a second feature vector.
[0061] In this embodiment, by discarding a preset proportion of features in the second eigenvector corresponding to the second sample image, the number of texture features in the first eigenvector can be kept constant and the number of texture features in the second eigenvector can be changed to obtain the third eigenvector, which is equivalent to the control variable method. Since the number of texture features in the first eigenvector remains constant and the number of texture features in the second eigenvector changes, the image detection model can learn that the importance of the first eigenvector is greater than the importance of the third eigenvector, so that different learning weights can be assigned to the first eigenvector and the third eigenvector, and the image detection model can pay more attention to learning the first eigenvector.
[0062] Optionally, a preset ratio can be set, for example, 20%, 40%, 60%, etc., and different presets can be set according to different application scenarios. For example, the preset ratio can be used to determine how many feature vectors in the second sample image need to be discarded, or how much area the feature vectors occupy, so that the second feature vectors of the second sample image are fewer, thereby highlighting the first feature vector in the first sample image.
[0063] S13, concatenating the first eigenvector and the third eigenvector to obtain a first concatenated vector, and obtaining a classification probability that the sample image is an AI image according to the first concatenated vector.
[0064] In some embodiments of the present application, the electronic device may use the concatenate function to concatenate the first eigenvector and the third eigenvector along the channel dimension to obtain a first concatenated vector, and use the classification layer of the image detection model to process the first concatenated vector to obtain the classification probability that the sample image is an AI image. The concatenation method of the first concatenated vector is only an example and is not limited to this in practical applications.
[0065] In some embodiments of the present application, the classification layer includes parameters such as weights and biases, and each element value in the weights may correspond to different categories, including AI images. The electronic device processes the first splicing vector using the classification layer to obtain the classification probability that the sample image is an AI image, including: performing a linear transformation on multiple element values in the first splicing vector according to parameters such as weights and biases to obtain the original score of the sample image being an AI image, and using the formula of an activation function such as sigmoid or softmax to calculate the original score to obtain the classification probability that the sample image is an AI image.
[0066] The linear transformation may be a weighted sum. The method of calculating the original score using the formula of activation functions such as sigmoid or softmax to obtain the classification probability that the sample image is an AI image may refer to the formula of activation functions such as sigmoid or softmax in the relevant technology. If there are multiple sample images, the classification probability of each sample image being an AI image may be obtained.
[0067] S14, determining a loss value according to the classification probability and the category label of the sample image, and adjusting the parameters of the image detection model according to the loss value.
[0068] In some embodiments of the present application, each sample image has a corresponding category label and classification probability. If there are multiple sample images, the electronic device can use the category labels and classification probabilities corresponding to all sample images to calculate the loss value of the image detection model. For example, the electronic device can use a preset loss function to calculate the loss value. If the preset loss function is a cross entropy loss function, the method for calculating the loss value can refer to formula (2):
[0069]
[0070] Among them, L represents the loss value, N represents the number of sample images, and y i represents the category label of the i-th sample image, p i The classification probability of the i-th sample image.
[0071] In some embodiments of the present application, the image detection model includes a feature extraction layer and a classification layer, and the electronic device adjusts the parameters of the image detection model according to the loss value, including: adjusting the network parameters of the feature extraction layer and the classification layer until the loss value is within a preset range, stopping the adjustment, and determining the adjusted feature extraction layer and the adjusted classification layer as the adjusted image detection model.
[0072] Among them, the network parameters can be weights and biases, etc. The preset range can be customized, and this application does not limit this. For example, the preset range can be 0 to 0.2. When the loss value is not in the preset range, the process returns to step S12, and continues to perform feature extraction on the first sample image and the second sample image to obtain the first feature vector of the first sample image and the second feature vector of the second sample image, and discards the features of the preset proportion in the second feature vector to obtain the third feature vector.
[0073] In this embodiment, when the loss value is within a preset range, it is determined that the image detection model is in a convergence state. Therefore, the adjusted feature extraction layer and the adjusted classification layer are determined as the adjusted image detection model, so that the adjusted image detection model can learn how to accurately detect whether the image is an AI image, thereby being able to accurately determine whether the image is an AI image.
[0074] In the data processing method of this embodiment, by discarding the features of a preset proportion in the second feature vector corresponding to the second sample image, the number of texture features in the first feature vector can be kept constant and the number of texture features in the second feature vector can be changed to obtain the third feature vector, which is equivalent to the control variable method. Since the number of texture features in the first feature vector remains constant and the number of texture features in the second feature vector changes, the image detection model can learn that the importance of the first feature vector is greater than the importance of the third feature vector, so that different learning weights can be assigned to the first feature vector and the third feature vector, and the image detection model can pay more attention to learning the first feature vector. Considering that the image detection model will pay more attention to learning the sample image blocks with rich texture features relative to the sample image blocks with sparse texture features, and the more text information means the richer the texture features, the difference in text information in the image may cause the image detection model to pay too much attention to and learn the features with more text information in the image, while ignoring the features with less text information in the image. This learning bias caused by the difference in text information will lead to poor accuracy and generalization ability of the image detection model. Since the first sample image does not include text information, the image detection model is made to learn the first feature vector corresponding to the first sample image that does not include text information, which can eliminate the interference of text information on the learning of the image detection model, so that the image detection model can accurately detect the sample image. The classification probability can represent the possibility that the image detection model predicts that the sample image is an AI image, and the category label of the sample image can represent the actual category corresponding to the sample image. Therefore, the loss value can reflect the gap between the prediction of the image detection model and the actual category. The parameters of the image detection model are adjusted through the loss value, so that the adjusted image detection model can learn how to accurately detect whether the image is an AI image, thereby accurately determining whether the image is an AI image.
[0075] like Figure 2 FIG. 1 is a flow chart of a method for generating a first sample image provided by an embodiment of the present application, comprising the following steps:
[0076] S111 , determining a target number based on the number of multiple sample image blocks obtained by dividing the sample image into blocks and the number of first sample image blocks.
[0077] In some embodiments of the present application, since the number of the multiple sample image blocks is greater than or equal to the number of the first sample image blocks, the electronic device may determine the difference between the number of all sample image blocks and the number of all first sample image blocks as the target number.
[0078] In this embodiment, since the first sample image block is a partial image block among the multiple sample image blocks, in order to make the size of the generated first sample image the same as the size of the sample image, it is necessary to determine the difference between the number of the multiple sample image blocks and the number of the first sample image blocks, so as to provide a basis for the subsequent generation of the first sample image with the same size as the sample image.
[0079] S112: Generate a target number of third sample image blocks according to the first sample image blocks.
[0080] In some embodiments of the present application, the electronic device generates a target number of third sample image blocks based on the first sample image blocks, including: selecting a preset number of first sample image blocks from the first sample image blocks, where the number of selections is the target number, and for each selection of the preset number of first sample image blocks, performing feature fusion on pixel values of pixel points at corresponding positions to obtain the target number of third sample image blocks.
[0081] The preset number can be customized, and the present application does not limit this. For example, the preset number can be 3, 5, or 10. If the preset number is 3, 3 first sample image blocks are selected from the first sample image block each time. In this embodiment, by performing feature fusion on the pixel values of the pixel points at the corresponding positions in the preset number of first sample image blocks selected each time, the amount of information in the third sample image block can be increased.
[0082] In other embodiments, the electronic device may concatenate the selected first sample image blocks along the channel dimension to obtain a third sample image block. Through concatenation, multiple information can be integrated, thereby increasing the amount of information in the third sample image block.
[0083] In this embodiment, by performing feature fusion on the pixel values of the pixel points at the corresponding positions in the preset number of first sample image blocks selected each time, a target number of third sample image blocks are obtained, which can ensure that the size of the generated third sample image blocks is the same as the size of each first sample image block. By generating the preset number of third sample image blocks, a basis can be provided for generating the first sample image of the same size as the sample image.
[0084] S113: Generate a first sample image according to the first sample image block and the third sample image block.
[0085] In some embodiments of the present application, the electronic device may splice all first sample image blocks and all third sample image blocks into a first sample image having the same size as the sample image. For example, if the size of the sample image is 256*256, the size of the first sample image is also 256*256.
[0086] Optionally, the process of generating the second sample image according to the second sample image block is the same as the process of generating the first sample image according to the first sample image block, and is not described in detail here.
[0087] For example, Figure 3 , which is a flow chart of a data processing method provided in one embodiment of the present application. Figure 3 The data processing method shown includes dividing a sample image into blocks to obtain a plurality of sample image blocks, using optical character recognition technology to identify the position of text information in the sample image, classifying the plurality of sample image blocks into sample image blocks including text information and sample image blocks not including text information based on the position, calculating the texture complexity of each sample image block not including text information, and classifying the sample image blocks not including text information into a first sample image block and a second sample image block based on the texture complexity. A first sample image is generated based on the first sample image block, and a second sample image is generated based on the sample image block including text information and the second sample image block, and features are extracted from the first sample image and the second sample image respectively to obtain a first feature vector and a second feature vector, and features of a preset proportion in the second feature vector are discarded to obtain a third feature vector, and the first feature vector and the third feature vector are spliced to obtain a first splicing vector. The first splicing vector is processed to obtain the classification probability that the sample image is an AI image, and the loss value is calculated according to the classification probability and the category label of the sample image to determine whether the loss value is within a preset range. When the loss value is not within the preset range, the network parameters in the feature extraction layer and the classification layer of the image detection model are adjusted. Alternatively, when the loss value is within the preset range, the adjusted image detection model is determined as the image detection model.
[0088] In some embodiments of the present application, Figure 4 FIG. 1 is a flowchart of an image detection method provided by an embodiment of the present application, comprising the following steps:
[0089] S21, dividing the image to be detected into blocks to obtain detection image blocks including text information and detection image blocks excluding text information, and generating a first detection image and a second detection image based on the detection image blocks and the texture complexity of the detection image blocks.
[0090] In some embodiments of the present application, the image to be detected refers to an image that needs to be detected. The method for acquiring the image to be detected can refer to the method for acquiring the detection image, and the present application will not repeat the description.
[0091] In some embodiments of the present application, an image to be detected can be detected using an image detection model, wherein the image detection model is obtained by executing a data processing method. In order to make the image to be detected meet the requirements of the image detection model for the size of the input image, after acquiring the image to be detected, the image to be detected can be scaled so that the size of the scaled image to be detected meets the requirements of the image detection model for the input image. For example, if the image detection model requires the size of the input image to be 256*256, the electronic device can scale the size of the image to be detected to 256*256.
[0092] In some embodiments of the present application, the electronic device may perform block processing on the image to be detected according to the block parameters to obtain multiple detection image blocks, and classify the multiple detection image blocks into detection image blocks including text information and detection image blocks including text information.
[0093] In some embodiments of the present application, an electronic device generates a first detection image and a second detection image based on a detection image block and the texture complexity of the detection image block, including: determining a threshold according to the texture complexity of the detection image block that does not include text information, classifying the detection image block that does not include text information into a first detection image block and a second detection image block, wherein the texture complexity of the first detection image block is greater than or equal to a target value, and the texture complexity of the second detection image block is less than the target value, generating a first detection image according to the first detection image block, and generating a second detection image according to the detection image block that includes text information and the second detection image block.
[0094] Wherein, the first detection image does not include text information, and the second detection image includes text information. Each detection image has the same image size as the corresponding first detection image and second detection image. The target value is obtained by calculating the texture complexity of all detection image blocks that do not include text information. The calculation method of the target value can refer to the calculation method of the threshold value in step S11.
[0095] The method for dividing the image to be detected into blocks, the method for classifying the multiple detection image blocks into detection image blocks including text information and detection image blocks including text information, the method for generating the first detection image and the second detection image, etc. can refer to the detailed description of step S11, and will not be repeated in this embodiment.
[0096] S22, extracting features from the first detection image and the second detection image through an image detection model to obtain a first detection vector and a second detection vector.
[0097] In some embodiments of the present application, the image detection model may include a feature extraction layer. The feature extraction layer may include a convolution layer, a dropout layer, a pooling layer, a batch normalization layer, an activation function layer, and the like.
[0098] Among them, the method of performing feature extraction on the first detection image and the second detection image according to the feature extraction layer to obtain the first detection vector corresponding to the first detection image and the second detection vector corresponding to the second detection image can be referred to the description of step S12, which will not be repeated in this embodiment.
[0099] S23, splicing the first detection vector and the second detection vector to obtain a second splicing vector, and obtaining a detection probability that the image to be detected is an AI image according to the second splicing vector.
[0100] In some embodiments of the present application, the electronic device may use a concat function to concatenate the first detection vector and the second detection vector into a second concatenated vector.
[0101] The image detection model may further include a classification layer, which is used to classify the second splicing vector to obtain the detection probability that the image to be detected is an AI image. The generation process of the detection probability that the image to be detected is an AI image can refer to the description of the generation process of the classification probability that the sample image is an AI image in step S13, and will not be repeated in this embodiment.
[0102] S24, determining whether the image to be detected is an AI image according to the detection probability that the image to be detected is an AI image.
[0103] In some embodiments of the present application, when the detection probability of the image to be detected being an AI image is greater than or equal to a preset threshold, the image to be detected can be determined to be an AI image, or when the detection probability of the image to be detected being an AI image is less than a preset threshold, the image to be detected is determined to be a non-AI image. The preset threshold can be custom set, and the present application does not limit this. For example, the preset threshold can be 0.8.
[0104] The above method of determining whether the image to be detected is an AI image based on the detection probability that the image to be detected is an AI image is only an example and is not limited to this in actual applications.
[0105] For example, the electronic device may also determine the difference between the preset value and the detection probability that the image to be detected is an AI image as the detection probability that the image to be detected is not an AI image. The preset value may be a value of 1. When the detection probability that the image to be detected is an AI image is greater than or equal to the detection probability that the image to be detected is not an AI image, the image to be detected is determined to be an AI image, or, when the detection probability that the image to be detected is an AI image is less than the detection probability that the image to be detected is not an AI image, the image to be detected is determined to be a non-AI image.
[0106] In the image detection method provided in the embodiment of the present application, since the image detection model can accurately detect whether an image is an AI image, when the image detection model is used to classify the image to be detected, it can be accurately determined whether the image to be detected is an AI image.
[0107] like Figure 5 FIG. 1 is a flow chart of a method for generating a first detection image provided by an embodiment of the present application, comprising the following steps:
[0108] S211, determining the number of targets based on the number of multiple detection image blocks obtained by dividing the image to be detected and the number of first detection image blocks.
[0109] In some embodiments of the present application, since the number of the multiple detection image blocks is greater than or equal to the number of first detection image blocks, the electronic device may determine the difference between the number of all detection image blocks and the number of all first detection image blocks as the target number.
[0110] In this embodiment, since the first detection image block is a partial image block among the multiple detection image blocks, in order to make the size of the generated first detection image the same as the size of the image to be detected, it is necessary to determine the difference between the number of the multiple detection image blocks and the number of the first detection image blocks, so as to provide a basis for subsequently generating the first detection image with the same size as the image to be detected.
[0111] S212: Generate a target number of third detection image blocks according to the first detection image blocks.
[0112] In some embodiments of the present application, the electronic device generates a target number of third detection image blocks based on the first detection image blocks, including: selecting a preset number of first detection image blocks from the first detection image blocks, where the number of selections is the target number, and for each selection of the preset number of first detection image blocks, performing feature fusion on the pixel values of the pixel points at corresponding positions to obtain the target number of third detection image blocks.
[0113] The number of first detection image blocks selected each time may be the same or different.
[0114] In other embodiments, the electronic device may concatenate the selected first detection image blocks along the channel dimension to obtain a third detection image block.
[0115] In this embodiment, for each selected preset number of first detection image blocks, the pixel values of the pixels at the corresponding positions are feature fused to obtain the target number of third detection image blocks, which can ensure that the size of the generated third detection image blocks is the same as the size of each first detection image block. By generating a preset number of third detection image blocks, a basis can be provided for the candidate to generate a first detection image of the same size as the detection image.
[0116] S213: Generate a first detection image according to the first detection image block and the third detection image block.
[0117] In some embodiments of the present application, the electronic device may splice all first detection image blocks and all third detection image blocks into a first detection image having the same size as the detection image. For example, if the size of the detection image is 256*256, the size of the first detection image is also 256*256.
[0118] like Figure 6 , which is a flow chart of an image detection method provided in one embodiment of the present application. Figure 6 The image detection method shown includes dividing the image to be detected into blocks to obtain multiple detection image blocks, using optical character recognition technology to identify the position of text information in the image to be detected, classifying the multiple detection image blocks into detection image blocks including text information and detection image blocks not including text information based on the position, calculating the texture complexity of each detection image block not including text information, and classifying the detection image blocks not including text information into first detection image blocks and second detection image blocks based on the texture complexity. A first detection image is generated according to the first detection image block, and a second detection image is generated according to the detection image block including text information and the second detection image block, a second detection image is generated according to the second detection image block, and feature extraction is performed on the first detection image and the second detection image respectively to obtain a first detection vector and a second detection vector, and the first detection vector and the second detection vector are spliced to obtain a second splicing vector. The second splicing vector is processed to obtain the detection probability that the image to be detected is an AI image and the detection probability that the image to be detected is a non-AI image. If the detection probability that the image to be detected is an AI image is greater than or equal to the detection probability that the image to be detected is a non-AI image, it is determined that the image to be detected is an AI image; or, if the detection probability that the image to be detected is a non-AI image is less than the detection probability that the image to be detected is an AI image, it is determined that the image to be detected is a non-AI image.
[0119] See also Fig. 7A , Fig. 7A 1 is a schematic diagram of the structure of the data processing device provided in the first embodiment of the present application, which can implement the details of the data processing method in the above embodiment and achieve the same effect. Fig. 7AAs shown, the data processing method device 70 can be run on an electronic device with a data processing function, and the device 70 includes:
[0120] The blocking module 701 is used to block the sample image to obtain sample image blocks including text information and sample image blocks not including text information.
[0121] The generating module 702 is used to generate a first sample image and a second sample image based on the sample image block and the texture complexity of the sample image block, wherein the first sample image does not include text information, and the second sample image includes text information.
[0122] In some embodiments of the present application, the generation module 702 is further used to determine a threshold value based on the texture complexity of the sample image block that does not include text information, classify the sample image block that does not include text information into a first sample image block and a second sample image block, wherein the texture complexity of the first sample image block is greater than or equal to the threshold value, and the texture complexity of the second sample image block is less than the threshold value, generate the first sample image based on the first sample image block, and generate the second sample image based on the sample image block that includes text information and the second sample image block.
[0123] In some embodiments of the present application, the generation module 702 is further used to determine a target number based on the number of multiple sample image blocks obtained by dividing the sample image and the number of the first sample image blocks, generate the target number of third sample image blocks based on the first sample image blocks, and generate the first sample image based on the first sample image blocks and the third sample image blocks.
[0124] In some embodiments of the present application, the generation module 702 is further used to select a preset number of first sample image blocks from the first sample image blocks, where the number of selections is the target number, and for each selection of the preset number of first sample image blocks, feature fusion is performed on the pixel values of the pixel points at corresponding positions to obtain the target number of third sample image blocks.
[0125] The feature extraction module 703 is used to extract features from the first sample image and the second sample image to obtain a first feature vector of the first sample image and a second feature vector of the second sample image, and to discard features of a preset proportion in the second feature vector to obtain a third feature vector.
[0126] The splicing module 704 is configured to splice the first feature vector and the third feature vector to obtain a first splicing vector, and obtain a classification probability that the sample image is an AI image according to the first splicing vector.
[0127] In some embodiments of the present application, the device 70 further includes a processing module ( Fig. 7A (not shown), the processing module is used to use the classification layer in the image detection model to process the first splicing vector to obtain the classification probability that the sample image is an AI image.
[0128] The determination module 705 is used to determine the loss value according to the classification probability and the category label of the sample image.
[0129] The adjustment module 706 is used to adjust the parameters of the image detection model according to the loss value.
[0130] See also Figure 7B , Figure 7B 1 is a schematic diagram of the structure of an image detection device provided in an embodiment of the present application, which can implement the details of the image detection method in the above embodiment and achieve the same effect. Figure 7B As shown, the image detection method device 71 can be run on an electronic device with an image detection function, and the device 71 includes:
[0131] The block division module 711 is used to divide the image to be detected into blocks to obtain detection image blocks including text information and detection image blocks excluding text information.
[0132] The generating module 712 is used to generate a first detection image and a second detection image based on the detection image block and the texture complexity of the detection image block, wherein the first detection image does not include text information, and the second detection image includes text information.
[0133] The feature extraction module 713 is used to extract features from the first detection image and the second detection image through an image detection model to obtain a first detection vector and a second detection vector. The image detection model is obtained through the data processing method.
[0134] The stitching module 714 is used to stitch the first detection vector and the second detection vector to obtain a second stitching vector, and obtain a detection probability that the image to be detected is the AI image according to the second stitching vector.
[0135] The determination module 715 is used to determine whether the image to be detected is the AI image according to the detection probability.
[0136] like Figure 8 , which is a schematic diagram of the structure of an electronic device provided by an embodiment of the present application. Figure 8In the embodiment, the electronic device 10 includes but is not limited to: a radio frequency unit 101, a network module 102, an audio output unit 103, an input unit 104, a sensor 105, a display unit 106, a user input unit 107, an interface unit 108, a memory 109, a processor 110, and a power supply 111. Those skilled in the art can understand that Figure 8 The structure of the electronic device 10 shown in the figure does not constitute a limitation on the electronic device, and the electronic device may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently. In the embodiment of the present application, the electronic device includes but is not limited to a mobile phone, a tablet computer, a laptop computer, a PDA, a vehicle-mounted terminal, a server, a wearable device, and a pedometer.
[0137] Among them, the processor 110 is used to: divide the sample image into blocks to obtain sample image blocks including text information and sample image blocks not including text information, generate a first sample image and a second sample image based on the sample image blocks and the texture complexity of the sample image blocks, the first sample image does not include text information, and the second sample image includes text information; perform feature extraction on the first sample image and the second sample image to obtain a first feature vector of the first sample image and a second feature vector of the second sample image, and discard a preset proportion of features in the second feature vector to obtain a third feature vector; splice the first feature vector and the third feature vector to obtain a first splicing vector, and obtain the classification probability that the sample image is an AI image according to the first splicing vector; determine a loss value according to the classification probability and the category label of the sample image, and adjust the parameters of the image detection model according to the loss value.
[0138] In one embodiment, the processor 110 is also used to: divide the image to be detected into blocks to obtain detection image blocks including text information and detection image blocks not including text information, generate a first detection image and a second detection image based on the detection image blocks and the texture complexity of the detection image blocks, the first detection image does not include text information, and the second detection image includes text information; perform feature extraction on the first detection image and the second detection image through an image detection model to obtain a first detection vector and a second detection vector, and the image detection model is obtained through the data processing method; splice the first detection vector and the second detection vector to obtain a second splicing vector, and obtain the detection probability that the image to be detected is the AI image according to the second splicing vector; and determine whether the image to be detected is the AI image according to the detection probability.
[0139] The embodiment of the present application also has the same Figure 1-Figure 6 The same beneficial technical effects as those of the illustrated embodiments are not described in detail here.
[0140] It should be understood that in the embodiment of the present application, the RF unit 101 can be used for receiving and sending signals during information transmission or calls. Specifically, after receiving downlink data from the base station, it is sent to the processor 110 for processing; in addition, uplink data is sent to the base station. Generally, the RF unit 101 includes but is not limited to an antenna, at least one amplifier, a transceiver, a coupler, a low noise amplifier, a duplexer, etc. In addition, the RF unit 101 can also communicate with the network and other devices through a wireless communication system.
[0141] The electronic device 10 provides users with wireless broadband Internet access through the network module 102, such as helping users to send and receive emails, browse web pages, and access streaming media.
[0142] The audio output unit 103 can convert the audio data received by the RF unit 101 or the network module 102 or stored in the memory 109 into an audio signal and output it as sound. Moreover, the audio output unit 103 can also provide audio output related to a specific function performed by the electronic device 10 (for example, a call signal reception sound, a message reception sound, etc.). The audio output unit 103 includes a speaker, a buzzer, a receiver, etc.
[0143] The input unit 104 is used to receive audio or video signals. The input unit 104 may include a graphics processor (GPU) 1041 and a microphone 1042, and the graphics processor 1041 processes the image data of a static picture or video obtained by an image capture device (such as a camera) in a video capture mode or an image capture mode. The processed image frame can be displayed on the display unit 106. The image frame processed by the graphics processor 1041 can be stored in the memory 109 (or other storage medium) or sent via the radio frequency unit 101 or the network module 102. The microphone 1042 can receive sound and can process such sound into audio data. The processed audio data can be converted into a format output that can be sent to a mobile communication base station via the radio frequency unit 101 in the case of a telephone call mode.
[0144] The electronic device 10 also includes at least one sensor 105, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor includes an ambient light sensor and a proximity sensor, wherein the ambient light sensor can adjust the brightness of the display panel 1061 according to the brightness of the ambient light, and the proximity sensor can turn off the display panel 1061 and / or the backlight when the electronic device 10 is moved to the ear. As a type of motion sensor, the accelerometer sensor can detect the magnitude of acceleration in each direction (generally three axes), and can detect the magnitude and direction of gravity when stationary, which can be used to identify the posture of the electronic device 10 (such as horizontal and vertical screen switching, related games, magnetometer posture calibration), vibration recognition related functions (such as pedometer, tapping), etc.; the sensor 105 can also include a fingerprint sensor, a pressure sensor, an iris sensor, a molecular sensor, a gyroscope, a barometer, a hygrometer, a thermometer, an infrared sensor, etc., which will not be repeated here.
[0145] The display unit 106 is used to display information input by the user or information provided to the user. The display unit 106 may include a display panel 1061, which may be configured in the form of a liquid crystal display (LCD), an organic light-emitting diode (OLED), or the like.
[0146] The user input unit 107 can be used to receive input digital or character information, and to generate key signal input related to the user settings and function control of the electronic device 10. Specifically, the user input unit 107 includes a touch panel 1071 and other input devices 1072. The touch panel 1071, also known as a touch screen, can collect the user's touch operation on or near it (such as the user's operation on the touch panel 1071 or near the touch panel 1071 using any suitable object or accessory such as a finger, stylus, etc.). The touch panel 1071 may include two parts: a touch detection device and a touch controller. Among them, the touch detection device detects the user's touch orientation, detects the signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts it into the contact point coordinates, and then sends it to the processor 110, receives the command sent by the processor 110 and executes it. In addition, the touch panel 1071 can be implemented in various types such as resistive, capacitive, infrared and surface acoustic waves. In addition to the touch panel 1071, the user input unit 107 may also include other input devices 1072. Specifically, other input devices 1072 may include, but are not limited to, a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, and a joystick, which are not described in detail here.
[0147] Furthermore, the touch panel 1071 may be overlaid on the display panel 1061. When the touch panel 1071 detects a touch operation on or near it, it transmits the information to the processor 110 to determine the type of the touch event. Then, the processor 110 provides a corresponding visual output on the display panel 1061 according to the type of the touch event. Figure 8 In the figure, the touch panel 1071 and the display panel 1061 are two independent components to realize the input and output functions of the electronic device 10, but in some embodiments, the touch panel 1071 and the display panel 1061 can be integrated to realize the input and output functions of the electronic device 10, which is not limited here.
[0148] The interface unit 108 is an interface for connecting an external device to the electronic device 10. For example, the external device may include a wired or wireless headset port, an external power supply (or battery charger) port, a wired or wireless data port, a memory card port, a port for connecting a device with an identification module, an audio input / output (I / O) port, a video I / O port, a headphone port, etc. The interface unit 108 may be used to receive input (e.g., data information, power, etc.) from an external device and transmit the received input to one or more elements within the electronic device 10 or may be used to transmit data between the electronic device 10 and an external device.
[0149] The memory 109 can be used to store software programs and various data. The memory 109 can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system 1091, an application 1092 required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area can store data created according to the use of the electronic device 10 (such as audio data, a phone book, etc.), etc. In addition, the memory 109 can include a high-speed random access memory, and can also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.
[0150] The processor 110 is the control center of the electronic device. It uses various interfaces and lines to connect various parts of the entire electronic device 10. By running or executing software programs and / or modules stored in the memory 109 and calling data stored in the memory 109, it executes various functions of the electronic device 10 and processes data, thereby monitoring the electronic device 10 as a whole. The processor 110 may include one or more processing units; preferably, the processor 110 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface, and application programs, and the modem processor mainly processes wireless communications. It is understandable that the above-mentioned modem processor may not be integrated into the processor 110.
[0151] The electronic device 10 may also include a power supply 111 (such as a battery) for supplying power to various components. Preferably, the power supply 111 may be logically connected to the processor 110 via a power management system, thereby implementing functions such as charging, discharging, and power consumption management through the power management system.
[0152] Preferably, an embodiment of the present application also provides an electronic device, including a processor 110, a memory 109, and a computer program stored in the memory 109 and executable on the processor 110. When the computer program is executed by the processor 110, the computer program implements the various processes of the above-mentioned data processing method embodiment or the various processes of the above-mentioned image detection method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0153] It is to be understood that the structure illustrated in the embodiments of the present application does not constitute a specific limitation on the electronic device. In other embodiments of the present application, the electronic device may include more or fewer components than shown in the figure, or combine certain components, or split certain components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.
[0154] The embodiment of the present application also provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the above-mentioned data processing method or each process of each process of the image detection method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it is not repeated here. Among them, the computer-readable storage medium is such as a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk, etc.
[0155] The embodiment of the present application provides a computer program product or a computer program, which includes computer instructions stored in a computer-readable storage medium. The processor of the electronic device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the electronic device performs the above-mentioned data processing method or image detection method of the embodiment of the present application.
[0156] 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.
[0157] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the methods described in each embodiment of the present application.
[0158] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.
Claims
1. A data processing method, characterized in that: The method comprises: Divide the sample image into blocks to obtain sample image blocks including text information and sample image blocks not including text information, and generate a first sample image and a second sample image based on the sample image blocks and the texture complexity of the sample image blocks, wherein the first sample image does not include text information and the second sample image includes text information; Performing feature extraction on the first sample image and the second sample image to obtain a first feature vector of the first sample image and a second feature vector of the second sample image, and discarding features of a preset proportion in the second feature vector to obtain a third feature vector; splicing the first eigenvector and the third eigenvector to obtain a first splicing vector, and obtaining a classification probability that the sample image is an AI image according to the first splicing vector; A loss value is determined according to the classification probability and the category label of the sample image, and parameters of the image detection model are adjusted according to the loss value.
2. The data processing method according to claim 1, characterized in that: The method further comprises: Determining a threshold value according to the texture complexity of the sample image block not including text information; The sample image block not including text information is classified into a first sample image block and a second sample image block, wherein the texture complexity of the first sample image block is greater than or equal to the threshold, and the texture complexity of the second sample image block is less than the threshold.
3. The data processing method according to claim 2, characterized in that: The generating of the first sample image and the second sample image based on the sample image block and the texture complexity of the sample image block comprises: The first sample image is generated according to the first sample image block, and the second sample image is generated according to the sample image block including the text information and the second sample image block.
4. The data processing method according to claim 3, characterized in that: The generating the first sample image according to the first sample image block comprises: Determining a target number based on the number of a plurality of sample image blocks obtained by dividing the sample image into blocks and the number of the first sample image blocks; Generating the target number of third sample image blocks according to the first sample image blocks; The first sample image is generated according to the first sample image block and the third sample image block.
5. The data processing method according to claim 4, characterized in that: The image sizes of the multiple sample image blocks are the same, and the step of generating the target number of third sample image blocks according to the first sample image blocks includes: Selecting a preset number of first sample image blocks from the first sample image blocks, wherein the number of selections is the target number; For the preset number of first sample image blocks selected each time, feature fusion is performed on pixel values of pixel points at corresponding positions to obtain the target number of third sample image blocks.
6. The data processing method according to claim 1, characterized in that: The obtaining, according to the first splicing vector, a classification probability that the sample image is an AI image includes: The first splicing vector is processed by using the classification layer in the image detection model to obtain a classification probability that the sample image is an AI image.
7. An image detection method, characterized in that: The method comprises: Divide the image to be detected into blocks to obtain detection image blocks including text information and detection image blocks not including text information, and generate a first detection image and a second detection image based on the detection image blocks and the texture complexity of the detection image blocks, wherein the first detection image does not include text information and the second detection image includes text information; Performing feature extraction on the first detection image and the second detection image by using an image detection model to obtain a first detection vector and a second detection vector, wherein the image detection model is obtained by the data processing method according to any one of claims 1 to 6; Splicing the first detection vector and the second detection vector to obtain a second splicing vector, and obtaining a detection probability that the image to be detected is the AI image according to the second splicing vector; According to the detection probability, it is determined whether the image to be detected is the AI image.
8. An electronic device, characterized in that: The electronic device includes: a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the data processing method as described in any one of claims 1 to 6, or implements the image detection method as described in claim 7.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the data processing method according to any one of claims 1 to 6 is implemented, or the image detection method according to claim 7 is implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the computer program implements the data processing method according to any one of claims 1 to 6, or implements the image detection method according to claim 7.
Citation Information
Patent Citations
A Dropout regularization method based on the sensitivity of activation values
CN107895170A
Multi-mode and adversarial learning-based multi-task target detection and identification method and device
CN114821014A
Model determination method and related device
CN116958627A
Computer implemented system for handling text distracters in a visual search
US20150186421A1
