A Fraudulent Image Detection Method Based on CTFNet
The CTFNet network combines CNN, Transformer, and frequency domain fusion networks to extract and fuse multiple features of images, solving the problem of low accuracy in fraud image detection in existing technologies and achieving more efficient fraud image recognition.
Patent Information
- Application Number
- CN202411625382.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-14
- Publication Date
- 2025-10-28
- Estimated Expiration
- 2044-11-14
AI Technical Summary
Existing fraud image detection technologies struggle to accurately identify fraudulent activities in images. Traditional methods rely on the physical properties and metadata of images, while machine learning methods have low detection accuracy.
The CTFNet network is used, combined with CNN, Transformer and frequency domain fusion network to extract local features, global features and high and low frequency features of the image, and improves detection accuracy through adaptive weighted fusion.
By fusing multiple features and adaptively assigning weights, the accuracy and robustness of fraud image detection are significantly improved, while suppressing noise interference.
Smart Images

Figure CN119580077B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of fraudulent image detection technology, and relates to a fraudulent image detection method based on CTFNet. Background Technology
[0002] With the rapid development of the internet and mass media, data in various forms, including text and images, has exploded, posing a significant challenge to content moderation. Current anti-fraud technologies mostly use machine learning methods to detect fraudulent websites and app URLs and HTML, with limited research on fraudulent image detection. Fraudulent image detection aims to detect and identify fraudulent activities in image content, improve the accuracy of online monitoring systems in reviewing fraudulent images, and protect the property and safety of internet users.
[0003] Fraudulent image detection includes traditional image forensics methods, machine learning-based fraudulent image detection methods, and deep feature extraction-based fraudulent image detection methods. Traditional image forensics methods focus on analyzing the physical properties, format, and metadata of images to detect signs of tampering. However, since normal images on the network also contain traces of tampering, it is difficult to accurately detect fraudulent images. Machine learning-based fraudulent image detection methods use machine learning to detect tampering or forgery in images, but the accuracy rate for detecting fraudulent images is relatively low. Summary of the Invention
[0004] In view of this, the purpose of this invention is to provide a fraudulent image detection method based on CTFNet. CTFNet consists of CNN, Transformer, and frequency domain fusion network. CNN and Transformer extract local and global features in the spatial domain of the image, respectively. The frequency domain fusion network extracts high-frequency components of local features and low-frequency components of global features through discrete Fourier transform and filters. By fusing local features, global features, and high and low frequency features in the frequency domain and adaptively assigning different weights, the accuracy of fraudulent image detection can be improved.
[0005] To achieve the above objectives, the present invention provides the following technical solution:
[0006] A fraudulent image detection method based on CTFNet includes the following steps:
[0007] S1: Obtain fraudulent images and normal images, and construct a training set for fraudulent images and a test set for image similarity;
[0008] S2: Construct a CTFNet feature extraction network, input the fraudulent image training set and image similarity test set into CTFNet, and extract its local features, global features and high and low frequency features in the spatial domain, respectively;
[0009] S3: Calculate the cosine similarity of features in the training set and the image similarity test set of fraudulent images respectively, and obtain the similarity threshold of fraudulent images through adaptive weighted fusion;
[0010] S4: Input the image to be detected into CTFNet and extract the local features, global features, and high and low frequency features in the spatial domain of the image to be detected;
[0011] S5: Calculate the cosine similarity of the features of the training set of the image to be detected and the fraudulent image respectively, and obtain the best similarity score of the image to be detected through adaptive weighted fusion;
[0012] S6: Compare the best similarity score of the image to be detected with the similarity threshold of the fraudulent image to obtain the detection result of the image to be detected.
[0013] Furthermore, step S1 specifically includes the following steps:
[0014] Fraudulent images with obvious fraudulent characteristics are collected from fraudulent carriers, and the selected images are screened manually to construct a fraudulent image training set and an image similarity test set;
[0015] The training set of fraudulent images and the test set of image similarity are expanded by using image enhancement techniques based on random strategies and magnitudes: First, a set of image enhancement strategies is defined, including rotation, translation, scaling, flipping, brightness adjustment, contrast adjustment, noise addition, and random erasure. Each time, an image enhancement strategy is randomly selected and its enhancement magnitude is randomly determined. Finally, the training set of fraudulent images and the test set of image similarity are enhanced.
[0016] A new image similarity test set is constructed by randomly selecting normal images from the public dataset and adding them to the image similarity test set.
[0017] Furthermore, the CTFNet feature extraction network in step S2 consists of a CNN network, a Transformer network, and a frequency domain fusion network; the CNN network is used to learn local information in the spatial domain of the image from images of different scales; the Transformer network is used to capture the global dependencies between various locations in the spatial domain of the image; and the frequency domain fusion network is used to extract the high and low frequency components of global features and local features.
[0018] Furthermore, the CNN network specifically performs the following: The first 13 convolutional layers of the VGG16 are used for local feature extraction. The input image undergoes two convolutions in a 64-kernel convolutional layer, followed by one max-pooling operation. It then undergoes two convolutions in a 128-kernel convolutional layer, followed by another max-pooling operation. Finally, it undergoes two convolutions in three 512-kernel convolutional layers, followed by another max-pooling operation. The output is the local feature X.CNN .
[0019] Furthermore, the Transformer network replaces the convolutional layers with an MHSA (Multi-Head Self-Attention) structure to extract global image features X. Transformer The input image is first embedded into a fixed-dimensional vector representation x. x undergoes a linear transformation to generate three matrices: query Q, key K, and value V. The linear transformation formula is as follows:
[0020] Q = W Q x, K = W K x, V = W V x
[0021] Among them, W Q W K W V It is a learnable weight matrix. For each query vector Q, the attention score is obtained by calculating the dot product between it and all key vectors K. The calculation formula is:
[0022]
[0023] Where, d k It is the dimension of the key, used to scale the dot product, and softmax is used to convert the dot product into a probability distribution;
[0024] MHSA employs parallel computation through multiple sets of different Q, K, and V transforms, with each head focusing on different feature patterns. This allows the model to capture different global dependencies in different subspaces. The output of MHSA is expressed by the following formula:
[0025] X Transformer =Concat(Attention1,…,Attentionh)W O
[0026] Each head independently computes self-attention, W O It is the output weight matrix used for linear transformation.
[0027] Furthermore, the frequency domain fusion network uses a feature normalization layer to normalize the global features, eliminating the scale difference between global and local features, and making the global feature dimension C×H×W.
[0028] The feature normalization layer first uses a fully connected layer to convert the embedding dimension E of the Transformer output to C, and then reshapes the Transformer output to C×H×W by downsampling K=H×W. The class token is discarded during feature alignment and fusion.
[0029] The global and local features are transformed into the frequency domain using the Discrete Fourier Transform (DFT). The DFT formula is as follows:
[0030]
[0031] Where, x c (m,n) are the output features of Transformer or CNN, and X(u,v) are the corresponding features in the frequency domain, where u and v are the coordinates in the frequency domain, representing the horizontal and vertical components of the frequency.
[0032] High-frequency components H of CNN features in the frequency domain are extracted using a bandpass filter. CNN Low-frequency component L of Transformer features in the frequency domain is extracted using a low-pass filter. Transformer The formulas for bandpass and lowpass filters are as follows:
[0033]
[0034] Among them, h H For a bandpass filter, D low and D high h is the cutoff frequency of the bandpass filter. L For a low-pass filter, D high1 This is the cutoff frequency of the low-pass filter;
[0035] High-frequency components H of CNN features CNN and the low-frequency component L of the Transformer feature Transformer The calculation formula is as follows:
[0036] H CNN (u,v)=h H *X CNN (u,v)
[0037] L Transformer (u,v)=h L *X Transfomer (u,v)
[0038] After applying bandpass and lowpass filters in the frequency domain, the high-frequency features H of the CNN are... CNN and the low-frequency characteristics L of Transformer Transformer Combined, they form the fusion feature X Fusion :
[0039] X Fusion =H CNN (u,v)+L Transfomer (u,v)
[0040] The training set of fraudulent images and the test set of image similarity are input into CTFNet. The local feature set obtained from the training set of fraudulent images is denoted as the local feature F of the training set of fraudulent images. 1j The global feature set is denoted as F, which represents the global features of the training set of fraudulent images. 2j The frequency domain fusion feature set is denoted as F, which is the frequency domain fusion feature set of the fraudulent image training set. 3j The local feature set obtained from the image similarity test set is denoted as the local feature f of the image similarity test set. 1t The global feature set is denoted as f, which represents the global features of the image similarity test set. 2t The frequency domain fusion feature set is denoted as the frequency domain fusion feature f of the image similarity test set. 3t , where j and t represent the number of images in the training set and the test set, respectively.
[0041] Furthermore, in step S3, cosine similarity is used to measure the degree of similarity between two features. The formula for cosine similarity is as follows:
[0042]
[0043] Where i takes the values 1, 2, or 3, F ij ·f it Represents the eigenvector F ij and f it The dot product, ||F ij ||and||f it || represents the eigenvector F ij and f it Length;
[0044] The local features F of the fraudulent image training set are obtained using the cosine similarity formula. 1j Local features f of the image similarity test set 1t The feature similarity; each image t in the image similarity test set and each image j in the fraudulent image training set have a local feature similarity. The maximum value of this value represents the best local feature similarity K1 between image t in the image similarity test set and image j in the fraudulent image training set. Similarly, the best global feature similarity K2 and the best frequency domain fusion feature similarity K3 between image t in the image similarity test set and image j in the fraudulent image training set are obtained.
[0045] Each image in the image similarity test set has a local feature optimal similarity K1, a global feature optimal similarity K2, and a frequency domain fusion feature optimal similarity K3 with the fraudulent image training set. K1, K2, and K3 are adaptively weighted and fused using an adaptive weighted fusion matrix to obtain the optimal similarity score K of each image in the image similarity test set with the fraudulent image training set. The formula is as follows:
[0046] K = [a, b, c] * [K1, K2, K3] T = aK1 + bK2 + cK3
[0047] Where [a,b,c] is the adaptive weighted fusion matrix, and the weight coefficients a, b, and c are obtained according to K1, K2, and K3, as shown in the following formula:
[0048]
[0049] b, b, c are automatically assigned based on the relative values of K1, K2, K3, and weights are automatically assigned based on the contributions of different features;
[0050] The similarity threshold for fraudulent images is set to different values. If K is greater than or equal to the similarity threshold for fraudulent images, then it is a fraudulent image; otherwise, it is a normal image. The detection accuracy of normal images and fraudulent images in the image similarity test set is calculated separately. That is, normal images are detected as normal images and fraudulent images are detected as fraudulent images. When the sum of the detection accuracy of normal images and fraudulent images is maximized, the preset fraudulent image similarity threshold is the fraudulent image similarity threshold K'.
[0051] Furthermore, in step S4, the image to be detected is input into CTFNet, the local features obtained from the image to be detected are denoted as local features f1, the global features are denoted as global features f2, and the frequency domain fusion features are denoted as frequency domain fusion features f3.
[0052] Furthermore, in step S5, the local features f1 of the image to be detected and the local features F of the training set of the fraudulent image are calculated using the cosine similarity formula. 1j The feature similarity is determined by the fact that j has different values. For each image j in the training set of fraudulent images, there is a local feature similarity. The maximum value of j represents the best local feature similarity between the image to be detected and the training set of fraudulent images, and is denoted as the best local feature similarity score k1 of the image to be detected. Similarly, the best global feature similarity score k2 and the best frequency domain fusion feature similarity score k3 of the image to be detected and the training set of fraudulent images are obtained. The best similarity score k between the image to be detected and the training set of fraudulent images is obtained by adaptively weighting k1, k2, and k3.
[0053] Furthermore, in step S6, the best similarity score k between the image to be detected and the training set of fraudulent images is compared with the similarity threshold K' of the fraudulent images. If k ≥ K', then the image to be detected is a fraudulent image; otherwise, the image to be detected is a normal image.
[0054] The beneficial effects of this invention are as follows: CTFNet consists of a CNN, a Transformer, and a frequency domain fusion network. The CNN can learn local information in the spatial domain of an image from images of different scales. The Transformer captures the global dependencies between various locations in the spatial domain of the image. The frequency domain fusion network extracts the high and low frequency components of global and local features, thus better suppressing noise. By fusing local image features, global features, and high and low frequency features in the frequency domain, and adaptively assigning different weights, the accuracy of fraudulent image detection can be improved.
[0055] Other advantages, objectives, and features of the invention will be set forth in part in the description which follows, and in part will be apparent to those skilled in the art from the following examination, or may be learned from practice of the invention. The objectives and other advantages of the invention can be realized and obtained through the following description. Attached Figure Description
[0056] To make the objectives, technical solutions, and advantages of the present invention clearer, the preferred embodiments of the present invention will be described in detail below with reference to the accompanying drawings, wherein:
[0057] Figure 1 This is a flowchart of the fraud image detection process based on CTFNet according to the present invention;
[0058] Figure 2 This is a diagram of the CTFNet network structure of the present invention. Detailed Implementation
[0059] The following specific examples illustrate the implementation of the present invention. Those skilled in the art can easily understand other advantages and effects of the present invention from the content disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and various details in this specification can be modified or changed based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that the illustrations provided in the following embodiments are only schematic representations of the basic concept of the present invention. Unless otherwise specified, the following embodiments and features can be combined with each other.
[0060] It should be noted that the illustrations provided in the following embodiments are only schematic representations of the basic concept of the present invention. Therefore, the drawings only show the components related to the present invention and are not drawn according to the actual number, shape and size of the components in the actual implementation. In the actual implementation, the form, quantity and proportion of each component can be arbitrarily changed, and the layout of the components may also be more complex.
[0061] In the following description, numerous details are explored to provide a more thorough explanation of embodiments of the invention. However, it will be apparent to those skilled in the art that embodiments of the invention may be practiced without these specific details. In other embodiments, well-known structures and devices are shown in block diagram form rather than in detail to avoid obscuring embodiments of the invention.
[0062] like Figure 1 As shown, a fraudulent image detection method based on CTFNet includes the following steps:
[0063] S1: Obtain fraudulent images and normal images to construct a fraudulent image training set and an image similarity test set. Optionally, in this embodiment, fraudulent images with obvious fraudulent characteristics are collected from fraudulent websites and apps, and the selected images are manually screened to construct the fraudulent image training set and the image similarity test set. To further expand the amount of training data, image enhancement techniques based on random strategies and magnitudes are used to expand the fraudulent image training set and the image similarity test set: First, a set of image enhancement strategies is defined, including rotation, translation, scaling, flipping, brightness adjustment, contrast adjustment, adding noise, random erasing, etc. Each time, an image enhancement strategy is randomly selected, and its enhancement magnitude is randomly determined. Finally, the fraudulent image training set and the image similarity test set are enhanced. To improve the accuracy of model training, normal images are randomly extracted from the public ImageNet dataset and added to the image similarity test set to construct a new image similarity test set.
[0064] S2: Construct a CTFNet feature extraction network. Input the training and test sets mentioned above into CTFNet and extract its local spatial features, global features, and high- and low-frequency features in the frequency domain, respectively. Optional, such as... Figure 2 As shown, CTFNet consists of CNN, Transformer, and frequency domain fusion network. The CNN network learns local information in the spatial domain of the image from images of different scales, the Transformer network captures the global dependencies between various locations in the spatial domain of the image, and the frequency domain fusion network extracts the high and low frequency components of global and local features.
[0065] VGG is a type of CNN network. This invention uses the first 13 convolutional layers of VGG16 (with 64, 128, and 512 channels respectively, separated by max pooling layers) for local feature extraction. The input image is first convolved twice by a 64-kernel convolutional layer, followed by one max pooling operation. Then, it is convolved twice by a 128-kernel convolutional layer, followed by another max pooling operation. Finally, it is convolved twice by three 512-kernel convolutional layers, followed by another max pooling operation. The output is the local feature X.CNN .
[0066] The Transformer network uses an MHSA (Multi-Head Self-Attention) structure to replace convolutional layers for extracting global image features X. Transformer The input image is first embedded into a fixed-dimensional vector representation x. x undergoes a linear transformation to generate three matrices: query (Q), key (K), and value (V). The linear transformation formula is as follows:
[0067] Q = W Q x, K = W K x, V = W V x
[0068] Among them, W Q W K W V It is a learnable weight matrix. For each query vector Q, the attention score is obtained by calculating the dot product between it and all key vectors K. The calculation formula is:
[0069]
[0070] Where, d k The key dimension is used to scale the dot product, while softmax is used to convert the dot product into a probability distribution.
[0071] MHSA performs parallel computation through multiple sets of different Q, K, V transforms (called multiple "heads"), each head focusing on different feature patterns, enabling the model to capture different global dependencies in different subspaces. The output of MHSA is expressed by the following formula:
[0072] X Transformer =Concat(Attention1,…,Attentionh)W O
[0073] Each head independently computes self-attention, W O This is the output weight matrix used for linear transformation. The multi-head mechanism further enriches the model's understanding of different features, enabling MHSA to extract complex features with global context.
[0074] The feature dimensions of CNNs and Transformers are not the same. CNN feature maps have a dimension of C×H×W, where C represents the number of channels, H represents the height, and W represents the width; while Transformer feature maps have a dimension of (K+1)×E, where K represents the number of images, E represents the embedding dimension, and 1 represents the class token, indicating an additional vector. Frequency domain fusion networks use feature normalization layers to normalize global features, eliminating the scale difference between global and local features, thus changing the global feature dimension to C×H×W.
[0075] The feature normalization layer first uses a fully connected layer to convert the embedding dimension E of the Transformer output to C, and then reshapes the Transformer output to C×H×W by downsampling K=H×W. The class token is discarded during feature alignment and fusion.
[0076] Directly fusing global and local features may lead to feature redundancy and an inability to effectively distinguish effective features at different frequencies. This invention transforms global and local features into the frequency domain using the Discrete Fourier Transform (DFT). The DFT formula is as follows:
[0077]
[0078] Where, x c (m,n) are the output features of Transformer or CNN, and X(u,v) are the corresponding features in the frequency domain. u and v are the coordinates in the frequency domain, representing the horizontal and vertical components of the frequency.
[0079] Since CNNs excel at extracting high-frequency information from images while Transformers excel at extracting low-frequency information, a bandpass filter is used to extract the high-frequency component H of the CNN features in the frequency domain. CNN Low-frequency component L of Transformer features in the frequency domain is extracted using a low-pass filter. Transformer The formulas for bandpass and lowpass filters are as follows:
[0080]
[0081] Among them, h H For a bandpass filter, D low and D high h is the cutoff frequency of the bandpass filter. L For a low-pass filter, D high1 This is the cutoff frequency of the low-pass filter.
[0082] High-frequency components H of CNN features CNN and the low-frequency component L of the Transformer feature TransformerThe calculation formula is as follows:
[0083] H CNN (u,v)=h H *X CNN (u,v)
[0084] L Transformer (u,v)=h L *X Transfomer (u,v)
[0085] After applying bandpass and lowpass filters in the frequency domain, the high-frequency features H of the CNN are... CNN and the low-frequency characteristics L of Transformer Transformer Combined, they form the fusion feature X Fusion :
[0086] X Fusion =H CNN (u,v)+L Transfomer (u,v)
[0087] CTFNet combines the local feature extraction capabilities of CNNs, the global dependency modeling capabilities of Transformers, and the noise suppression and frequency component extraction capabilities of frequency domain fusion networks, enhancing the flexibility and robustness of image representation and making it outstanding in fraudulent image detection tasks.
[0088] The training set of fraudulent images and the test set of image similarity are input into CTFNet. The local feature set obtained from the training set of fraudulent images is denoted as the local feature F of the training set of fraudulent images. 1j The global feature set is denoted as F, which represents the global features of the training set of fraudulent images. 2j The frequency domain fusion feature set is denoted as F, which is the frequency domain fusion feature set of the fraudulent image training set. 3j The local feature set obtained from the image similarity test set is denoted as the local feature f of the image similarity test set. 1t The global feature set is denoted as f, which represents the global features of the image similarity test set. 2t The frequency domain fusion feature set is denoted as the frequency domain fusion feature f of the image similarity test set. 3t , where j and t represent the number of images in the training set and the test set, respectively.
[0089] S3: Calculate the cosine similarity of features in the fraudulent image training set and the image similarity test set respectively, and obtain the similarity threshold of the fraudulent image through adaptive weighted fusion. Optionally, cosine similarity is used to measure the degree of similarity between two features. The cosine similarity formula is as follows:
[0090]
[0091] Where i takes the values 1, 2, or 3, Fij ·f it Represents the eigenvector F ij and f it The dot product, ||F ij ||and||f it || represents the eigenvector F ij and f it The length.
[0092] The local features F of the fraudulent image training set are obtained using the cosine similarity formula. 1j Local features f of the image similarity test set 1t Regarding the feature similarity, since j and t have different values, each image t in the image similarity test set and each image j in the fraudulent image training set have a local feature similarity. The maximum value of this local feature similarity represents the optimal feature similarity K1 between image t in the image similarity test set and image j in the fraudulent image training set. Similarly, the optimal feature similarity K2 for the global features and the optimal feature similarity K3 for the frequency domain fusion features between image t in the image similarity test set and image j in the fraudulent image training set can be obtained.
[0093] Each image in the image similarity test set has a local feature optimal similarity K1, a global feature optimal similarity K2, and a frequency domain fusion feature optimal similarity K3 with the fraudulent image training set. K1, K2, and K3 are adaptively weighted and fused using an adaptive weighted fusion matrix to obtain the optimal similarity score K of each image in the image similarity test set with the fraudulent image training set. The formula is as follows:
[0094] K = [a, b, c] * [K1, K2, K3] T = aK1 + bK2 + cK3
[0095] Where [a,b,c] is the adaptive weighted fusion matrix, and the weight coefficients a, b, and c are obtained according to K1, K2, and K3, as shown in the following formula:
[0096]
[0097] a, b, and c are automatically assigned based on the relative values of K1, K2, and K3. The weights are automatically assigned based on the contributions of different features, reducing the error of human intervention and obtaining a more accurate and representative optimal similarity score K.
[0098] The similarity threshold for fraudulent images is set to different values (between 0 and 1). If K is greater than or equal to the similarity threshold for fraudulent images, then it is a fraudulent image; otherwise, it is a normal image. The detection accuracy of normal images and fraudulent images in the image similarity test set is calculated separately, i.e., normal images are detected as normal images, and fraudulent images are detected as fraudulent images. When the sum of the detection accuracy of normal images and fraudulent images is maximized, the preset fraudulent image similarity threshold is the fraudulent image similarity threshold K'.
[0099] S4: Input the image to be detected into CTFNet and extract the local features, global features, and high- and low-frequency features in the spatial domain of the image to be detected. Optionally, input the image to be detected into CTFNet, and denote the obtained local features as local features f1, the global features as global features f2, and the frequency domain fusion features as frequency domain fusion features f3.
[0100] S5: Calculate the cosine similarity between the features of the image to be detected and the training set features of the fraudulent image, and obtain the optimal similarity score of the image to be detected through adaptive weighted fusion. Optionally, the local features f1 of the image to be detected and the local features F of the training set of the fraudulent image can be obtained from the cosine similarity formula. 1j Regarding the feature similarity, since j has different values, each image j in the training set of fraudulent images has a local feature similarity. The maximum value of this local feature similarity represents the best local feature similarity between the image to be detected and the training set of fraudulent images, denoted as the best local feature similarity score k1 for the image to be detected. Similarly, the best global feature similarity score k2 and the best frequency domain fusion feature similarity score k3 between the image to be detected and the training set of fraudulent images can be obtained. Adaptively weighted fusion of k1, k2, and k3 yields the best similarity score k between the image to be detected and the training set of fraudulent images, using the same formula as described in S3.
[0101] S6: The best similarity score of the image to be detected is compared with the similarity threshold of the fraudulent image to obtain the detection result of the image to be detected. Optionally, the best similarity score k between the image to be detected and the training set of fraudulent images is compared with the similarity threshold K' of the fraudulent image. If k ≥ K', the image to be detected is a fraudulent image; otherwise, the image to be detected is a normal image.
[0102] In the above embodiments, the reference to "this embodiment" in the specification indicates that a particular feature, structure, or characteristic described in connection with the embodiment is included in at least some embodiments, but not necessarily all embodiments. Multiple appearances of "this embodiment" do not necessarily all refer to the same embodiment.
[0103] In the above embodiments, although the invention has been described in conjunction with specific embodiments thereof, many substitutions, modifications, and variations of these embodiments will be apparent to those skilled in the art from the foregoing description. For example, other memory structures (e.g., dynamic RAM (DRAM)) may be used with the embodiments discussed. The embodiments of the invention are intended to cover all such substitutions, modifications, and variations falling within the broad scope of the appended claims.
[0104] This embodiment also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements any of the methods in this embodiment.
[0105] This embodiment also provides an electronic terminal, including: a processor and a memory;
[0106] The memory is used to store computer programs, and the processor is used to execute the computer programs stored in the memory to cause the terminal to perform any of the methods in this embodiment.
[0107] As will be understood by those skilled in the art, the computer-readable storage medium described in this embodiment allows for the implementation of all or part of the steps in the above method embodiments by computer program-related hardware. The aforementioned computer program can be stored in a computer-readable storage medium. When executed, the program performs the steps of the above method embodiments; and the aforementioned storage medium includes various media capable of storing program code, such as ROM, RAM, magnetic disks, or optical disks.
[0108] The electronic terminal provided in this embodiment includes a processor, a memory, a transceiver, and a communication interface. The memory and the communication interface are connected to the processor and the transceiver and complete communication between them. The memory is used to store computer programs, the communication interface is used to perform communication, and the processor and the transceiver are used to run the computer programs, so that the electronic terminal performs the steps of the above method.
[0109] In this embodiment, the memory may include random access memory (RAM) and may also include non-volatile memory, such as at least one disk storage device.
[0110] The processors mentioned above can be general-purpose processors, including central processing units (CPUs), network processors (NPs), etc.; they can also be digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.
[0111] This invention can be used in a wide range of general-purpose or special-purpose computing system environments or configurations. Examples include: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, and distributed computing environments including any of the above systems or devices, etc.
[0112] This invention can be described in the general context of computer-executable instructions, such as program modules, that are executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc., that perform a specific task or implement a specific abstract data type. This invention can also be practiced in distributed computing environments where tasks are performed by remote processing devices connected via a communication network. In distributed computing environments, program modules can reside in local and remote computer storage media, including storage devices.
[0113] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the present invention, and all such modifications or substitutions should be covered within the scope of the claims of the present invention.
Claims
1. A fraudulent image detection method based on CTFNet, characterized in that: The following steps are involved: S1: Obtain fraudulent images and normal images, and construct a training set for fraudulent images and a test set for image similarity; S2: Construct a CTFNet feature extraction network. Input the fraudulent image training set and image similarity test set into CTFNet to extract local features, global features, and high- and low-frequency features in the spatial domain, respectively. The CTFNet feature extraction network consists of a CNN network, a Transformer network, and a frequency domain fusion network. The CNN network is used to learn local information in the spatial domain of the image from images of different scales. The Transformer network is used to capture the global dependencies between various locations in the spatial domain of the image. The frequency domain fusion network is used to extract the high- and low-frequency components of the global and local features. The frequency domain fusion network uses a feature normalization layer to normalize the global features, eliminating the scale difference between global and local features, and making the global feature dimension C×H×W. The feature normalization layer first uses a fully connected layer to convert the embedding dimension E of the Transformer output to C, and then reshapes the Transformer output to C×H×W by downsampling K = H×W. The class token is discarded during feature alignment and fusion. The global and local features are transformed into the frequency domain using the Discrete Fourier Transform (DFT). The DFT formula is as follows: in, These are the output features of Transformer or CNN. These correspond to the features in the frequency domain, where u and v are coordinates in the frequency domain, representing the horizontal and vertical components of the frequency. High-frequency components H of CNN features in the frequency domain are extracted using a bandpass filter. CNN Low-frequency component L of Transformer features in the frequency domain is extracted using a low-pass filter. Transformer The formulas for bandpass and lowpass filters are as follows: Among them, h H For a bandpass filter, D low and D high h is the cutoff frequency of the bandpass filter. L For a low-pass filter, D high1 This is the cutoff frequency of the low-pass filter; High-frequency components H of CNN features CNN and the low-frequency component L of the Transformer feature Transformer The calculation formula is as follows: After applying bandpass and lowpass filters in the frequency domain, the high-frequency features H of the CNN are... CNN and the low-frequency characteristics L of Transformer Transformer Combined, they form the fusion feature X Fusion : The fraudulent image training set and the image similarity test set are input into CTFNet. The local feature set obtained from the fraudulent image training set is denoted as the local feature F of the fraudulent image training set. 1j The global feature set is denoted as F, which represents the global features of the training set of fraudulent images. 2j The frequency domain fusion feature set is denoted as F, which is the frequency domain fusion feature set of the fraudulent image training set. 3j The local feature set obtained from the image similarity test set is denoted as the local feature ƒ of the image similarity test set. 1t The global feature set is denoted as the global feature set of the image similarity test set. 2t The frequency domain fusion feature set is denoted as the frequency domain fusion feature of the image similarity test set. 3t , where j and t represent the number of images in the training set and the test set, respectively; S3: Calculate the cosine similarity of features in the training set and the image similarity test set of fraudulent images respectively, and obtain the similarity threshold of fraudulent images through adaptive weighted fusion; Cosine similarity is used to measure the degree of similarity between two features. The formula for cosine similarity is as follows: Where i takes the values 1, 2, or 3. Representing the eigenvector and dot product, and Representing the eigenvector and Length; The local features F of the fraudulent image training set are obtained using the cosine similarity formula. 1j Local features of image similarity test set ƒ 1t The feature similarity; each image t in the image similarity test set and each image j in the fraudulent image training set have a local feature similarity. The maximum value of this local feature similarity is taken as the best feature similarity K1 between the image t in the image similarity test set and the fraudulent image training set. Similarly, the best feature similarity K2 of the global feature and the best feature similarity K3 of the frequency domain fusion feature are obtained between the image t in the image similarity test set and the fraudulent image training set. Each image in the image similarity test set has a local feature optimal similarity K1, a global feature optimal similarity K2, and a frequency domain fusion feature optimal similarity K3 with the fraudulent image training set. K1, K2, and K3 are adaptively weighted and fused using an adaptive weighted fusion matrix to obtain the optimal similarity score K of each image in the image similarity test set with the fraudulent image training set. The formula is as follows: K=[a,b,c]*[K1,K2,K3] T =aK1+bK2+cK3 Where [a,b,c] is the adaptive weighted fusion matrix, and the weight coefficients a, b, and c are obtained according to K1, K2, and K3, as shown in the following formula: a, b, and c are automatically assigned based on the relative values of K1, K2, and K3, and weights are automatically assigned based on the contributions of different features. The similarity threshold for fraudulent images is set to different values. If K is greater than or equal to the similarity threshold for fraudulent images, then it is a fraudulent image; otherwise, it is a normal image. The detection accuracy of normal images and fraudulent images in the image similarity test set is calculated separately, i.e., normal images are detected as normal images, and fraudulent images are detected as fraudulent images. When the sum of the detection accuracy of normal images and fraudulent images is maximized, the preset fraudulent image similarity threshold is determined. ; S4: Input the image to be detected into CTFNet and extract the local features, global features, and high and low frequency features in the spatial domain of the image to be detected; S5: Calculate the cosine similarity of the features of the training set of the image to be detected and the fraudulent image respectively, and obtain the best similarity score of the image to be detected through adaptive weighted fusion; S6: Compare the best similarity score of the image to be detected with the similarity threshold of the fraudulent image to obtain the detection result of the image to be detected.
2. The fraud image detection method based on CTFNet according to claim 1, characterized in that: Step S1 specifically includes the following steps: Fraudulent images with obvious fraudulent characteristics are collected from fraudulent carriers, and the selected images are screened manually to construct a fraudulent image training set and an image similarity test set; The training set of fraudulent images and the test set of image similarity are expanded by using image enhancement techniques based on random strategies and magnitudes: First, a set of image enhancement strategies is defined, including rotation, translation, scaling, flipping, brightness adjustment, contrast adjustment, noise addition, and random erasure. Each time, an image enhancement strategy is randomly selected and its enhancement magnitude is randomly determined. Finally, the training set of fraudulent images and the test set of image similarity are enhanced. A new image similarity test set is constructed by randomly selecting normal images from the public dataset and adding them to the image similarity test set.
3. The fraud image detection method based on CTFNet according to claim 1, characterized in that: The CNN network specifically performs the following steps: The first 13 convolutional layers of a VGG16 array are used for local feature extraction. The input image is first convolved twice by a convolutional layer with 64 kernels, followed by one max-pooling operation. Then, it is convolved twice by a convolutional layer with 128 kernels, followed by another max-pooling operation. Finally, it is convolved twice by three convolutional layers with 512 kernels each, followed by another max-pooling operation. The output is the local feature X. CNN .
4. The fraud image detection method based on CTFNet according to claim 1, characterized in that: The Transformer network replaces the convolutional layers with an MHSA (Multi-Head Self-Attention) structure to extract global image features X. Transformer The input image is first embedded into a fixed-dimensional vector representation x. x undergoes a linear transformation to generate three matrices: query Q, key K, and value V. The linear transformation formula is as follows: in, It is a learnable weight matrix. For each query vector Q, the attention score is obtained by calculating the dot product between it and all key vectors K. The calculation formula is: Where, d k It is the dimension of the key, used to scale the dot product, and softmax is used to convert the dot product into a probability distribution; MHSA performs parallel computation through multiple sets of different Q, K, and V transforms, with each head focusing on different feature patterns. This allows the model to capture different global dependencies in different subspaces. The output of MHSA is expressed by the following formula: Each head independently computes self-attention. It is the output weight matrix used for linear transformation.
5. The fraud image detection method based on CTFNet according to claim 1, characterized in that: In step S4, the image to be detected is input into CTFNet. The local features obtained from the image to be detected are denoted as local features f1, the global features are denoted as global features f2, and the frequency domain fusion features are denoted as frequency domain fusion features f3.
6. The fraud image detection method based on CTFNet according to claim 1, characterized in that: In step S5, the local features f1 of the image to be detected and the local features F of the training set of the fraudulent image are calculated using the cosine similarity formula. 1j The feature similarity is determined by the fact that j can take different values. For each image j in the training set of fraudulent images and the image to be detected, there is a local feature similarity. The maximum value of j represents the best local feature similarity between the image to be detected and the training set of fraudulent images. Let k1 be the best similarity score of the local features of the image to be detected; similarly, k2 is the best similarity score of the global features of the image to be detected and the training set of fraudulent images, and k3 is the best similarity score of the frequency domain fusion features; k1, k2, and k3 are adaptively weighted and fused to obtain the best similarity score k between the image to be detected and the training set of fraudulent images.
7. The fraud image detection method based on CTFNet according to claim 1, characterized in that: In step S6, the optimal similarity score k between the image to be detected and the training set of fraudulent images is compared with the fraudulent image similarity threshold. Compare, if k≥ If the result is positive, the image to be detected is a fraudulent image; otherwise, the image to be detected is a normal image.
Citation Information
Patent Citations
Generative adversarial network-based fraudulent website identification method
CN114756783A
Face fraud detection method and system based on skeleton feature learning
CN115995120A