False image detection method and related apparatus
By combining multilayer perceptron and support vector machine classifiers and using a target feature encoding model to extract image features, the problem of insufficient adaptability of existing fake image detection to new forgery techniques is solved, and fake image detection with high accuracy and generalization ability is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- BEIJING REALAI TECH CO LTD
- Filing Date
- 2024-08-23
- Publication Date
- 2026-07-21
AI Technical Summary
Existing fake image detection methods show a significant decline in detection performance when faced with new forgery techniques, lacking generalization and adaptability, resulting in low accuracy.
A classifier combining multilayer perceptron and support vector machine is used. Image features are extracted through a target feature encoding model, and a multilayer perceptron classification model is used to handle known forgery methods, while a support vector machine classification model is used to handle unknown forgery methods. The final classification result is determined by combining the results of both.
It improves the accuracy of fake image detection, maintains high detection performance, especially when facing new forgery techniques, reduces the risk of overfitting, and enhances the model's adaptability and generalization ability.
Smart Images

Figure CN118711046B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of artificial intelligence, and more specifically to a method and related apparatus for detecting fake images. Background Technology
[0002] With the rapid development of generative artificial intelligence (AI) technology, the editing of multimedia content such as images has become increasingly convenient and efficient. However, like a double-edged sword, while generative AI greatly enriches the possibilities of creative expression, it also gives rise to a series of risks and challenges that cannot be ignored, especially the increasingly prominent issues of information authenticity and misleading information. This type of technology could be maliciously used to generate fake or misleading images. Currently, mainstream fake image detection methods mainly rely on deep learning technology to learn discriminative features from large-scale labeled data to distinguish between real and fake images. First, real images need to be collected and cleaned from the internet. Then, a large number of realistic fake image samples are created based on various known image forgery algorithms or software. Finally, a deep learning classification model is trained based on the constructed dataset to distinguish between real and fake images. However, while this approach demonstrates excellent detection performance for known forgery methods, its detection performance significantly decreases when dealing with data generated by new and unseen forgery techniques. This is because deep learning models often overfit to patterns in the training data, lacking sufficient generalization and adaptability once a new forgery method emerges. Therefore, the accuracy of existing fake image detection technologies is relatively low. Summary of the Invention
[0003] This application provides a method and related apparatus for detecting fake images, which can improve the accuracy of fake image detection.
[0004] In a first aspect, embodiments of this application provide a method for detecting fake images, the method comprising: Acquire the image to be detected; Based on the target feature encoding model, feature extraction is performed on the image to be detected to obtain the target image features of the image to be detected; Based on the multilayer perceptron classification model and the target image features, the image to be detected is classified to obtain a first image classification result; The image to be detected is classified based on the support vector machine classification model and the target image features to obtain a second image classification result. The multilayer perceptron classification model is trained on the first image training set, and the support vector machine classification model is trained on the second image training set. The second image training set is a subset of the first image training set, and the first image training set and the second image training set are different sets. The target image classification result of the image to be detected is determined based on the results of the first image classification and the second image classification.
[0005] In one embodiment, the fake image detection method includes: Obtain a first image training set, wherein the first image training set includes multiple first image samples and corresponding first annotation labels, and the first annotation labels are real categories or false categories; Based on the first image training set, train the initial feature encoding model and the first initial classification model to obtain the target feature encoding model and the multilayer perceptron classification model; A second image training set is selected from the first image training set; The target feature encoding model is frozen, and a second initial classification model is trained based on the second image training set to obtain the support vector machine classification model.
[0006] In one implementation, the step of training an initial feature encoding model and a first initial classification model based on the first image training set to obtain the target feature encoding model and the multilayer perceptron classification model includes: Multiple first image samples from the first image training set are input into the initial feature encoding model to obtain sample features corresponding to each first image sample; Input the sample features corresponding to each of the first image samples into the first initial classification model to obtain the model classification result; The classification loss is calculated based on the first annotation label of each of the first image samples and the classification result of the model. The contrast loss is calculated based on the sample features corresponding to each of the first image samples and the first image training set. The total loss is determined based on the classification loss and the contrast loss. Based on the total loss, the initial feature encoding model and the first initial classification model are iteratively updated to obtain the target feature encoding model and the multilayer perceptron classification model.
[0007] In one implementation, selecting a second image training set from the first image training set includes: A fake sample set is obtained by filtering fake image samples belonging to the fake category from the first image training set; A real sample set is obtained by filtering real image samples belonging to the real category from the first image training set; The real sample set and the fake sample set are merged to obtain the second image training set.
[0008] In one implementation, the step of filtering fake image samples belonging to the fake category in the first image training set to obtain a fake sample set includes: The fake image samples from the first image training set are input into the target feature encoding model to obtain the fake image features of the fake image samples; The average value of the fake image features of all fake image samples in the first image training set is determined as the average fake image feature; Calculate the feature similarity between each of the fake image features and the average feature of the fake image; The first preset number of fake image samples, ranked from largest to smallest in terms of feature similarity with the average features of the fake images, are determined as the first screening sample set, wherein the first preset number is less than the number of fake image samples in the first image training set. A second preset number of fake image samples and corresponding first labels are randomly selected from the first filtered sample set as the fake sample set, wherein the second preset number is less than the first preset number.
[0009] In one implementation, the first image training set includes multiple first image samples, first labels corresponding to the multiple first image samples, and second labels for the first image samples belonging to the fake category. The second label is one of multiple forgery methods. Freezing the target feature encoding model and training a second initial classification model based on the second image training set to obtain the support vector machine classification model includes: Obtain a third image training set, wherein the third image training set includes multiple second image samples, first annotation labels corresponding to the multiple second image samples, and second annotation labels of the second image samples belonging to the false category, and the second annotation labels in the third image training set are different from the second annotation labels in the first image training set; The second image training set and the third image training set are merged to obtain a fourth image training set, wherein the number of image samples in the fourth image training set is less than that in the first image training set. The target feature encoding model is frozen, and the second initial classification model is trained based on the fourth image training set to obtain the support vector machine classification model.
[0010] In one implementation, freezing the target feature encoding model and training the second initial classification model based on the fourth image training set to obtain the support vector machine classification model includes: The fourth image training set is divided into K equal subsets; K subsets are designated as validation sets, and K subsets other than the validation sets are designated as target training sets. Obtain multiple sets of candidate training parameters for the second initial classification model; Freeze the target feature encoding model, use the candidate training parameters as fixed parameters of the second initial classification model, and train the second initial classification model based on the first image training set to obtain the third initial classification model corresponding to the target training set; The third initial classification model corresponding to the target training set is validated based on the validation set corresponding to the target training set, and the model validation parameters of the third initial classification model corresponding to the target training set are obtained. The total validation parameters of the candidate training parameters are determined based on the model validation parameters of the third initial classification model corresponding to multiple target training sets; The candidate training parameters whose total verification parameters meet the preset conditions are determined as the target training parameters; The target feature encoding model is frozen, the target training parameters are used as fixed parameters of the second initial classification model, and the second initial classification model is trained based on the fourth image training set to obtain the support vector machine classification model.
[0011] Secondly, embodiments of this application provide a fake image detection device, which has the function of implementing the fake image detection method corresponding to the first aspect described above. The function can be implemented by hardware or by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the above function, and the modules can be software and / or hardware.
[0012] Thirdly, embodiments of this application provide a computer-readable storage medium including instructions that, when executed on a computer, cause the computer to perform the fake image detection method as described in the first aspect.
[0013] Fourthly, embodiments of this application provide a computing device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the fake image detection method described in the first aspect.
[0014] Fifthly, embodiments of this application provide a chip that includes a processor coupled to a transceiver of a terminal device, for executing the technical solution provided in the first aspect of embodiments of this application.
[0015] Sixthly, embodiments of this application provide a chip system including a processor for supporting terminal devices in implementing the functions involved in the first aspect above.
[0016] In one possible design, the aforementioned chip system also includes a memory for storing program instructions and data necessary for the terminal. The chip system can be composed of chips or may include chips and other discrete components.
[0017] In a seventh aspect, embodiments of this application provide a computer program product containing instructions that, when run on a computer, cause the computer to execute the fake image detection method described in the first aspect.
[0018] Compared to existing technologies, in this embodiment, an image to be detected is acquired; features are extracted from the image to be detected based on a target feature encoding model to obtain target image features of the image to be detected; the image to be detected is classified based on a multilayer perceptron classification model and target image features to obtain a first image classification result; the image to be detected is classified based on a support vector machine classification model and target image features to obtain a second image classification result; wherein, the multilayer perceptron classification model is trained based on the first image training set, the support vector machine classification model is trained based on the second image training set, the second image training set is a subset of the first image training set, and the first image training set and the second image training set are different sets; the target image classification result of the image to be detected is determined based on the first image classification and the second image classification results. This application combines a multilayer perceptron (MLP) classifier and a support vector machine (SVM) classifier. The pre-trained MLP classifier maintains the detection performance for data with known forgery methods, while the SVM classifier improves the detection performance for data with unknown forgery methods. The MLP classification model is trained on a first image training set, and the SVM classification model is trained on a second image training set, which is a subset of the first image training set. By combining the prediction results of the MLP and SVM classifiers, the accuracy of fake image detection can be improved. Attached Figure Description
[0019] The objectives, features, and advantages of the embodiments of this application will become readily understood by referring to the accompanying drawings and the detailed description of the embodiments. Wherein: Figure 1 This is a schematic diagram of a fake image detection system according to the fake image detection method in this application embodiment; Figure 2 A flowchart illustrating a fake image detection method provided in an embodiment of this application; Figure 3 This is a schematic diagram of the structure of the fake image detection device according to an embodiment of this application; Figure 4 This is a schematic diagram of the structure of a computing device according to an embodiment of this application; Figure 5 This is a schematic diagram of the structure of a mobile phone in one embodiment of this application; Figure 6 This is a schematic diagram of a server structure in one embodiment of this application.
[0020] In the accompanying drawings, the same or corresponding reference numerals indicate the same or corresponding parts. Detailed Implementation
[0021] The terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments described herein can be implemented in a sequence other than that illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or device that includes a series of steps or modules is not necessarily limited to those explicitly listed, but may include other steps or modules not explicitly listed or inherent to these processes, methods, products, or devices. The division of modules in the embodiments of this application is merely a logical division; in actual applications, there may be other division methods. For example, multiple modules may be combined or integrated into another system, or some features may be omitted or not performed. Additionally, the shown or discussed mutual coupling or direct coupling or communication connection may be through some interface, indirect coupling between modules, or electrical or other similar forms of communication connection, none of which are limited in the embodiments of this application. Furthermore, the modules or sub-modules described as separate components may or may not be physically separated, may or may not be physical modules, or may be distributed among multiple circuit modules. Some or all of the modules may be selected according to actual needs to achieve the purpose of the embodiments of this application.
[0022] The general-purpose model is currently widely used in applications such as chat dialogue, text editing, artistic creation, coding, mathematical reasoning, and bioinformatics. Although it has created many new business models and is very powerful, after the general-purpose model is launched for users, there are mainly algorithmic risks, data risks, and application risks in the three types of applications: translation, chat, and collaboration.
[0023] This application also provides a method and related apparatus for detecting fake images, which can be applied to a fake image detection system. The fake image detection system may include a fake image detection device, which can be deployed integratedly or separately. The fake image detection device is at least used to acquire an image to be detected; extract features from the image to be detected based on a target feature encoding model to obtain target image features; classify the image to be detected based on a multilayer perceptron classification model and the target image features to obtain a first image classification result; classify the image to be detected based on a support vector machine classification model and the target image features to obtain a second image classification result; and determine the target image classification result of the image to be detected based on the first and second image classification results.
[0024] The solutions provided in this application involve technologies such as Artificial Intelligence (AI), Computer Vision (CV), and Machine Learning (ML), which are specifically illustrated through the following embodiments: AI, or Artificial Intelligence, refers to the theories, methods, technologies, and application systems that utilize digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use that knowledge to achieve optimal results. In other words, Artificial Intelligence is a comprehensive technology within computer science that attempts to understand the essence of intelligence and produce a new kind of intelligent machine capable of reacting in a manner similar to human intelligence. Artificial Intelligence studies the design principles and implementation methods of various intelligent machines, enabling them to possess the functions of perception, reasoning, and decision-making.
[0025] AI technology is a comprehensive discipline encompassing a wide range of fields, including both hardware and software technologies. Fundamental AI technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing, operating / interactive systems, and mechatronics. AI software technologies primarily include computer vision, speech processing, natural language processing, and machine learning / deep learning.
[0026] Computer vision (CV) is the science that studies how to enable machines to "see." More specifically, it refers to machine vision, which uses cameras and computers to replace human eyes for target recognition, tracking, and measurement, and then performs image processing to create images more suitable for human observation or transmission to instruments. As a scientific discipline, computer vision studies related theories and technologies, attempting to build artificial intelligence systems capable of extracting information from images or multidimensional data. Computer vision technologies typically include adversarial perturbation generation, image recognition, image semantic understanding, image retrieval, OCR, video processing, video semantic understanding, video content / behavior recognition, 3D object reconstruction, 3D technology, virtual reality, augmented reality, simultaneous localization and mapping (SLAM), and common biometric recognition technologies such as facial recognition and fingerprint recognition.
[0027] Compared to existing technologies, in this application embodiment, the following steps are taken: acquiring an image to be detected; extracting features from the image to be detected based on a target feature encoding model to obtain target image features; classifying the image to be detected based on a multilayer perceptron classification model and the target image features to obtain a first image classification result; classifying the image to be detected based on a support vector machine classification model and the target image features to obtain a second image classification result; and determining the target image classification result of the image to be detected based on the first and second image classification results. This application can improve the accuracy of fake image detection.
[0028] In some implementations, reference is made to Figure 1 The fake image detection method provided in this application embodiment can be based on Figure 1 The diagram illustrates an implementation of a fake image detection system. This fake image detection system may include an electronic device 100 and a memory 200. The electronic device 100 may be a server or a terminal device.
[0029] It should be noted that the server involved in the embodiments of this application can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, 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 communication, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms.
[0030] The terminal devices involved in the embodiments of this application can be devices that provide voice and / or data connectivity to users, handheld devices with wireless connectivity, or other processing devices connected to a wireless modem. Examples include mobile phones (or "cellular" phones) and computers with mobile terminals, such as portable, pocket-sized, handheld, computer-embedded, or vehicle-mounted mobile devices that exchange voice and / or data with a wireless access network. Examples include Personal Communication Service (PCS) phones, cordless phones, Session Initiation Protocol (SIP) phones, Wireless Local Loop (WLL) stations, Personal Digital Assistants (PDAs), and other devices.
[0031] Reference Figure 2 , Figure 2 This is a flowchart illustrating a fake image detection method provided in an embodiment of this application. The method can be executed by a fake image detection device. The method includes steps 101-105: Step 101: Obtain the image to be detected.
[0032] In this embodiment of the application, the image to be detected can be any image that needs to be detected.
[0033] Step 102: Extract features from the image to be detected based on the target feature encoding model to obtain the target image features of the image to be detected.
[0034] In this embodiment of the application, before extracting features from the image to be detected based on the target feature encoding model to obtain the target image features of the image to be detected, the process includes: (1) Obtain the first image training set.
[0035] The first image training set includes multiple first image samples and corresponding first annotation labels, where the first annotation label is either the true category or the false category.
[0036] Specifically, let the first image training set be denoted as ,remember Indicates the input space, Indicates the output space. Indicates having Data on a large scale of known forgery methods for a sample of samples. Indicates sample The first label, which is the real label. The value can be 0 or 1, where 0 represents the true category and 1 represents the false category.
[0037] (2) Train the initial feature encoding model and the first initial classification model based on the first image training set to obtain the target feature encoding model and the multilayer perceptron classification model.
[0038] In this embodiment of the application, in the first image training set Training the initial feature encoding model And the first initial classification model based on multilayer perceptron, until the convergence condition is met.
[0039] Among them, the multilayer perceptron classification model and the support vector machine classification model are different types of classification models. Specifically, the multilayer perceptron classification model can be a classification model built based on the multilayer perceptron (MLP). The support vector machine classification model is based on the support vector machine (…). , The classification model constructed
[0040] Correspondingly, the first initial classification model is the multilayer perceptron classification model before training, and the second initial classification model is the support vector machine classification model before training.
[0041] In one specific embodiment, an initial feature encoding model and a first initial classification model are trained based on a first image training set to obtain a target feature encoding model and a multilayer perceptron classification model, including: 2-1. Input multiple first image samples from the first image training set into the initial feature encoding model to obtain the sample features corresponding to each first image sample.
[0042] In this embodiment of the application, the sample feature corresponding to the i-th first image sample can be denoted as: .
[0043] 2-2. Input the sample features corresponding to each first image sample into the first initial classification model to obtain the model classification result.
[0044] Specifically, the model classification result is the probability that the first image sample is classified as a false category. The probability that the i-th first image sample is classified as a false category is... For the sample After features are extracted by the initial feature encoding model, they are fed into the first initial classification model to obtain probabilities. .
[0045] 2-3. Calculate the classification loss based on the first annotation label of each first image sample and the model classification result.
[0046] Specifically, classification loss The following calculations are performed:
[0047] in, Represents the first image training set The total number of samples in the sample, Indicates sample The first label, The value can be 0 or 1, where 0 represents the true category and 1 represents the false category.
[0048] 2-4. Calculate the contrast loss based on the sample features corresponding to each first image sample and the first image training set.
[0049] In this embodiment, to further enhance the distinguishability between genuine and fake features, a supervised contrastive learning loss function is applied to the features extracted by the feature encoder. This aims to reduce the distance between samples of the same category while widening the distance between samples of different categories, thereby increasing the contrastive loss. Calculated using the following formula:
[0050] in, Represents the first image training set The total number of samples in the sample, Represents the sample features of the i-th first image sample Sample features of the kth first image sample The similarity score between them, which can be calculated using cosine similarity or inner product. This represents a temperature parameter used to adjust the smoothness of the similarity score. Indicates an indicator function, when The value is 1 if the condition is met, and 0 otherwise, to ensure that the sample itself is excluded from the calculation. Represents the first image training set The feature set of the first image sample that has the same label as the i-th first image sample.
[0051] 2-5. Determine the total loss based on classification loss and contrast loss.
[0052] In one specific embodiment, the classification loss and the contrast loss are weighted and summed based on the weight coefficients of the classification loss and the contrast loss to obtain the total loss.
[0053] Specifically, classifying losses And comparative loss The weighted summation is used as the total loss to guide the updating of the parameters of the feature encoder and the first initial classification model. Calculated using the following formula:
[0054] in, yes The weighting coefficients.
[0055] 2-6. Based on the total loss, iteratively update the initial feature encoding model and the first initial classification model to obtain the target feature encoding model and the multilayer perceptron classification model.
[0056] In this embodiment, the initial feature encoding model and the first initial classification model are iteratively updated based on the total loss until a preset stopping condition is met, thereby obtaining the target feature encoding model and the multilayer perceptron classification model.
[0057] In one specific embodiment, the preset stopping condition is that the total loss is not greater than a preset loss value. It is determined whether the total loss is greater than the preset loss value. If the total loss is greater than the preset loss value, the model parameters of the initial feature encoding model and the first initial classification model are updated to obtain a new total loss. When the new total loss is not greater than the preset loss value, the preset stopping condition is determined to be met, and the initial feature encoding model and the first initial classification model at this time are determined as the target feature encoding model and the multilayer perceptron classification model, respectively.
[0058] In another specific embodiment, the preset stopping condition is that the total loss is not greater than a preset loss value or the number of iterations is greater than a preset number of iterations. It is determined whether the total loss is greater than the preset loss value and whether the number of iterations is greater than the preset number of iterations. If the total loss is greater than the preset loss value and the number of iterations is not greater than the preset number of iterations, the model parameters of the initial feature encoding model and the first initial classification model are updated, and the number of iterations is updated to obtain a new total loss and a new number of iterations. When the new total loss is not greater than the preset loss value or the new number of iterations is greater than the preset number of iterations, the preset stopping condition is determined to be met, and the initial feature encoding model and the first initial classification model at this time are determined as the target feature encoding model and the multilayer perceptron classification model, respectively.
[0059] (3) Select the second image training set from the first image training set.
[0060] In one specific embodiment, selecting a second image training set from a first image training set includes: randomly selecting a second image training set from the first image training set. The number of image samples in the first image training set is greater than the number of image samples in the second image training set.
[0061] In another specific embodiment, selecting a second image training set from the first image training set includes: 3-1. Select fake image samples from the fake image samples belonging to the fake category in the first image training set to obtain a fake sample set.
[0062] The number of fake image samples in the fake sample set is less than the number of fake image samples in the first image training set.
[0063] In this embodiment of the application, the process of selecting a fake sample set from fake image samples belonging to the fake category in the first image training set includes: inputting the fake image samples in the first image training set into a target feature encoding model to obtain the fake image features of the fake image samples; determining the average value of the fake image features of all fake image samples in the first image training set as the average fake image feature; calculating the feature similarity between each fake image feature and the average fake image feature; determining a first preset number of fake image samples with the highest feature similarity to the average fake image feature in descending order as the first selection sample set, wherein the first preset number is less than the number of fake image samples in the first image training set; and randomly selecting a second preset number of fake image samples and corresponding first labels from the first selection sample set as the fake sample set, wherein the second preset number is less than the first preset number.
[0064] 3-2. Select real image samples belonging to the real category from the first image training set to obtain the real sample set.
[0065] In this embodiment, obtaining a real sample set from real image samples belonging to the real category in the first image training set includes: inputting real image samples from the first image training set into a target feature encoding model to obtain real image features of the real image samples; determining the average value of the real image features of all real image samples in the first image training set as the real image average feature; calculating the feature similarity between each real image feature and the real image average feature; determining a third preset number of real image samples whose feature similarity with the real image average feature is within a preset similarity range and their corresponding first labels as a second screening sample set; and randomly collecting a fourth preset number of real image samples and their corresponding first labels within the second screening sample set to obtain the real sample set. The third preset number is less than the number of real image samples in the first image training set, and the fourth preset number is less than the third preset number. The preset similarity range includes the median of the feature similarity between each real image feature and the real image average feature.
[0066] 3-3. Merge the real sample set and the fake sample set to obtain the second image training set.
[0067] (4) Freeze the target feature encoding model, and train the target feature encoding model and the second initial classification model based on the second image training set to obtain the support vector machine classification model.
[0068] In one specific embodiment, the target feature encoding model is frozen, and a second initial classification model is trained based on a second image training set to obtain a support vector machine classification model. Specifically, multiple image samples from the second image training set are input into the target feature encoding model to obtain sample features corresponding to each image sample in the second image training set; the sample features corresponding to each image sample in the second image training set are input into the second initial classification model to obtain the model classification result; the classification loss is calculated based on the first labeled tags corresponding to each image sample in the second image training set and the model classification result; the contrastive loss is calculated based on the sample features corresponding to each image sample in the second image training set and the second image training set; the total loss is determined based on the classification loss and the contrastive loss; keeping the target feature encoding model unchanged, the second initial classification model is iteratively updated based on the total loss to obtain the support vector machine classification model.
[0069] In another specific embodiment, the first image training set includes multiple first image samples, first annotation labels corresponding to the multiple first image samples, and second annotation labels for the first image samples belonging to the fake category. The second annotation label is one of multiple forgery methods. The forgery method can be forgery method A, forgery method B, forgery method C, and forgery method D, etc.
[0070] Specifically, the target feature encoding model is frozen, and a second initial classification model is trained based on the second image training set to obtain a support vector machine classification model. This includes: obtaining a third image training set, wherein the third image training set includes multiple second image samples, first labels corresponding to the multiple second image samples, and second labels of second image samples belonging to the false category, and the second labels in the third image training set are different from the second labels in the first image training set; merging the second image training set and the third image training set to obtain a fourth image training set, wherein the number of image samples in the fourth image training set is less than the number in the first image training set; freezing the target feature encoding model, and training the target feature encoding model and the second initial classification model based on the fourth image training set to obtain a support vector machine classification model.
[0071] Specifically, let the second image training set be denoted as Let the third image training set be denoted as , indicating that it has Data with unknown forgery methods. Merging the second image training set. and the third image training set The fourth image training set was obtained. The fourth image training set The feature set of sample features of image samples . Let be the sample features of the i-th image sample.
[0072] For example, the second label in the first image training set includes forgery method A and forgery method B. The second label in the third image training set includes forgery method C and forgery method D. Forgery methods C and D are new forgery methods.
[0073] In this embodiment of the application, the target feature encoding model is frozen, and the target feature encoding model and the second initial classification model are trained based on the fourth image training set to obtain a support vector machine classification model, including: (1) Divide the fourth image training set into K subsets.
[0074] (2) Determine the K subsets as the validation set and the K subsets other than the validation set as the target training set.
[0075] (3) Obtain multiple sets of candidate training parameters for the second initial classification model.
[0076] The candidate training parameters include the parameter values of multiple preset training parameters of the second initial classification model. Specifically, multiple preset training parameters of the second initial classification model are obtained, and values are assigned to each preset training parameter to obtain a set of candidate training parameters. Multiple sets of candidate parameters are obtained by assigning values to the multiple preset training parameters multiple times. The parameter values of the multiple sets of candidate training parameters are different.
[0077] Specifically, the second initial classification model is an SVM classifier, which uses a radial basis function (RBF) kernel. The radial basis function is given by the following formula:
[0078] in, and It is a feature set Two sample features in the sample, Represents Euclidean distance. It is the kernel function width parameter of the RBF kernel, which controls the width of the kernel function and has a significant impact on the complexity and generalization ability of the model.
[0079] Among them, the multiple preset training parameters are kernel function width parameters. and regularization parameters The kernel width parameter is used multiple times. and regularization parameters Assigning values yields multiple sets of candidate training parameters. .
[0080] (4) Freeze the target feature encoding model, use the candidate training parameters as the fixed parameters of the second initial classification model, and train the second initial classification model based on the target training set to obtain the third initial classification model corresponding to the target training set.
[0081] Specifically, during the process of training the second initial classification model based on the target training set to obtain the corresponding third initial classification model, the target feature encoding model remains unchanged, and the preset training parameters of the second initial classification model are always kept unchanged as candidate training parameters. The fixed parameters are those that remained unchanged during the training of the second initial classification model.
[0082] (5) Validate the third initial classification model corresponding to the target training set based on the validation set corresponding to the target training set, and obtain the model validation parameters of the third initial classification model corresponding to the target training set.
[0083] Specifically, the model validation parameter can be the classification loss of the third initial classification model on the validation set.
[0084] (6) Determine the total validation parameters of the candidate training parameters based on the model validation parameters of the third initial classification model corresponding to multiple target training sets.
[0085] The average value of the model validation parameters of the third initial classification model corresponding to multiple target training sets is determined as the total validation parameter of the candidate training parameters.
[0086] (7) The candidate training parameters whose total validation parameters meet the preset conditions are determined as the target training parameters.
[0087] Specifically, the candidate training parameter with the highest total validation parameters is determined as the target training parameter.
[0088] The candidate training parameter with the highest total validation parameters is the parameter that performs best in cross-validation, and the candidate training parameter with the highest total validation parameters is determined as the target training parameter.
[0089] (8) Freeze the target feature encoding model, use the target training parameters as the fixed parameters of the second initial classification model, and train the second initial classification model based on the fourth image training set to obtain the support vector machine classification model.
[0090] Specifically, the target feature encoding model is frozen, and the target training parameters are used as fixed parameters for the second initial classification model. Multiple image samples from the fourth image training set are input into the target feature encoding model to obtain the sample features corresponding to each image sample in the fourth image training set. The sample features corresponding to each image sample in the fourth image training set are input into the second initial classification model to obtain the model classification result. The classification loss is calculated based on the first label corresponding to each image sample in the fourth image training set and the model classification result. The contrast loss is calculated based on the sample features corresponding to each image sample in the fourth image training set and the fourth image training set. The total loss is determined based on the classification loss and the contrast loss. Keeping the target feature encoding model unchanged, the second initial classification model is iteratively updated based on the total loss to obtain the support vector machine classification model.
[0091] Use the selected parameters The feature set corresponding to the complete fourth image training set The SVM classifier is retrained to ensure that the model achieves optimal performance on all available data.
[0092] Step 103: Based on the multilayer perceptron classification model and the target image features, perform image classification on the image to be detected to obtain the first image classification result.
[0093] In this embodiment of the application, the first image classification result is either a true category or a false category.
[0094] Specifically, the target image features are input into a multilayer perceptron classification model to obtain the first image classification result.
[0095] Step 104: Based on the support vector machine classification model and the target image features, perform image classification on the image to be detected to obtain the second image classification result.
[0096] Among them, the multilayer perceptron classification model and the support vector machine classification model are different types of classification models.
[0097] The second image classification result is either a true category or a false category.
[0098] Specifically, the target image features are input into the support vector machine classification model to obtain the second image classification result.
[0099] Step 105: Determine the target image classification result of the image to be detected based on the results of the first image classification and the second image classification.
[0100] The target image is classified as either a true category or a false category.
[0101] In a specific embodiment, if there is a false category classification result in the first image classification result and the second image classification result, the target image classification result of the image to be detected is determined to be a false category; otherwise, the target image classification result of the image to be detected is determined to be a true category.
[0102] This application has the following beneficial effects: (1) Excellent adaptability to new samples and mitigation of catastrophic forgetting: By employing a replay strategy and a fixed feature encoder parameter method, this invention achieves a good balance between adaptability to new samples and catastrophic forgetting. This ensures that the model can quickly adapt to new forgery techniques while maintaining memory of old knowledge.
[0103] (2) Effective control of overfitting risk in few-shot learning: By fixing the feature encoder parameters and only fine-tuning the SVM classifier, this invention effectively reduces the risk of overfitting in few-shot learning. This strategy helps maintain the stability of the model in recognizing known fake samples and makes accurate classification decisions on novel unknown samples.
[0104] (3) Strong generalization ability and adaptability: The use of SVM classifier improves the generalization ability of the model when dealing with high-dimensional data. Especially when the number of samples is limited, SVM can effectively avoid overfitting and maintain good generalization performance.
[0105] (4) Improved computational efficiency: The fixed feature encoder parameters reduce the training time of the model. Especially in environments with limited computing resources, this strategy enables the model to adapt to new data distributions more quickly and improves the real-time performance of online learning.
[0106] See Figure 3 ,like Figure 3 The diagram shows a structural schematic of a fake image detection device. The fake image detection device in this embodiment can achieve the functions described above. Figure 2 The steps of the fake image detection method executed in the corresponding embodiments are described below. The functions implemented by the fake image detection device can be implemented by hardware or by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the above functions, and the modules can be software and / or hardware.
[0107] The fake image detection device 50 includes: The acquisition module 501 is configured to acquire the image to be detected; The feature extraction module 502 is configured to extract features from the image to be detected based on the target feature encoding model to obtain the target image features of the image to be detected; The first classification module 503 is configured to classify the image to be detected based on a multilayer perceptron classification model and target image features to obtain a first image classification result. The second classification module 504 is configured to classify the image to be detected based on the support vector machine classification model and the target image features to obtain the second image classification result. The determination module 505 is configured to determine the target image classification result of the image to be detected based on the first image classification and the second image classification results.
[0108] The fake image detection device 50 in this application embodiment has been described above from the perspective of modular functional entities. The fake image detection device in this application embodiment will be described below from the perspective of hardware processing.
[0109] Figure 3 The devices shown can all have the following characteristics: Figure 4 The structure shown, when Figure 3 The fake image detection device 50 shown has, for example, Figure 4 When the structure shown is used, Figure 4 The processor and transceiver in the device can perform the same or similar functions as the modules provided in the aforementioned embodiments of the corresponding device. Figure 4 The memory stores the computer programs that the processor needs to call when executing the above-mentioned fake image detection method.
[0110] This application also provides a terminal device, such as... Figure 5 As shown, for ease of explanation, only the parts related to the embodiments of this application are shown. For specific technical details not disclosed, please refer to the method section of the embodiments of this application. The terminal device can be any terminal device including mobile phones, tablets, personal digital assistants (PDAs), point-of-sale (POS) terminals, in-vehicle computers, etc. Taking a mobile phone as an example: Figure 5 This diagram illustrates a partial structural representation of a mobile phone related to the terminal device provided in this embodiment. (Reference) Figure 5 The mobile phone includes components such as a radio frequency (RF) circuit 1010, a memory 1020, an input unit 1030, a display unit 1040, a sensor 1050, an audio circuit 1060, a wireless fidelity (WiFi) module 1070, a processor 1080, and a power supply 1090. Those skilled in the art will understand that... Figure 5The mobile phone structure shown does not constitute a limitation on the mobile phone and may include more or fewer components than shown, or combine certain components, or have different component arrangements.
[0111] The following is combined with Figure 5 A detailed introduction to each component of a mobile phone: The RF circuit 1010 can be used for receiving and transmitting signals during information transmission or calls. Specifically, it receives downlink information from the base station and processes it with the processor 1080; additionally, it transmits uplink data to the base station. Typically, the RF circuit 1010 includes, but is not limited to, an antenna, at least one amplifier, a transceiver, a coupler, a low-noise amplifier (LNA), a duplexer, etc. Furthermore, the RF circuit 1010 can also communicate wirelessly with networks and other devices. The aforementioned wireless communication can use any communication standard or protocol, including but not limited to Global System for Mobile Communications (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Long Term Evolution (LTE), email, and Short Messaging Service (SMS).
[0112] The memory 1020 can be used to store software programs and modules. The processor 1080 executes various mobile phone functions and data processing by running the software programs and modules stored in the memory 1020. The memory 1020 may mainly include a program storage area and a data storage area. The program storage area may store the operating system, applications required for at least one function (such as sound playback function, image playback function, etc.), etc.; the data storage area may store data created according to the use of the mobile phone (such as audio data, phonebook, etc.). In addition, the memory 1020 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device.
[0113] The input unit 1030 can be used to receive input numerical or character information, and to generate key signal inputs related to user settings and function control of the mobile phone. Specifically, the input unit 1030 may include a touch panel 1031 and other input devices 1032. The touch panel 1031, also known as a touch screen, can collect touch operations performed by the user on or near it (such as operations performed by the user using a finger, stylus, or any suitable object or accessory on or near the touch panel 1031), and drive the corresponding connection devices according to a pre-set program. Optionally, the touch panel 1031 may include two parts: a touch detection device and a touch controller. The touch detection device detects the user's touch position and the signal generated by the touch operation, and transmits the signal to the touch controller; the touch controller receives touch information from the touch detection device, converts it into touch point coordinates, and sends it to the processor 1080, and can also receive and execute commands sent by the processor 1080. In addition, the touch panel 1031 can be implemented using various types such as resistive, capacitive, infrared, and surface acoustic wave. In addition to the touch panel 1031, the input unit 1030 may also include other input devices 1032. Specifically, other input devices 1032 may include, but are not limited to, one or more of the following: physical keyboard, function keys (such as volume control buttons, power buttons, etc.), trackball, mouse, joystick, etc.
[0114] The display unit 1040 can be used to display information input by the user or information provided to the user, as well as various menus of the mobile phone. The display unit 1040 may include a display panel 1041, which may optionally be configured as a liquid crystal display (LCD), organic light-emitting diode (OLED), or similar display. Further, a touch panel 1031 may cover the display panel 1041. When the touch panel 1031 detects a touch operation on or near it, it transmits the information to the processor 1080 to determine the type of touch event. Subsequently, the processor 1080 provides corresponding visual output on the display panel 1041 based on the type of touch event. Although in Figure 5 In this embodiment, the touch panel 1031 and the display panel 1041 are two separate components to realize the input and output functions of the mobile phone. However, in some embodiments, the touch panel 1031 and the display panel 1041 can be integrated to realize the input and output functions of the mobile phone.
[0115] The mobile phone may also include at least one sensor 1050, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor may include an ambient light sensor and a proximity sensor. The ambient light sensor can adjust the brightness of the display panel 1041 according to the ambient light level, and the proximity sensor can turn off the display panel 1041 and / or the backlight when the phone is moved to the ear. As a type of motion sensor, an accelerometer sensor can detect the magnitude of acceleration in various directions (generally three axes). When stationary, it can detect the magnitude and direction of gravity and can be used for applications that recognize the phone's posture (such as landscape / portrait switching, related games, magnetometer posture calibration), vibration recognition-related functions (such as pedometer, taps), etc. Other sensors that may be configured in the mobile phone, such as gyroscopes, barometers, hygrometers, thermometers, and infrared sensors, will not be described in detail here.
[0116] The audio circuit 1060, speaker 1061, and microphone 1062 provide an audio interface between the user and the mobile phone. The audio circuit 1060 converts the received audio data into electrical signals and transmits them to the speaker 1061, where the speaker 1061 converts them into sound signals for output. On the other hand, the microphone 1062 converts the collected sound signals into electrical signals, which are then received by the audio circuit 1060, converted into audio data, and then processed by the processor 1080 before being transmitted via the RF circuit 1010 to, for example, another mobile phone, or the audio data can be output to the memory 1020 for further processing.
[0117] Wi-Fi is a short-range wireless transmission technology. Through the Wi-Fi module 1070, mobile phones can help users send and receive emails, browse web pages, and access streaming media, providing users with wireless broadband internet access. Although Figure 5 The Wi-Fi module 1070 is shown, but it is understood that it is not an essential component of a mobile phone and can be omitted as needed without changing the essence of the invention.
[0118] The processor 1080 is the control center of the mobile phone, connecting various parts of the phone through various interfaces and lines. It executes software programs and / or modules stored in the memory 1020 and calls data stored in the memory 1020 to perform various functions and process data, thereby providing overall monitoring of the phone. Optionally, the processor 1080 may include one or more processing units; optionally, the processor 1080 may integrate an application processor and a modem processor, wherein the application processor mainly handles the operating system, user interface, and applications, and the modem processor mainly handles wireless communication. It is understood that the aforementioned modem processor may also not be integrated into the processor 1080.
[0119] The mobile phone also includes a power supply 1090 (such as a battery) that supplies power to various components. Optionally, the power supply can be logically connected to the processor 1080 through a power management system, thereby enabling functions such as charging, discharging, and power consumption management through the power management system.
[0120] Although not shown, mobile phones may also include a camera, Bluetooth module, etc., which will not be described in detail here.
[0121] In this embodiment of the application, the processor 1080 included in the mobile phone also has the function of controlling the execution of the fake image detection method process executed by the fake image detection device.
[0122] This application also provides a server; please refer to [link / reference]. Figure 6 , Figure 6 This is a schematic diagram of a server structure provided in an embodiment of this application. The server 1100 can vary significantly due to different configurations or performance. It may include one or more central processing units (CPUs) 1122 (e.g., one or more processors) and memory 1132, and one or more storage media 1130 (e.g., one or more mass storage devices) for storing application programs 1142 or data 1144. The memory 1132 and storage media 1130 may be temporary or persistent storage. The program stored in the storage media 1130 may include one or more modules (not shown in the figure), each module may include a series of instruction operations on the server. Furthermore, the CPU 1122 may be configured to communicate with the storage media 1130 and execute the series of instruction operations in the storage media 1130 on the server 1100.
[0123] Server 1100 may also include one or more power supplies 1126, one or more wired or wireless network interfaces 1150, one or more input / output interfaces 1158, and / or one or more operating systems 1141, such as Windows Server, Mac OS X, Unix, Linux, FreeBSD, etc.
[0124] The steps performed by the server in the above embodiments can be based on this Figure 6 The structure of server 1100 is shown. For example, in the above embodiment, it consists of... Figure 3 The steps performed by the fake image detection device 50 shown can be based on this Figure 6 The server architecture is shown. For example, the central processing unit 1122 performs the following operations by calling instructions from memory 1132: Acquire the image to be detected; extract features from the image to be detected based on the target feature encoding model to obtain the target image features of the image to be detected; classify the image to be detected based on the multilayer perceptron classification model and the target image features to obtain the first image classification result; classify the image to be detected based on the support vector machine classification model and the target image features to obtain the second image classification result; determine the target image classification result of the image to be detected based on the first image classification and the second image classification results.
[0125] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions in other embodiments.
[0126] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and modules described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0127] In the embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of modules is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple modules or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces, indirect coupling or communication connection between apparatuses or modules, and may be electrical, mechanical, or other forms.
[0128] The modules described as separate components may or may not be physically separate. Similarly, the components shown as modules may or may not be physical modules; they may be located in one place or distributed across multiple network modules. Some or all of the modules can be selected to achieve the purpose of this embodiment, depending on actual needs.
[0129] Furthermore, the functional modules in the various embodiments of this application can be integrated into one processing module, or each module can exist physically separately, or two or more modules can be integrated into one module. The integrated module can be implemented in hardware or as a software functional module. If the integrated module is implemented as a software functional module and sold or used as an independent product, it can be stored in a computer-readable storage medium.
[0130] According to one aspect of this application, a computer program product or computer program is provided, comprising computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the methods provided in the various alternative implementations described above.
[0131] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented, in whole or in part, as a computer program product.
[0132] A computer program product includes one or more computer instructions. When a computer program is loaded and executed on a computer, it produces, in whole or in part, the flow or function according to the embodiments of this application. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, computer instructions may be transmitted from one website, computer, server, or data center to another via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a server or data center that integrates one or more available media. The available medium may be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., a solid-state drive (SSD)).
[0133] The technical solutions provided in the embodiments of this application have been described in detail above. Specific examples have been used in the embodiments of this application to illustrate the principles and implementation methods of the embodiments of this application. The description of the above embodiments is only for the purpose of helping to understand the methods and core ideas of the embodiments of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of the embodiments of this application. Therefore, the content of this specification should not be construed as a limitation on the embodiments of this application.
Claims
1. A method for detecting fake images, characterized in that, The fake image detection method includes: Acquire the image to be detected; Based on the target feature encoding model, feature extraction is performed on the image to be detected to obtain the target image features of the image to be detected; Based on the multilayer perceptron classification model and the target image features, the image to be detected is classified to obtain a first image classification result; Image classification is performed on the image to be detected based on the support vector machine classification model and the target image features to obtain a second image classification result. The multilayer perceptron classification model is trained on a first image training set, and the support vector machine classification model is trained on a second image training set. The second image training set is a subset of the first image training set, and the first and second image training sets are different sets. The first image training set is obtained by including multiple first image samples, first labels corresponding to the multiple first image samples, and second labels for the first image samples belonging to the fake category. The first label is either a real category or a fake category, and the second label is one of several forgery methods. Initial training is performed based on the first image training set. The first initial classification model and the first feature encoding model are used to obtain the target feature encoding model and the multilayer perceptron classification model. A second image training set is selected from the first image training set. A third image training set is obtained, comprising multiple second image samples, first labels corresponding to the multiple second image samples, and second labels of second image samples belonging to the false category. The second labels in the third image training set are different from the second labels in the first image training set. The second image training set and the third image training set are merged to obtain a fourth image training set, where the number of image samples in the fourth image training set is less than that in the first image training set. The target feature encoding model is frozen, and a second initial classification model is trained based on the fourth image training set to obtain the support vector machine classification model. The target image classification result of the image to be detected is determined based on the results of the first image classification and the second image classification.
2. The fake image detection method according to claim 1, characterized in that, The step of training an initial feature encoding model and a first initial classification model based on the first image training set to obtain the target feature encoding model and the multilayer perceptron classification model includes: Multiple first image samples from the first image training set are input into the initial feature encoding model to obtain sample features corresponding to each first image sample; Input the sample features corresponding to each of the first image samples into the first initial classification model to obtain the model classification result; The classification loss is calculated based on the first annotation label of each of the first image samples and the classification result of the model. The contrast loss is calculated based on the sample features corresponding to each of the first image samples and the first image training set. The total loss is determined based on the classification loss and the contrast loss. Based on the total loss, the initial feature encoding model and the first initial classification model are iteratively updated to obtain the target feature encoding model and the multilayer perceptron classification model.
3. The fake image detection method according to claim 1, characterized in that, The step of selecting a second image training set from the first image training set includes: A fake sample set is obtained by filtering fake image samples belonging to the fake category from the first image training set; A real sample set is obtained by filtering real image samples belonging to the real category from the first image training set; The real sample set and the fake sample set are merged to obtain the second image training set.
4. The fake image detection method according to claim 3, characterized in that, The step of filtering fake image samples belonging to the fake category from the first image training set to obtain a fake sample set includes: The fake image samples from the first image training set are input into the target feature encoding model to obtain the fake image features of the fake image samples; The average value of the fake image features of all fake image samples in the first image training set is determined as the average fake image feature; Calculate the feature similarity between each of the fake image features and the average feature of the fake image; The first preset number of fake image samples, ranked from largest to smallest in terms of feature similarity with the average features of the fake images, are determined as the first screening sample set, wherein the first preset number is less than the number of fake image samples in the first image training set. A second preset number of fake image samples and corresponding first labels are randomly selected from the first filtered sample set as the fake sample set, wherein the second preset number is less than the first preset number.
5. The fake image detection method according to claim 1, characterized in that, The process of freezing the target feature encoding model and training a second initial classification model based on the fourth image training set to obtain the support vector machine classification model includes: The fourth image training set is divided into K equal subsets; K subsets are designated as validation sets, and K subsets other than the validation sets are designated as target training sets. Obtain multiple sets of candidate training parameters for the second initial classification model; Freeze the target feature encoding model, use the candidate training parameters as fixed parameters of the second initial classification model, and train the second initial classification model based on the first image training set to obtain the third initial classification model corresponding to the target training set; The third initial classification model corresponding to the target training set is validated based on the validation set corresponding to the target training set, and the model validation parameters of the third initial classification model corresponding to the target training set are obtained. The total validation parameters of the candidate training parameters are determined based on the model validation parameters of the third initial classification model corresponding to multiple target training sets; The candidate training parameters whose total verification parameters meet the preset conditions are determined as the target training parameters; The target feature encoding model is frozen, the target training parameters are used as fixed parameters of the second initial classification model, and the second initial classification model is trained based on the fourth image training set to obtain the support vector machine classification model.
6. A fake image detection device, characterized in that, The fake image detection device includes: The acquisition module is configured to acquire the image to be detected; The feature extraction module is configured to extract features from the image to be detected based on the target feature encoding model to obtain the target image features of the image to be detected; The first classification module is configured to classify the image to be detected based on a multilayer perceptron classification model and the target image features to obtain a first image classification result. The second classification module is configured to classify the image to be detected based on a support vector machine classification model and the target image features to obtain a second image classification result. The multilayer perceptron classification model is trained on a first image training set, and the support vector machine classification model is trained on a second image training set. The second image training set is a subset of the first image training set, and the first and second image training sets are different sets. The first image training set is obtained by acquiring a set that includes multiple first image samples, first labels corresponding to the multiple first image samples, and second labels for the first image samples belonging to the fake category. The first labels are either the real category or the fake category, and the second labels are one of several forgery methods. The module then trains the first image training set. The first image training set is used to train an initial feature encoding model and a first initial classification model to obtain a target feature encoding model and a multilayer perceptron classification model. A second image training set is selected from the first image training set. A third image training set is obtained, comprising multiple second image samples, first labels corresponding to the multiple second image samples, and second labels for second image samples belonging to the false category. The second labels in the third image training set are different from the second labels in the first image training set. The second image training set and the third image training set are merged to obtain a fourth image training set, where the number of image samples in the fourth image training set is less than that in the first image training set. The target feature encoding model is frozen, and a second initial classification model is trained based on the fourth image training set to obtain the support vector machine classification model. The determination module is configured to determine the target image classification result of the image to be detected based on the first image classification and the second image classification result.
7. A computer-readable storage medium, characterized in that, It includes instructions that, when run on a computer, cause the computer to perform the fake image detection method as described in any one of claims 1-5.
8. A computing device, characterized in that, It includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the method as described in any one of claims 1-5.