Image detection method and device, computer equipment and readable storage medium
By segmenting the image into multiple blocks and using a classifier model for local feature detection, the problem of low image detection accuracy in the prior art is solved, and high accuracy recognition of local detailed forged images is achieved, reducing the cause of forgery Economic losses caused by images.
Patent Information
- Application Number
- CN202411241761.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-04
- Publication Date
- 2024-12-03
AI Technical Summary
The existing AI image detection methods are not accurate when detecting locally detailed forged images, and cannot effectively identify and reject forged images, resulting in increased economic losses in the financial and medical industries.
By segmenting the target business image into multiple image blocks and inputting each image block into the trained classifier model for category prediction, the category prediction value of each image block is obtained, and finally the total prediction value of the image is determined based on these values. , determine whether the image is a real image. This method uses a classifier model with a finite receptive field, focusing on the local features of the image rather than the global semantics, thereby improving detection accuracy.
It significantly improves the accuracy of detection of locally detailed forged images, and can more accurately judge the authenticity of images, thereby reducing economic losses caused by fraud and improving industry stability.
Smart Images

Figure CN119067954A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and in particular to an image detection method, apparatus, computer device and readable storage medium. Background Art
[0002] In the financial industry (such as insurance, banking) and the medical industry, with the development of technology, the threat of insurance fraud is increasing. By detecting and rejecting insurance policy applications using forged images, the economic losses caused by fraud can be greatly reduced and the stability of the entire related industry can be improved. At present, in related technologies, AI (Artificial Intelligence) image detection methods are usually used to detect whether an image is a forged image, but the accuracy is not high.
[0003] Therefore, how to improve the accuracy of detecting the authenticity of images becomes an urgent problem to be solved. Summary of the invention
[0004] The present application provides an image detection method, apparatus, computer device and readable storage medium, which can effectively improve the accuracy of detecting the authenticity of an image.
[0005] In a first aspect, the present application provides an image detection method, the method comprising:
[0006] Acquire a target service image to be detected, and divide the target service image into a plurality of image blocks;
[0007] Inputting each of the image blocks into the trained classifier model for category prediction to obtain a category prediction value corresponding to each of the image blocks;
[0008] Determining a total category prediction value of the target service image according to the category prediction values corresponding to all the image blocks;
[0009] According to the total predicted value of the category of the target business image, it is determined whether the target business image is a real business image.
[0010] In a second aspect, the present application further provides an image detection device, the image detection device comprising:
[0011] An image segmentation module is used to obtain a target service image to be detected and segment the target service image into multiple image blocks;
[0012] A category prediction module, used to input each of the image blocks into a trained classifier model for category prediction, to obtain a category prediction value corresponding to each of the image blocks;
[0013] A prediction value determination module, used to determine the total prediction value of the category of the target business image according to the category prediction values corresponding to all the image blocks;
[0014] The authenticity judgment module is used to determine whether the target business image is a real business image according to the total predicted value of the category of the target business image.
[0015] In a third aspect, the present application further provides a computer device, the computer device comprising a memory and a processor;
[0016] The memory is used to store computer programs;
[0017] The processor is used to execute the computer program and implement the above-mentioned image detection method when executing the computer program.
[0018] In a fourth aspect, the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the processor implements the image detection method as described above.
[0019] The present application discloses an image detection method, apparatus, computer equipment and readable storage medium, the image detection method comprising: dividing the target business image into a plurality of image blocks; inputting each of the image blocks into a trained classifier model for category prediction, and obtaining a category prediction value corresponding to each of the image blocks; determining the total category prediction value of the target business image according to the category prediction values corresponding to all of the image blocks; and determining whether the target business image is a real business image according to the total category prediction value of the target business image. The embodiment of the present application divides the target business image into a plurality of image blocks, and inputs each of the image blocks into a trained classifier model for category prediction, and obtains a category prediction value corresponding to each of the image blocks. This can achieve the use of a classifier model with a limited receptive field to focus on local features in the target business image, rather than focusing on the global semantics of the business image, thereby improving the accuracy of detecting locally detailed forged business images. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] 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 will be briefly introduced below. Obviously, the drawings described below are 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 work.
[0021] Figure 1 is a structural schematic diagram of a computer device provided in an embodiment of the present application;
[0022] Figure 2 is a schematic flow chart of an image detection method provided in an embodiment of the present application;
[0023] Figure 3 is a schematic flow chart of a training classifier model provided in an embodiment of the present application;
[0024] Figure 4 is a schematic flowchart of sub-steps for obtaining a business sample image provided by an embodiment of the present application;
[0025] Figure 5 is a schematic flow chart of sub-steps of training a classifier model provided in an embodiment of the present application;
[0026] Figure 6 is a schematic flow chart of another image detection method provided in an embodiment of the present application;
[0027] Figure 7 is a schematic flow chart of another image detection method provided in an embodiment of the present application;
[0028] Figure 8 It is a schematic block diagram of an image detection device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0029] 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.
[0030] The flowcharts shown in the accompanying drawings are only examples and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps may also be decomposed, combined or partially merged, so the actual execution order may change according to actual conditions.
[0031] It should be understood that the terms used in this application specification are only for the purpose of describing specific embodiments and are not intended to limit the application. As used in this application specification and the appended claims, unless the context clearly indicates otherwise, the singular forms "a", "an" and "the" are intended to include plural forms.
[0032] It should also be understood that the term “and / or” used in the specification and appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.
[0033] At present, in the relevant technology, AI (Artificial Intelligence) image detection methods are usually used to detect whether an image is a forged image or a false image. However, the existing AI image detection methods usually focus on the global semantics of the image, and do not focus on locally and finely forged images. Therefore, when faced with locally and finely forged business images, the accuracy of the existing AI image detection methods in checking whether the image is a forged image is not high.
[0034] To this end, the embodiments of the present application provide an image detection method, apparatus, computer equipment and readable storage medium. The image detection method can be applied to a computer device, by dividing a target business image into multiple image blocks, inputting each image block into a trained classifier model for category prediction, and obtaining a category prediction value corresponding to each image block, so as to achieve the use of a classifier model with a limited receptive field to focus on local features in the target business image, rather than focusing on the global semantics of the business image, thereby improving the accuracy of detecting locally detailed forged business images.
[0035] Exemplarily, the computer device can be a server or a terminal. The server can be an independent server or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDN), and big data and artificial intelligence platforms. The terminal can be an electronic device such as a smartphone, tablet computer, laptop computer, and desktop computer.
[0036] Exemplarily, business images may include, but are not limited to, images containing insurance policies, contracts, certificates, seals, handwritten text, and form contents.
[0037] See also Figure 1 , Figure 1 1 is a schematic diagram of a computer device provided in an embodiment of the present application. The computer device may include a processor and a memory, wherein the processor and the memory may be connected via a bus, and the bus may be any applicable bus such as an Inter-integrated Circuit (I2C) bus.
[0038] The memory may include a storage medium and an internal memory. The storage medium may be a non-volatile storage medium or a volatile storage medium. The storage medium may store an operating system and a computer program, and the internal memory provides an environment for the operation of the computer program in the storage medium. The computer program includes program instructions, and when the program instructions are executed, the processor may execute the image detection method described in any embodiment.
[0039] The processor is used to provide computing and control capabilities and support the operation of the entire computer equipment.
[0040] The processor may be a central processing unit (CPU), a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor, or any conventional processor.
[0041] In one embodiment, the processor is used to run a computer program stored in the memory to implement the following steps:
[0042] Obtain a target business image to be detected, and divide the target business image into multiple image blocks; input each image block into a trained classifier model for category prediction to obtain a category prediction value corresponding to each image block; determine the total category prediction value of the target business image based on the category prediction values corresponding to all image blocks; and determine whether the target business image is a real business image based on the total category prediction value of the target business image.
[0043] In one embodiment, before inputting each image block into the trained classifier model for category prediction to obtain the category prediction value corresponding to each image block, the processor is further configured to implement:
[0044] A preset number of sample images are obtained, where the sample images include a real first business sample image and a non-real second business sample image; image training data is determined based on the first business sample image and the second business sample image; an initial classifier model is trained according to the image training data until convergence, to obtain a trained classifier model.
[0045] In one embodiment, when acquiring a preset number of sample images, the processor is used to implement:
[0046] Determine a business image corresponding to at least one business scenario as a first business sample image; construct an image based on the first business sample image, and determine the constructed business image as a second business sample image; and generate a sample image based on the first business sample image and the second business sample image.
[0047] In one embodiment, when implementing image construction according to the first service sample image, the processor is used to implement:
[0048] The first service sample image is input into a preset self-encoding model for image construction to obtain a constructed service image, wherein the self-encoding model is used to modify the content of at least a portion of the first service sample image.
[0049] In one embodiment, when the processor determines the image training data according to the first service sample image and the second service sample image, the processor is used to implement:
[0050] The first business sample image is divided into a plurality of first image blocks, and a block index and a category label of each first image block are determined; the second business sample image is divided into a plurality of second image blocks, and a block index and a category label of each second image block are determined; the block index, category label and each first image block of each first image block, as well as the block index, category label and each second image block of each second image block are used to generate image training data.
[0051] In one embodiment, when the processor trains the initial classifier model according to the image training data until convergence to obtain the trained classifier model, it is used to implement:
[0052] The image blocks corresponding to each business sample image in the image training data are determined as the training data for each round in turn; the image blocks in the current round of training data are respectively input into the initial classifier model for category prediction training to obtain the category prediction value corresponding to each image block; the loss function value is calculated according to the category prediction value and category label corresponding to each image block to obtain the loss function value corresponding to each image block; the loss function value of the corresponding business sample image in this round of training is determined according to the loss function value and block index corresponding to each image block; if the loss function value is greater than the preset loss function threshold, the parameters of the classifier model are adjusted, and the next round of training is carried out until the loss function value obtained is less than or equal to the loss function threshold, the training is terminated, and the trained classifier model is obtained.
[0053] In one embodiment, after inputting each image block into the trained classifier model for category prediction and obtaining the category prediction value corresponding to each image block, the processor is further used to implement:
[0054] A target image block is marked in the target business image, where the target image block is an image block whose category prediction value is less than a preset value.
[0055] Some embodiments of the present application are described in detail below in conjunction with the accompanying drawings. In the absence of conflict, the following embodiments and features of the embodiments can be combined with each other. Figure 2 , Figure 2 FIG. 1 is a schematic flow chart of an image detection method provided in an embodiment of the present application. Figure 2 As shown, the image detection method may include steps S101 to S104.
[0056] Step S101: Acquire a target service image to be detected, and divide the target service image into multiple image blocks.
[0057] It should be noted that the image detection method in the embodiment of the present application can be applied to scenarios such as applying for insurance business, banking business, medical business, etc. For the sake of convenience, the embodiment of the present application will take the user applying for an insurance policy business as an example to illustrate how to perform authenticity detection on a business image.
[0058] For example, a business image of a user applying for an insurance policy can be determined as a target business image to be detected, wherein there can be one or more target business images. The present application embodiment takes the target business image as one business image as an example for description.
[0059] Exemplarily, the target service image may be divided into a plurality of image blocks. For example, the target service image may be divided into m rows and n columns to obtain P=m×n image blocks.
[0060] Step S102: Input each image block into the trained classifier model for category prediction to obtain a category prediction value corresponding to each image block.
[0061] It should be noted that the classifier model is used to identify the category of the image block, where the category can be real or forged. It is understandable that forgery means that the content in the image block has been tampered with. Exemplarily, the classifier model can be a fully connected neural network model (Fully Connected Neural Network, DNN), of course, it can also be other types of classification models, which is not limited in the embodiments of the present application.
[0062] In some embodiments, each image block can be input into the trained classifier model for category prediction to obtain a category prediction value corresponding to each image block. The category prediction value can be a value within [0,1]. For example, 0 indicates that the category of the image block is real, and 1 indicates that the category of the image block is forged; or, 1 indicates that the category of the image block is real, and 0 indicates that the category of the image block is forged.
[0063] It should be noted that in an embodiment of the present application, each image block can be input into the classifier model for category prediction, rather than inputting the entire target business image into the classifier model for category prediction at one time, so that a classifier with a limited receptive field can be used to focus on local features in the target business image, rather than the global semantics of the target business image.
[0064] In the above embodiment, each image block is input into the trained classifier model for category prediction to obtain the category prediction value corresponding to each image block. This can achieve the use of a classifier model with a limited receptive field to focus on local features in the target business image, rather than focusing on the global semantics of the business image, thereby improving the accuracy of detecting locally detailed forged business images.
[0065] Step S103: Determine the total category prediction value of the target business image according to the category prediction values corresponding to all image blocks.
[0066] Exemplarily, after inputting each image block into the trained classifier model for category prediction and obtaining the category prediction value corresponding to each image block, the total category prediction value of the target business image can be determined based on the category prediction values corresponding to all image blocks.
[0067] In some embodiments, determining the total category prediction value of the target business image based on the category prediction values corresponding to all image blocks may include: determining the total category prediction value as the average of the category prediction values corresponding to all image blocks.
[0068] It should be noted that by determining the average of the category prediction values corresponding to all image blocks as the total category prediction value, the problem of deviation in the category prediction value of a single image block affecting the prediction accuracy can be avoided, thereby effectively improving the accuracy of the prediction.
[0069] Step S104: Determine whether the target business image is a real business image according to the total predicted value of the category of the target business image.
[0070] Exemplarily, after determining the total category prediction value of the target business image according to the category prediction values corresponding to all image blocks, it is possible to determine whether the target business image is a real business image according to the total category prediction value of the target business image. Exemplarily, when 1 indicates that the category of the image block is real and 0 indicates that the category of the image block is forged, if the total category prediction value is greater than or equal to the preset value, the target business image is determined to be a real business image; if the total category prediction value is less than the preset value, the target business image is determined to be a forged business image. Among them, the preset value can be set according to actual conditions, and the specific value is not limited here. For example, the preset value can be 0.5. When the total category prediction value is greater than or equal to 0.5, the target business image can be determined to be a real business image; when the total category prediction value is less than 0.5, the target business image can be determined to be a forged business image.
[0071] It should be noted that a real business image refers to a business image that has not been tampered with, and a forged business image refers to a business image that has been tampered with.
[0072] The above embodiment, by determining whether the target business image is a real business image based on the total predicted value of the category of the target business image, can accurately judge whether the target business image is a real business image or a forged business image, so that when the target business image is a forged business image, the insurance policy business application corresponding to the target business image can be rejected, thereby reducing the economic losses caused by fraudulent activities and improving the stability of the entire insurance industry.
[0073] In the embodiment of the present application, before inputting each image block into the trained classifier model for category prediction and obtaining the category prediction value corresponding to each image block, the classifier model needs to be trained until convergence. The training process of the classifier model is described in detail below.
[0074] See also Figure 3 , Figure 3 is a schematic flow chart of a training classifier model provided in an embodiment of the present application. Figure 3 As shown, it may include steps S201 to S203.
[0075] Step S201: Acquire a preset number of sample images, where the sample images include authentic first business sample images and authentic second business sample images.
[0076] Exemplarily, when training a classifier model, a preset number of sample images may be obtained to train the classifier model, wherein the preset number may be set according to actual conditions, and the specific value is not limited here.
[0077] Exemplarily, the sample image may include a first real business sample image and a second fake business sample image. It should be noted that the first business sample image is a business image that has not been tampered with, and the second business sample image is an image constructed and generated based on the first business sample image, which is equivalent to a forged image.
[0078] See also Figure 4 , Figure 4 FIG. 1 is a schematic flow chart of sub-steps for obtaining a service sample image provided by an embodiment of the present application. Figure 4 As shown, step S201 may include steps S2011 to S2013.
[0079] Step S2011: Determine a business image corresponding to at least one business scenario as a first business sample image.
[0080] It should be noted that in the embodiments of the present application, in order to protect the privacy of users, business images in publicly available data sets can be used under the premise of compliance and ethics. The available data sets can be ImageNet, COCO, etc.
[0081] Exemplarily, a business image corresponding to at least one business scenario may be determined as the first business sample image, wherein the business scenario may include but is not limited to business scenarios such as insurance policies, contracts, and certificates.
[0082] It should be noted that since business images in business scenarios such as insurance policies, contracts, and certificates are more likely to become targets of forgery, by determining the business images corresponding to business scenarios such as insurance policies, contracts, and certificates as the first business sample images, model training can be performed in a targeted manner on these business images that are likely to become targets of forgery, thereby improving the generalization ability of the classifier model and the accuracy of identifying the authenticity of business images.
[0083] Step S2012: construct an image according to the first business sample image, and determine the constructed business image as the second business sample image.
[0084] Exemplarily, an image may be constructed according to the first service sample image, and the constructed service image may be determined as the second service sample image.
[0085] In some embodiments, performing image construction based on the first business sample image may include: inputting the first business sample image into a preset self-encoding model for image construction to obtain a constructed business image, wherein the self-encoding model is used to modify the content of at least a portion of the image in the first business sample image.
[0086] It should be noted that the autoencoder model is a neural network architecture that is mainly used for unsupervised learning and is used for data compression (encoding) and reconstruction (decoding). The autoencoder model consists of two main parts: the encoder and the decoder. The encoder compresses the input data (such as a picture) into a low-dimensional representation (usually called a "latent space" or "latent space"), which contains the main features of the input data. The encoder gradually reduces the dimension of the data through multiple neural network layers. Latent Space Representation: This is a low-dimensional representation of the encoder output, which can be regarded as a compressed version of the input data, retaining the key features of the data while discarding redundant information. The decoder decompresses the low-dimensional representation in the latent space back to the high-dimensional form of the original data, trying to reconstruct the input data. The decoder gradually increases the dimension of the data through multiple neural network layers.
[0087] Exemplarily, the first service sample image can be represented as The second service sample image can be expressed as in,
[0088] It should be noted that the autoencoder model AutoEncoder(·) can achieve local generation, that is, an image block in the first service sample image can be selected to generate the second service sample image. For example, the content of one or more image blocks in the first service sample image can be modified to obtain the second service sample image.
[0089] In the above embodiment, by inputting the first service sample image into a preset self-encoding model for image construction, it is possible to quickly generate a forged second service sample image.
[0090] Step S2013: Generate a sample image according to the first service sample image and the second service sample image.
[0091] Exemplarily, after performing image construction according to the first business sample image and determining the constructed business image as the second business sample image, a sample image may be generated according to the first business sample image and the second business sample image.
[0092] Step S202: Determine image training data according to the first business sample image and the second business sample image.
[0093] In some embodiments, determining image training data based on a first business sample image and a second business sample image may include: segmenting the first business sample image into a plurality of first image blocks, and determining a block index and a category label of each first image block; segmenting the second business sample image into a plurality of second image blocks, and determining a block index and a category label of each second image block; and generating image training data by combining the block index, category label and each first image block of each first image block, and combining the block index, category label and each second image block of each second image block.
[0094] Exemplarily, the first business sample image may be segmented into m×n first image blocks, wherein the block index of the first image block may be (m, n). The first image block and the second image block may be categorized by manual labeling, for example, the category of the first image block may be labeled as 1, indicating authenticity, and the category of the second image block may be labeled as 0, indicating forgery.
[0095] Step S203: Train the initial classifier model according to the image training data until convergence to obtain a trained classifier model.
[0096] Exemplarily, after the image training data is determined according to the first business sample image and the second business sample image, the initial classifier model may be trained according to the image training data until convergence to obtain a trained classifier model.
[0097] See also Figure 5 , Figure 5 is a schematic flow chart of the sub-steps of training a classifier model provided in an embodiment of the present application. Figure 5 As shown, step S203 may include steps S2031 to S2035.
[0098] Step S2031: sequentially determine the image blocks corresponding to each business sample image in the image training data as the training data for each round.
[0099] Exemplarily, the image blocks corresponding to each business sample image in the image training data may be determined in sequence as the training data for each round. For example, the training data for each round may include image blocks corresponding to one or more business sample images.
[0100] Step S2032: input the image blocks in the current round of training data into the initial classifier model for category prediction training to obtain the category prediction value corresponding to each image block.
[0101] For example, the image blocks in the current round of training data can be respectively input into the initial classifier model for category prediction training to obtain the category prediction value corresponding to each image block. The specific process of category prediction can be referred to the relevant technology, and the specific process is not repeated here.
[0102] Step S2033: Calculate the loss function value according to the category prediction value and category label corresponding to each image block to obtain the loss function value corresponding to each image block.
[0103] Exemplarily, after obtaining the category prediction value corresponding to each image block, the loss function value can be calculated based on a preset loss function according to the category prediction value and category label corresponding to each image block to obtain the loss function value corresponding to each image block.
[0104] The loss function may include but is not limited to a 0-1 loss function, an absolute value loss function, a logarithmic loss function, a square loss function, an exponential loss function, etc. For example, based on the absolute value loss function, the loss function value can be calculated according to the category prediction value and the category label corresponding to each image block, and the loss function value of each image block. The specific process of calculating the loss function value can be referred to the relevant technology and will not be described in detail here.
[0105] Step S2034: Determine the loss function value of the corresponding business sample image in this round of training according to the loss function value and block index corresponding to each image block.
[0106] In an embodiment of the present application, not only can the loss function value of each image block be directly determined as the loss function value of this round of training, but the loss function value of the corresponding business sample image in this round of training can also be determined based on the loss function value and block index corresponding to each image block.
[0107] Exemplarily, if the current round is to input the image block corresponding to the A business sample image into the classifier model for category prediction training, the loss function value of the A business sample image in this round of training can be determined based on the loss function value and block index of the image block corresponding to the A business sample image.
[0108] Exemplarily, the loss function for calculating the loss function value of the business sample image in this round of training is as follows:
[0109]
[0110] In the formula, L(X train ) represents the loss function value of the business sample image in this round of training, (m,n) represents the block index of the image block, and f Y (·) represents the classifier model, |P| represents the total number of image blocks of the business sample image; Y represents the vector label, and its value is [0,1] or [1,0]. The specific calculation process of the loss function of the business sample image in this round of training is not described here.
[0111] Step S2035: If the loss function value is greater than the preset loss function threshold, adjust the parameters of the classifier model and perform the next round of training until the loss function value obtained is less than or equal to the loss function threshold. End the training and obtain the trained classifier model.
[0112] Exemplarily, after calculating the loss function value of the corresponding business sample image in this round of training, if the loss function value is greater than a preset loss function threshold, the parameters of the classifier model are adjusted and the next round of training is performed until the loss function value obtained is less than or equal to the loss function threshold. The training is terminated to obtain the trained classifier model.
[0113] The preset loss function threshold can be set according to the actual situation, and the specific value is not limited here. The parameters can be determined according to the type of the specific classifier model, and this application does not limit this.
[0114] The above embodiment generates image training data based on a real first business sample image and a non-real second business sample image, and trains the initial classifier model until convergence based on the image training data. This allows the trained classifier model to use a classifier with a limited receptive field to focus on local features in the business image, which not only improves the generalization ability of the classifier model, but also improves the accuracy of the classifier model in detecting the category of the business image.
[0115] See also Figure 6 , Figure 6 FIG. 1 is a schematic flow chart of another image detection method provided in an embodiment of the present application. Figure 6 As shown, the following steps S301 to S303 may be included.
[0116] Step S301: Acquire a target service image to be detected, and divide the target service image into multiple image blocks.
[0117] Step S302: Input each image block into the trained classifier model for category prediction to obtain a category prediction value corresponding to each image block.
[0118] It can be understood that steps S301 to S302 are the same as the above-mentioned steps S101 to S102, and are not described in detail here.
[0119] Step S303: Mark a target image block in the target business image, where the target image block is an image block whose category prediction value is less than a preset value.
[0120] Exemplarily, after obtaining the category prediction value corresponding to each image block in the target business image, the image block whose category prediction value is less than the preset value can be marked at the corresponding position of the target business image. The preset value can be set according to the actual situation, and the specific value is not limited here. It should be noted that when 1 indicates that the category of the image block is real and 0 indicates that the category of the image block is forged, the smaller the category prediction value of the image block, the more likely the image block is to be the location where tampering has occurred.
[0121] In the above embodiment, by marking the target image block in the target service image, the user can timely and conveniently determine the position in the target service image where tampering may occur.
[0122] See also Figure 7 , Figure 7 FIG. 1 is a schematic flow chart of another image detection method provided in an embodiment of the present application. Figure 7 As shown, the following steps S401 to S403 may be included.
[0123] Step S401: Acquire a target service image to be detected, and divide the target service image into multiple image blocks.
[0124] Step S402: Input each image block into the trained classifier model for category prediction to obtain a category prediction value corresponding to each image block.
[0125] It can be understood that step S401 to step S402 are the same as the above-mentioned step S101 to step S102, and are not described in detail here.
[0126] Step S403: draw a heat map of the target business image according to the category prediction value corresponding to each image block, wherein image blocks corresponding to different category prediction values have different colors.
[0127] It should be noted that heat map drawing refers to displaying different colors on the business image according to different category prediction values.
[0128] Exemplarily, a heat map may be drawn on the target business image according to the category prediction value corresponding to each image block, wherein in the target business image after the heat map is drawn, image blocks corresponding to different category prediction values have different colors.
[0129] Exemplarily, when the category prediction value of the image block in the target business image changes from large to small (1 to 0), the color gradually changes from cold color (blue) to warm color (red), wherein the warmer (the redder) the color, the higher the possibility that the area is considered to be tampered with. Alternatively, when the category prediction value of the image block in the target business image changes from large to small (1 to 0), the color gradually changes from warm color (red) to cold color (blue), wherein the colder (the bluer) the color, the higher the possibility that the area is considered to be tampered with.
[0130] In the above embodiment, by drawing a heat map of the target business image according to the category prediction value corresponding to each image block, the user can quickly identify the specific location where tampering may occur in the target business image by observing the area of color change on the heat map, thereby improving the user experience.
[0131] See also Figure 8 , Figure 8 1 is a schematic block diagram of an image detection device 1000 provided in an embodiment of the present application, wherein the image detection device 1000 is used to execute the aforementioned image detection method. The image detection device 1000 may be configured in a computer device.
[0132] like Figure 8 As shown, the image detection device 1000 includes: an image segmentation module 1001, a category prediction module 1002, a prediction value determination module 1003 and an authenticity judgment module 1004.
[0133] The image segmentation module 1001 is used to obtain a target service image to be detected and segment the target service image into multiple image blocks.
[0134] The category prediction module 1002 is used to input each image block into the trained classifier model for category prediction to obtain a category prediction value corresponding to each image block.
[0135] The prediction value determination module 1003 is used to determine the total category prediction value of the target business image according to the category prediction values corresponding to all image blocks.
[0136] The authenticity judgment module 1004 is used to determine whether the target business image is a real business image according to the total predicted value of the category of the target business image.
[0137] It should be noted that those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the above-described device and each module can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.
[0138] A computer-readable storage medium is also provided in an embodiment of the present application. The computer-readable storage medium stores a computer program. The computer program includes program instructions. The processor executes the program instructions to implement any image detection method provided in the embodiment of the present application.
[0139] For example, the program is loaded by the processor and may execute the following steps:
[0140] Obtain a target business image to be detected, and divide the target business image into multiple image blocks; input each image block into a trained classifier model for category prediction to obtain a category prediction value corresponding to each image block; determine the total category prediction value of the target business image based on the category prediction values corresponding to all image blocks; and determine whether the target business image is a real business image based on the total category prediction value of the target business image.
[0141] The computer-readable storage medium may be an internal storage unit of the computer device of the aforementioned embodiment, such as a hard disk or memory of the computer device. The computer-readable storage medium may also be an external storage device of the computer device, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital card (Secure Digital Card, SD Card), a flash card (Flash Card), etc. equipped on the computer device.
[0142] Furthermore, the computer-readable storage medium may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function, etc.; the data storage area may store data created according to the use of the blockchain node, etc.
[0143] The blockchain referred to in this application is a new application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, encryption algorithm, etc. Blockchain is essentially a decentralized database, a string of data blocks generated by cryptographic methods. Each data block contains a batch of network transaction information, which is used to verify the validity of its information (anti-counterfeiting) and generate the next block. Blockchain can include the underlying blockchain platform, platform product service layer, and application service layer.
[0144] The above are only specific implementations of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed in the present application, and these modifications or replacements should be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be based on the protection scope of the claims.
Claims
1. An image detection method, characterized in that: include: Acquire a target service image to be detected, and divide the target service image into a plurality of image blocks; Inputting each of the image blocks into the trained classifier model for category prediction to obtain a category prediction value corresponding to each of the image blocks; Determining a total category prediction value of the target service image according to the category prediction values corresponding to all the image blocks; According to the total predicted value of the category of the target business image, it is determined whether the target business image is a real business image.
2. The image detection method according to claim 1, characterized in that: Before inputting each of the image blocks into the trained classifier model for category prediction to obtain the category prediction value corresponding to each of the image blocks, the method further includes: Acquire a preset number of sample images, where the sample images include authentic first business sample images and authentic second business sample images; Determining image training data according to the first service sample image and the second service sample image; The initial classifier model is trained according to the image training data until convergence to obtain a trained classifier model.
3. The image detection method according to claim 2, characterized in that: The step of obtaining a preset number of sample images includes: Determining a business image corresponding to at least one business scenario as the first business sample image; Performing image construction according to the first service sample image, and determining the constructed service image as the second service sample image; The sample image is generated according to the first service sample image and the second service sample image.
4. The image detection method according to claim 3, characterized in that: The constructing an image according to the first service sample image includes: The first service sample image is input into a preset autoencoding model for image construction to obtain a constructed service image, wherein the autoencoding model is used to modify the content of at least a portion of the first service sample image.
5. The image detection method according to claim 2, characterized in that: The determining of image training data according to the first service sample image and the second service sample image includes: Segmenting the first service sample image into a plurality of first image blocks, and determining a block index and a category label of each of the first image blocks; Segmenting the second service sample image into a plurality of second image blocks, and determining a block index and a category label of each of the second image blocks; The image training data is generated by combining a block index, a category label and each of the first image blocks, and a block index, a category label and each of the second image blocks.
6. The image detection method according to claim 5, characterized in that: The initial classifier model is trained according to the image training data until convergence to obtain a trained classifier model, comprising: Sequentially determining the image blocks corresponding to each business sample image in the image training data as training data for each round; Inputting the image blocks in the training data of the current round into the initial classifier model for category prediction training respectively, and obtaining the category prediction value corresponding to each image block; Calculate the loss function value according to the category prediction value and the category label corresponding to each of the image blocks to obtain the loss function value corresponding to each of the image blocks; Determine the loss function value of the corresponding business sample image in this round of training according to the loss function value and the block index corresponding to each of the image blocks; If the loss function value is greater than the preset loss function threshold, the parameters of the classifier model are adjusted and the next round of training is performed until the loss function value obtained is less than or equal to the loss function threshold. The training is terminated to obtain the trained classifier model.
7. The image detection method according to claim 1, characterized in that: After inputting each of the image blocks into the trained classifier model for category prediction and obtaining the category prediction value corresponding to each of the image blocks, the method further includes: A target image block is marked in the target business image, where the target image block is an image block whose category prediction value is less than a preset value.
8. An image detection device, characterized in that: include: An image segmentation module is used to obtain a target service image to be detected and segment the target service image into multiple image blocks; A category prediction module, used to input each of the image blocks into a trained classifier model for category prediction, to obtain a category prediction value corresponding to each of the image blocks; A prediction value determination module, used to determine the total prediction value of the category of the target business image according to the category prediction values corresponding to all the image blocks; The authenticity judgment module is used to determine whether the target business image is a real business image according to the total predicted value of the category of the target business image.
9. A computer device, characterized in that: The computer device includes a memory and a processor; The memory is used to store computer programs; The processor is used to execute the computer program and implement the image detection method according to any one of claims 1 to 7 when executing the computer program.
10. 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 processor implements the image detection method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Image tampering detection method and apparatus
CN106846303A
Method and device for displaying data information association relation by using colors
CN106874324A
Image tamper detection method, electronic device and readable storage medium
CN107657259A
Double-flow network image forgery detection method and system based on image block feature extraction
CN113361474A
Certificate identification model training method, certificate identification method, certificate identification system, certificate identification equipment and medium
CN114118412A
Cited By
Electricity consumption abnormity detection method, device and equipment for electricity consumption park, and medium
CN121095636A
