Image discrimination method and apparatus

CN122929368APending Publication Date: 2026-10-16LISHUI RES INST OF HANGZHOU UNIV OF ELECTRONIC SCI & TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610973093.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-01
Publication Date
2026-10-16

AI Technical Summary

Technical Problem

然而,这类方法存在以下显著缺陷:1.计算开销大:需要处理高分辨率图像,特征维度高,推理速度慢,难以在移动端或高并发场景部署;2.特征冗余:传统的二维特征图(2D Feature Map)包含大量与真伪无关的空间冗余信息,容易导致模型过拟合;3.缺乏语义层面的鉴伪能力:现有方法多关注局部纹理细节,忽略了AI生成图像在全局语义结构上的细微不一致性;4.泛化性不足:复杂网络易过拟合于特定生成模型的特征,在面对未见过的生成方式时性能骤降

Benefits of technology

[0051]1.推理效率高,轻量化部署性强:本发明采用的高压缩一维离散Token特征维度远低于传统鉴伪方法的像素/局部特征维度,这种极度精简的特征输入使得后端的轻量级二分类鉴伪分类器(参数量可控制在500万以内)在算力、显存消耗上极低。实验数据表明,本方法的模型推理速度较传统的ResNet或大型ViT鉴伪架构提升5-10倍,能够直接适配手机终端、边缘计算网关等资源受限环境,满足实时、在线的端侧鉴伪需求。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122929368A_ABST
    Figure CN122929368A_ABST
Patent Text Reader

Abstract

The application discloses a kind of generation image identification method and device.First, image pre-processing is carried out, then high compression one-dimensional Tokenization processing is carried out, and one-dimensional discrete Token index sequence is obtained;Afterwards, Token embedding and position coding are sequentially carried out to retain the semantics and position information of features, then Token semantic weighting and cross-Token association modeling are passed through, and enhanced Token feature matrix is generated;Based on the generated Token feature matrix, the training of lightweight two-classification fake identification classifier is completed, and efficient determination of image authenticity is realized.The application uses this highly compressed one-dimensional discrete Token as the core feature of fake identification, and constructs a lightweight two-classification fake identification classifier to solve the problems of large amount of calculation, high feature redundancy and insufficient capture of high-level semantic logic inconsistency in the prior art.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the interdisciplinary field of Internet security and computer vision. Specifically, it relates to a method and apparatus for identifying AI-generated forged images based on highly compressed one-dimensional discrete token features. It is applicable to scenarios where real-shot images are distinguished from images output by various AI generation models (such as diffusion models, autoregressive models, highly compressed word segmenter generation models, etc.). Background Technology

[0002] In recent years, from the rapid development of Generative Adversarial Networks (GANs) and Diffusion Models (such as StableDiffusion, Midjourney), to the DALL-E autoregressive model and the recently proposed high-compression one-dimensional tokenizer (1D Tokenizer) generation scheme, all can generate visually realistic and detailed images. The realism of AI-generated content (AIGC) has reached a level that is difficult to distinguish with the naked eye.

[0003] Current AI-generated image authentication technologies mainly fall into two categories:

[0004] The first category is artifact detection based on the pixel domain or frequency domain. For example, detecting irregular textures, abnormal high-frequency components in the spectrum, or color residue in an image. These methods are often effective for specific generative models (such as certain architectures of GANs), but they have poor generalization ability when faced with constantly iterating new generative models, and are easily affected by image compression and post-processing.

[0005] The second category is feature extraction and detection based on deep neural networks. This typically uses large backbone networks such as ResNet, EfficientNet, or ViT (Vision Transformer) to extract high-dimensional features from images for binary classification. However, these methods suffer from the following significant drawbacks: 1. High computational cost: They require processing high-resolution images, have high feature dimensions, and slow inference speeds, making them difficult to deploy on mobile devices or in high-concurrency scenarios; 2. Feature redundancy: Traditional 2D feature maps contain a large amount of spatially redundant information unrelated to authenticity, easily leading to model overfitting; 3. Lack of semantic-level anti-spoofing capabilities: Existing methods focus primarily on local texture details, ignoring subtle inconsistencies in the global semantic structure of AI-generated images; 4. Insufficient generalization: Complex networks are prone to overfitting to features specific to a particular generative model, resulting in a sharp performance drop when faced with unseen generative methods.

[0006] Furthermore, research indicates that discrete token spaces employing Vector Quantization (VQ) exhibit a stronger regularization effect compared to continuous latent variable spaces. Specifically, in continuous latent spaces, the feature distribution differences between AI-generated and real images are relatively diffuse, making detection models susceptible to minor perturbations. In contrast, in the VQ-discrete codebook space, each token is forcibly mapped to discrete entries within a finite codebook. This quantization process essentially acts as an information bottleneck constraint, forcing tokens to retain only the most discriminative semantic information. Experimental evidence shows that one-dimensional token segmenters using VQ discrete tokens (such as TiTok VQ-LL-32) significantly outperform VAE segmenters and two-dimensional VQGAN segmenters using continuous tokens in image generation quality evaluation. This phenomenon demonstrates that the regularization constraints provided by VQ discretization result in a more regular semantic structure in the token space, with more significant and separable differences in the statistical distributions of real and AI-generated images within this space, providing a natural feature advantage for counterfeit detection tasks based on discrete tokens.

[0007] In summary, the main shortcomings of existing AI-generated image authentication technologies are: 1. Low model robustness and high dependence on training data; 2. High computational overhead, high cost, high feature redundancy, and low model efficiency; 3. Insufficient generalization ability, making it difficult to cope with image compression and other degradation processes that occur during network transmission. To address these issues, there is an urgent need for an AI-generated image authentication device and solution that combines low-dimensional features, high robustness, simple model, and strong generalization. Summary of the Invention

[0008] To address the shortcomings of existing technologies, this invention provides a method and apparatus for generating images for identification. The method compresses images into a small number of one-dimensional discrete tokens, uses token features and their global logical relationships as the core of the identification process, and constructs a lightweight binary classification identification classifier to achieve efficient and robust AI-generated image identification.

[0009] A new generation of one-dimensional image segmenters can compress images into extremely short one-dimensional discrete token sequences (e.g., 32 discrete tokens). This highly compressed latent space not only possesses effective image reconstruction capabilities to meet the requirements of counterfeit detection tasks and accurately preserves the global semantic features of the image, but also shows a significant tendency correlation between the position of each token and the specific global semantic attributes of the image. Specifically, by statistically analyzing the mean features at each token position of image sets of different semantic categories, it can be quantitatively found that for specific semantic division dimensions (e.g., lighting conditions, background texture, object category, etc.), only a few token positions exhibit significant inter-class feature differences, while the remaining positions remain relatively stable. This position-attribute decoupling characteristic means that the one-dimensional discrete token sequence encodes the global semantic information of the image in a highly structured way. Therefore, this invention utilizes this highly compressed one-dimensional discrete token as the core feature for counterfeit detection to construct a lightweight binary classification counterfeit detection classifier to solve the problems of high computational cost, high feature redundancy, and insufficient capture of inconsistencies in high-level semantic logic in existing technologies.

[0010] The technical solution of this invention is as follows:

[0011] In a first aspect, embodiments of this application provide a method for generating image identification, comprising the following steps:

[0012] First, image preprocessing is performed: the input image to be processed is standardized, specifically including size unification, pixel normalization, and format conversion.

[0013] Then, high-compression one-dimensional tokenization processing is performed: a pre-trained one-dimensional image segmenter is used to extract features and spatially map the pre-processed image to obtain a one-dimensional discrete token index sequence.

[0014] Next, token feature enhancement processing is performed: based on the obtained one-dimensional discrete token index sequence, token embedding and position encoding are performed sequentially to preserve the semantic and positional information of the features. Then, through token semantic weighting and cross-token association modeling, an enhanced token feature matrix is ​​generated.

[0015] Then, a lightweight binary classification anti-spoofing classifier is trained based on the generated token feature matrix to achieve efficient determination of image authenticity.

[0016] Finally, during the deployment phase, feature extraction, probability prediction, and threshold determination are sequentially performed on the input image to be detected to output the final authentication result.

[0017] In one possible implementation, the high-compression one-dimensional tokenization process specifically operates as follows:

[0018] The two-dimensional RGB image is encoded by the encoding unit in the publicly available pre-trained 1D image segmenter to generate a one-dimensional continuous feature vector sequence of length N. The one-dimensional continuous feature vector sequence is then vector quantized by the quantization unit in the segmenter and mapped to the segmentation representation result of the corresponding codebook, namely a one-dimensional discrete token index sequence. The length of the token index sequence is consistent with a preset fixed value, and each token index corresponds to a specific D-dimensional vector in the codebook.

[0019] In one possible implementation, the token embedding and positional encoding operations are as follows: The obtained index is mapped to an embedding vector of dimension D through a table lookup operation, and a learnable positional encoding representing sequence order information, consistent with the tokenizer architecture, is introduced. The embedding vector and the positional encoding are then fused element-wise to obtain a basic token feature matrix with positional semantic information.

[0020] In one possible implementation, the token semantic weighting operation is as follows: Utilizing the inherent correspondence between attributes and positions in the one-dimensional image segmenter, by pre-statistically analyzing the feature distribution differences between the real image and the generated image at each token position, specific index positions highly sensitive to generation traces are selected, constructing a sensitive position set S. For each feature vector in the basic token feature matrix, a non-uniform weight coefficient is assigned based on whether its position index belongs to set S; the basic token feature matrix is ​​weighted according to the assigned weight coefficients, and the semantically weighted token feature matrix is ​​obtained through weighted calculation.

[0021] In one possible implementation, the cross-Token association modeling operation is as follows: the semantically weighted Token feature matrix is ​​input into the cross-Token association modeling module consisting of n layers of Transformer encoding blocks, and the enhanced feature matrix that incorporates global context information is output.

[0022] In one possible implementation, the lightweight binary classification spoofing detector consists of a global feature aggregation layer and a decision output layer, and can be flexibly configured according to computing power requirements.

[0023] If, during classifier configuration, the output layer of the lightweight binary classification anti-spoofing classifier adopts a single-layer linear classification structure, then the weighted token feature matrix X' is directly used as the input to the global feature aggregation layer.

[0024] If, during classifier configuration, the output layer of the lightweight binary classification anti-spoofing classifier uses a multilayer perceptron (MLP) or a fully connected structure with multilayer nonlinear mapping capabilities, then the enhanced feature matrix output by the cross-token association modeling module will be used as the input to the global feature aggregation layer.

[0025] In one possible implementation, training is performed using a composite loss function that incorporates a dynamic easy-and-difficult sample mining mechanism. Specifically, based on cross-entropy loss, a Focal Loss weight adjustment term is introduced, the formula of which is expressed as:

[0026]

[0027] in, The probability value predicted by the classifier. This refers to the modulation factor. Adjustment parameters are set accordingly. ,

[0028] The weight of easily classified samples is automatically reduced during training.

[0029] Meanwhile, during the training process, a strategy of separating feature extraction from logical judgment is adopted. Specifically, all parameters of the encoding unit, quantization unit, and codebook in the one-dimensional image segmenter are frozen, making them fixed feature extractors; the training process only updates the learnable positional encoding parameters, the parameters of the cross-token association modeling module, and the parameters of the lightweight binary classification anti-counterfeiting classifier.

[0030] In one possible implementation, the specific steps of the falsification detection reasoning are as follows:

[0031] Feature extraction: The input image to be detected is sequentially processed by image preprocessing, high-compression one-dimensional tokenization, and token feature enhancement to obtain the corresponding enhanced feature matrix.

[0032] Probabilistic prediction: The enhanced feature matrix is ​​input into the trained lightweight binary classification anti-fake image classifier. Through the forward calculation of the classifier, the confidence probability value of the image belonging to the real image is output.

[0033] Threshold Determination: A forgery detection threshold is set, and probability values ​​are compared for determination. If the probability value is not less than the forgery detection threshold, it is determined to be a real image; otherwise, it is determined to be an AI-generated forgery image.

[0034] Output results: The final output includes the authentication conclusion and the corresponding confidence probability value.

[0035] In one possible implementation, to improve the generalization ability and robustness against interference of the counterfeit detection method, this method may optionally include the following enhancement operations. Each enhancement operation can be used independently or in combination, and none of them require modification to the core process of the pre-trained one-dimensional image segmenter and the counterfeit detection method; adaptation is only completed during the classifier training stage:

[0036] Cross-generative model adaptation operation: For newly emerging AI generative models, an efficient parameter fine-tuning strategy is adopted: a small number of images generated by the new algorithm model are collected as fine-tuning sets, the parameters of the global feature aggregation layer in the fake detection classifier are frozen, and only the parameters of the judgment output layer are fine-tuned and trained in small batches.

[0037] Robust operation against noise: During the training phase of the lightweight binary classification anti-spoofing classifier, Gaussian noise is actively injected into the preprocessed image before tokenization and feature extraction.

[0038] Token missing fault tolerance operation: After the feature enhancement processing is completed in the training phase, the token masking operation is randomly performed on the enhanced feature matrix, that is, the feature vector is zeroed or masked according to a preset ratio or number.

[0039] Secondly, embodiments of this application provide an image recognition device, comprising the following modules:

[0040] Image preprocessing module: Standardizes the input image to be processed, specifically including size unification, pixel normalization, and format conversion.

[0041] Feature extraction module: Uses a pre-trained one-dimensional image segmenter to extract features and spatially map the preprocessed image to obtain a one-dimensional discrete token index sequence.

[0042] Feature enhancement module: Based on the obtained one-dimensional discrete token index sequence, token embedding and position encoding are performed sequentially to preserve the semantic and positional information of the features. Then, through token semantic weighting and cross-token association modeling, an enhanced token feature matrix is ​​generated.

[0043] Training module: Based on the generated token feature matrix, a lightweight binary classification anti-spoofing classifier is trained to achieve efficient determination of image authenticity.

[0044] The anti-counterfeiting module sequentially performs feature extraction, probability prediction, and threshold determination on the input image to be detected, and outputs the final anti-counterfeiting result.

[0045] Thirdly, embodiments of this application provide an electronic device, including a processor and a memory.

[0046] The memory is used to store computer programs.

[0047] When the processor executes the program stored in the memory, it implements any of the image generation and identification methods described in this application.

[0048] Fourthly, embodiments of this application provide a computer-readable storage medium storing a computer program, which, when executed by a processor, implements any of the image generation and identification methods described in this application.

[0049] Fifthly, embodiments of this application provide a computer program product containing instructions that, when run on a computer, cause the computer to execute any of the image generation and identification methods described in this application.

[0050] Compared with the prior art, the positive effects of the present invention are as follows:

[0051] 1. High inference efficiency and lightweight deployment: The highly compressed one-dimensional discrete token feature dimension used in this invention is far lower than the pixel / local feature dimension of traditional counterfeit detection methods. This extremely simplified feature input results in a lightweight binary classification counterfeit detection classifier (with parameters controlled within 5 million) with extremely low computational and memory consumption. Experimental data shows that the model inference speed of this method is 5-10 times faster than traditional ResNet or large-scale ViT counterfeit detection architectures. It can be directly adapted to resource-constrained environments such as mobile terminals and edge computing gateways, meeting the real-time, online edge counterfeit detection requirements.

[0052] 2. Robust anti-counterfeiting capabilities and broad coverage: Unlike traditional methods that rely on pixel-level artifacts in local images for identification, this invention executes anti-counterfeiting logic based on global semantic token features. Even if new AI generation models eliminate micro-pixel-level generation traces through technical means, they still struggle to fully simulate the statistical regularities of natural images in terms of macro-semantic distribution (such as physical consistency of light and shadow, and logical coherence of texture). By capturing semantic conflicts between tokens, this invention can accurately identify forged images across different generation models, effectively solving the generalization pain point of "model updates leading to failure" in the field of AI anti-counterfeiting.

[0053] 3. Low training cost and high data utilization: There is no need to train a complex image feature extraction network from scratch. The pre-trained one-dimensional image segmenter can be directly reused. Only a lightweight binary classification anti-counterfeiting classifier needs to be trained. All parameters of the segmenter are frozen during the training process, which greatly reduces the consumption of computing resources. A small-scale real and AI-generated image dataset can enable the model to achieve a high anti-counterfeiting accuracy, reducing data annotation and computing resource consumption.

[0054] 4. Excellent interpretability in forgery detection, overcoming the limitations of black-box models: This invention utilizes the clear position-attribute correspondence between one-dimensional discrete token positions and global image attributes (such as scene lighting, background material, subject pose, etc.), giving forgery detection decisions clear interpretability. By extracting the attention weights or feature importance scores from the cross-token association modeling stage within the classifier, the core dimensions that lead to an image being judged as "forged" can be intuitively output (e.g., a mismatch between the detected lighting token and background attributes). This feature effectively solves the industry problem of unclear judgment criteria and difficulty in traceability of results in traditional deep learning models, improving the credibility and practicality of the forgery detection system. Attached Figure Description

[0055] The accompanying drawings, which are provided to further illustrate the invention and constitute a part of this invention, are illustrative embodiments of the invention and their descriptions are used to explain the invention and do not constitute an undue limitation of the invention.

[0056] Figure 1 This is a flowchart of the image identification method according to an embodiment of the present invention.

[0057] Figure 2 This is a schematic diagram of the highly compressed one-dimensional tokenization process according to an embodiment of the present invention.

[0058] Figure 3 This is a schematic diagram of the lightweight binary classification fake-detection classifier in an embodiment of the present invention.

[0059] Figure 4 This is an example of an application scenario of an embodiment of the present invention. Detailed Implementation

[0060] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.

[0061] like Figure 1 As shown, an image recognition method includes the following steps:

[0062] Step 1: Image Preprocessing. The input image to be processed (real image or image to be identified for artifact detection) undergoes standardization processing, specifically including:

[0063] Uniform size: Scale the images to a fixed resolution to ensure that the image specifications of the input word segmenter are consistent.

[0064] Pixel normalization: Maps pixel values ​​to the [0,1] range and eliminates differences in lighting, contrast, etc.

[0065] Format conversion: Converts images into input tensor formats supported by the one-dimensional image tokenizer.

[0066] Step 2: High-compression one-dimensional tokenization processing.

[0067] The pre-trained one-dimensional image segmenter is used to extract features and perform spatial mapping on the preprocessed image I to obtain a one-dimensional discrete token index sequence.

[0068] Specifically, such as Figure 2 As shown, the two-dimensional RGB image is encoded using the encoding unit in a publicly available pre-trained 1D image segmenter, generating a one-dimensional continuous feature vector sequence of length N, where N is a preset fixed value. Subsequently, the quantization unit in the segmenter performs vector quantization (VQ) on this one-dimensional continuous feature vector sequence, mapping it to the segmentation representation result of the corresponding codebook, i.e., a one-dimensional discrete token index sequence. Specifically, it is expressed as follows:

[0069]

[0070] In this invention, K=N, meaning the length of the Token index sequence is consistent with a preset fixed value, and each Token index... A specific D-dimensional vector in the codebook D ,Right now:

[0071]

[0072] Each token captures a certain global semantic attribute of the image, thereby transforming high-dimensional pixel information into a low-dimensional, high-semantic one-dimensional sequence feature representation.

[0073] Step 3: Token feature enhancement processing.

[0074] Based on the one-dimensional discrete token index sequence obtained in step 2 The token embedding and position encoding are performed sequentially to preserve the semantic and positional information of the features. Then, through token semantic weighting and cross-token association modeling, the key information in the sequence that plays a core role in the anti-counterfeiting task is highlighted. The aim is to extract deep anti-counterfeiting features from discrete index sequences and finally generate an enhanced token feature matrix, which serves as the input features for a subsequent lightweight binary anti-counterfeiting classifier.

[0075] Specifically, the token embedding and location encoding operations are as follows:

[0076] The obtained index is obtained through table lookup operation. Mapped to an embedding vector of dimension D It also introduces learnable positional encodings that represent sequence order information, consistent with the tokenizer architecture. The embedding vector and positional encoding are fused element-wise to obtain a basic token feature matrix with positional semantic information. As input features for subsequent semantic weighting of tokens, it retains the inherent characteristics of tokens at different locations corresponding to different global image attributes.

[0077] The token semantic weighting operation is as follows: Utilizing the inherent correspondence between attributes and positions in the one-dimensional image segmenter, by pre-statistically analyzing the feature distribution differences between the real image and the generated image at each token position, specific index positions highly sensitive to generation traces, such as illumination coherence, texture consistency, and image quality, are selected, and a sensitive position set S is constructed. This is then applied to the basic token feature matrix. Each feature vector in Based on whether its position index i belongs to set S, a non-uniform weight coefficient is assigned. :like Then assign a higher weighting coefficient. ;like Then assign a lower weighting coefficient. ;set up , indicating the first Each location contains a feature vector with location semantic information, which is used to construct the basic token feature matrix. Weighted processing is performed, and the semantically weighted token feature matrix is ​​obtained by calculating WI⋅FI. .

[0078] The cross-token association modeling operation is as follows: The weighted token feature matrix X′ is input into a cross-token association modeling module consisting of n layers (where n≥1) of Transformer encoding blocks. Within each encoding block, features at different positions in the sequence are calculated using a multi-head self-attention (MHSA) mechanism. The association weights between features are used to extract long-range dependencies across locations, and then non-linearly map these features using a feed-forward network (FFN). The cross-token association modeling module aims to jointly encode the co-occurrence probability and logical consistency of different global semantic features (such as light source direction attributes and shadow distribution attributes) to extract statistical anomalies in AI-generated images across semantic attributes. Finally, an enhanced feature matrix incorporating global contextual information is output. This completes the entire token feature enhancement process and serves as the basis for judgment in the subsequent lightweight binary classification anti-counterfeiting classifier.

[0079] Step 4: Training a lightweight binary classification fake-detection classifier.

[0080] Based on the enhanced feature matrix generated in step 3 The following steps are used to train a lightweight binary classification anti-spoofing classifier, enabling efficient determination of image authenticity.

[0081] Specifically, the lightweight binary classification spoofing detector consists of a global feature aggregation layer and a decision output layer, and can be flexibly configured according to computing power requirements:

[0082] If, during classifier configuration, the output layer of the lightweight binary classification anti-spoofing classifier adopts a single-layer linear classification structure, then the weighted token feature matrix X' is directly used as the input to the global feature aggregation layer. The global feature aggregation layer performs dimensional compression operations such as flattening or global pooling on the enhanced feature matrix to extract a one-dimensional global feature vector representing the semantic logic of the entire image. The output layer directly maps this one-dimensional global feature vector to output the confidence probability value of the image to be detected.

[0083] If, during classifier configuration, the output layer of the lightweight binary classification anti-spoofing classifier uses a multilayer perceptron (MLP) or a fully connected structure with multilayer nonlinear mapping capabilities, then the enhanced feature matrix output by the cross-token association modeling module is used as the input to the global feature aggregation layer. The global feature aggregation layer extracts specific classification feature vectors or performs dimensionality reduction. The output layer performs nonlinear mapping and outputs the confidence probability value indicating whether the detected image belongs to a real image (label 0) or an AI-generated image (label 1).

[0084] During training, a composite loss function incorporating a dynamic difficulty-sample mining mechanism is used. Specifically, based on Cross Entropy Loss, a Focal Loss weight adjustment term is introduced, the formula of which is expressed as:

[0085]

[0086] in, The probability value predicted by the classifier. This refers to the modulation factor. Adjustment parameters are set accordingly. ,

[0087] During training, the weight of easily classified samples is automatically reduced, while the attention given to difficult-to-classify samples (i.e., AI-forged samples that are visually extremely close to the real ones) is increased, thereby solving the problems of uneven distribution of positive and negative samples and difficulty in identifying edge samples in the forgery detection task.

[0088] Simultaneously, a strategy of separating feature extraction and logical judgment is adopted during training. Specifically, since the one-dimensional image segmenter already possesses mature discrete latent space representation capabilities, this step completely freezes all parameters of the encoding unit, quantization unit, and codebook in the one-dimensional image segmenter, making it a fixed feature extractor. The training process only updates the learnable positional encoding parameters introduced in step 3, the parameters of the cross-Token association modeling module, and the parameters of the lightweight binary classification anti-spoofing classifier (i.e., the global feature aggregation layer and the judgment output layer) mentioned in step 4, thereby significantly reducing computational overhead and training costs, ensuring that the model can quickly converge and focus on learning the differences in token feature patterns in the discrete latent space.

[0089] In terms of optimization strategy, the Adam optimizer is used, and the initial learning rate is set at... to The iteration count is between 100 and 200 rounds. An early stopping strategy is introduced: after each training round, the classification accuracy is evaluated on an independent validation set. If the accuracy does not show a significant improvement after 10 consecutive rounds, the training is terminated early and the parameters of the best-performing model on the validation set are saved. This is to prevent the model from overfitting to a specific generation algorithm and to improve the generalization performance of the fake detection device.

[0090] Step 5: Authentication and Reasoning.

[0091] During the application deployment phase, the input image to be detected undergoes a series of steps: feature extraction, probability prediction, and threshold determination, to output the final authentication result. The specific steps are as follows:

[0092] Feature extraction: The image preprocessing, high-compression one-dimensional tokenization, and token feature enhancement processes described in steps 1 to 3 are sequentially performed on the input image to be detected to obtain the corresponding enhanced feature matrix. .

[0093] Probabilistic prediction: the enhanced feature matrix The input is fed into a trained lightweight binary classification anti-fake image classifier. Through the forward computation of the classifier, the confidence probability value that the image belongs to the real image is output. .

[0094] Threshold determination: Set the falsification determination threshold. (in ), for probability values Compare and determine. If If the threshold is met, it is considered a real image; otherwise, it is considered an AI-generated fake image. The threshold value is... The ROC curve and Youden index based on the validation set are predetermined, with an optimal value range of 0.5-0.8, and the tolerance for false positive rate (FPR) can be dynamically adjusted according to the application scenario.

[0095] Output: The final output includes the authentication conclusion (real / fake) and the corresponding confidence probability value. .

[0096] Furthermore, to enhance the generalization ability and robustness against interference of the anti-spoofing method, this method may optionally include the following enhancement operations. Each enhancement operation can be used independently or in combination, and none of them require modification to the core process of the pre-trained one-dimensional image segmenter and the anti-spoofing method; adaptation is only completed during the classifier training stage:

[0097] Cross-generative model adaptation: For newly emerging AI generative models, an efficient parameter fine-tuning strategy is adopted: a small number (e.g., 100-500 images) generated by the new algorithm model are collected as a fine-tuning set, the parameters of the global feature aggregation layer in the fake-detection classifier are frozen, and only the parameters of the judgment output layer are fine-tuned in small batches (e.g., iterated 20 to 50 times). This achieves rapid coverage of unknown new algorithms without retraining the core feature extraction chain.

[0098] Robust operation against noise: During the training phase of the lightweight binary classification anti-spoofing classifier, Gaussian noise (standard deviation) is actively injected into the preprocessed image. Then, tokenization and feature extraction are performed. This synchronous training process forces the classifier to learn stable semantic features under pixel perturbations, enabling it to resist adversarial evasion attacks by modifying local pixels or adding filters.

[0099] Token missing fault tolerance operation: After the feature augmentation process is completed during the training phase, the augmented feature matrix is... Randomly perform token masking operations, that is, zero out or mask the feature vector according to a preset ratio or number (such as randomly selecting 1 to 2 positions). By simulating feature loss scenarios caused by transmission packet loss or limited computing power during the training phase, the robustness of the classifier's decision-making under incomplete feature input is improved, ensuring that accurate identification can still be maintained even if a small number of tokens are lost in the engineering deployment.

[0100] Example 1: Basic Authentication Scheme (Lightweight Deployment Adapted to Edge Devices)

[0101] This embodiment provides a basic authentication scheme based on linear classification structures (such as logistic regression), aiming to meet the authentication needs of devices with extremely limited computing power, such as mobile terminals and edge gateways, with extremely low computational overhead. The specific implementation steps of this embodiment strictly correspond to the method flow of this invention:

[0102] 1. Dataset Preparation and Annotation. A labeled dataset covering multiple generation algorithms was constructed. Real images were selected from 10,000 images in the ImageNet validation set; forged images included: 5,000 images generated using Stable Diffusion (with prompts semantically matched to real images), 3,000 images generated using MidJourney, and 2,000 images directly generated by a one-dimensional image segmenter. The dataset was divided into training and validation sets in an 8:2 ratio, and binary classification labels were applied.

[0103] 2. Image preprocessing. The image to be detected is standardized by scaling it to a resolution of 256×256; normalization is performed to map pixel values ​​to the range of [0, 1], and mean subtraction and standard deviation are performed to eliminate environmental noise; finally, the processed image is converted into a tensor format supported by the word segmenter.

[0104] 3. High-compression one-dimensional tokenization and feature enhancement processing. A pre-trained TiTok-L-32 one-dimensional image tokenizer is used. After inputting the pre-processed image, a 32-dimensional discrete token index sequence is generated through encoding and quantization units. Token feature enhancement is then performed. Each index is mapped to a 512-dimensional embedding vector through a lookup table operation, incorporating learnable positional encoding parameters. Based on a pre-statistical set of sensitive locations, non-uniform token semantic weighting is applied to each feature vector to obtain... The token feature matrix. Since this embodiment is designed for extremely low computing power scenarios, the cross-token association modeling operation is skipped, and the weighted token feature matrix is ​​directly passed to the next step as an enhanced feature matrix.

[0105] 4. Training a lightweight binary classifier for detecting fake data.

[0106] Architecture Construction: For the input 32×512 enhanced feature matrix, the global feature aggregation layer performs a flattening operation, compressing it into... The one-dimensional global feature vector is used; the output layer adopts a single-layer linear classification structure (logistic regression model) and directly connects to this one-dimensional global feature vector.

[0107] Model Training: A composite loss function combining cross-entropy loss and Focal Loss is employed to improve the ability to capture difficult-to-classify forged samples. The Adam optimizer is used with a learning rate of 0.001. During the training phase, all parameters of the word segmenter are completely frozen, and only the learnable positional encoding parameters introduced in step 3 and the weight parameters of the single-layer linear classification structure described in step 4 are updated. An early stopping strategy is introduced: if the accuracy on the validation set does not improve for 10 consecutive rounds, training is terminated to ensure that the model has good generalization ability with a small number of parameters.

[0108] 5. Authentication Reasoning and Interpretable Output. Taking the uploaded image of a "deer in the forest" as an example:

[0109] Reasoning process: The image is obtained after preprocessing and tokenization. A 3D feature vector is input to a trained single-layer linear classifier, which outputs a confidence probability value that the image is a real image. .

[0110] Judgment result: Set threshold ,because The image was determined to be an AI-generated fake.

[0111] Interpretability analysis: Backtracking was performed using the absolute value distribution of the weights of a linear classifier to calculate the sum of the absolute values ​​of the weights of each of the 32 token positions to the final decision, which was taken as the contribution of that token to the decision. The results showed that positions 27 (background material token) and 31 (scene lighting token) had the highest contributions.

[0112] Conclusion Output: The system outputs the authentication conclusion and explanation: It is determined to be a fake image; the core basis is that the background material features are significantly different from the semantic distribution of the real forest scene, and the global distribution of the illumination token does not conform to the statistical law of the natural scene.

[0113] Example 2: Enhanced Authentication Scheme (Adapted for High Precision and Cross-Model Generalization on the Server Side)

[0114] This embodiment aims to adapt to the need for high-precision and highly generalizable anti-spoofing in scenarios with sufficient computing power, such as cloud servers. Based on the complete execution of all optional enhancement processes of this invention, a cross-generative model adaptation module is integrated, as detailed below:

[0115] 1. Classifier Architecture. This embodiment employs a complete feature extraction and judgment network, using a miniature Transformer anti-counterfeiting classifier that includes a Transformer encoding layer. This classifier serves as a lightweight binary classification anti-counterfeiting component in the overall anti-counterfeiting process, with the following architecture: ① Network Structure: Contains 4 Transformer Encoder layers, each with 2 attention heads, and a hidden layer dimension of 128; ② Input / Output: Directly inputs a 32×512 dimensional token feature matrix without flattening, capturing semantic co-occurrence dependencies between tokens through a multi-layer, multi-head self-attention mechanism; ③ Model Size: The overall parameter count is approximately 4.8 million, maintaining lightweight characteristics and requiring no modification to the highly compressed one-dimensional tokenization process.

[0116] 2. Cross-Generative Model Adaptation Module Integration and Training. To improve the generalization ability of the anti-spoofing scheme to novel AI generative models, this embodiment integrates a cross-generative model adaptation module. The specific process is as follows:

[0117] Fine-tuning Dataset Construction: Based on the dataset from Example 1, 2000 additional images generated by other models (such as DALL-E 3) were collected and labeled as AI-generated. These new images were then mixed with the validation set from Example 1 to construct a fine-tuning dataset for adaptation.

[0118] Parameter Efficient Fine-Tuning (PEFT) Strategy: During the fine-tuning training phase, all parameters of the pre-trained TiTok-L-32 one-dimensional image segmenter are frozen. Simultaneously, all network parameters in the miniature Transformer anti-spoofing classifier, except for the final fully connected layer of the classification layer, are frozen; only the parameters of the final fully connected layer of the classification layer are unfrozen and updated.

[0119] Fine-tuning training: The Adam optimizer was selected, and the fine-tuning learning rate was set to 0.0001. The training was iteratively conducted for 20 rounds on the fine-tuning dataset.

[0120] Adaptation effect: This efficient parameter fine-tuning strategy enables the anti-spoofing model to quickly adapt to and accurately identify forged images generated by new generative models with extremely low computational cost and training time, significantly improving the real-time iteration capability and robustness of the solution.

[0121] In the above technical solutions of the present invention, the parts not described in detail can all be implemented using existing technologies known in the art. The embodiments provided by the present invention are only used to illustrate the technical solutions and application effects of the present invention, and are not intended to limit the scope of protection of the present invention.

[0122] In this invention, the choice of classifier can be flexibly adjusted according to the resource situation of the deployed device. The logistic regression classifier is suitable for edge devices with extremely low computing power, such as mobile phones and edge gateways, while the micro Transformer classifier is suitable for high-precision and high-generalization scenarios such as cloud servers.

[0123] In this invention, the specific architecture of the lightweight binary classification anti-spoofing classifier can be flexibly adjusted and configured according to the computing resources of the actual deployment terminal. For example, in computing-constrained devices such as mobile terminals and edge computing gateways, linear classification structures such as logistic regression can be preferentially selected to ensure extremely high inference efficiency; in high-performance computing scenarios such as cloud servers, structures such as miniature Transformers containing multi-head self-attention mechanisms can be selected to pursue higher discrimination accuracy and cross-model generalization performance.

[0124] The one-dimensional image tokenizer used in this invention is not limited to the TiTok series models mentioned in the text. Any one-dimensional image tokenizer that supports high compression and is based on a vector quantization architecture can be used as the feature extraction core of this invention. Its core technical principle is that the tokenizer can represent an image as an extremely short one-dimensional discrete token sequence (preferably with a sequence length of...). It also has the ability to capture global semantic attributes of images. (Token quantity) The specific value can be dynamically adjusted according to the real-time and accuracy requirements of the authentication task. The core is to achieve low complexity and high efficiency of the authentication process by maintaining a high compression ratio.

[0125] The technical solution of this invention essentially utilizes highly compressed one-dimensional discrete latent space features to fundamentally simplify the logical complexity of AI image authentication tasks. At the same time, it leverages the global semantic attributes of tokens to improve authentication robustness, overcoming the pain points of traditional authentication methods that rely on local pixel artifacts, have poor generalization, and high deployment costs. This provides a new paradigm of high efficiency and low cost for AI-generated image authentication.

[0126] This application also provides an image recognition device, including the following modules:

[0127] Image preprocessing module: Standardizes the input image to be processed, specifically including size unification, pixel normalization, and format conversion.

[0128] Feature extraction module: Uses a pre-trained one-dimensional image segmenter to extract features and spatially map the preprocessed image to obtain a one-dimensional discrete token index sequence.

[0129] Feature enhancement module: Based on the obtained one-dimensional discrete token index sequence, token embedding and position encoding are performed sequentially to preserve the semantic and positional information of the features. Then, through token semantic weighting and cross-token association modeling, an enhanced token feature matrix is ​​generated.

[0130] Training module: Based on the generated token feature matrix, a lightweight binary classification anti-spoofing classifier is trained to achieve efficient determination of image authenticity.

[0131] The anti-counterfeiting module sequentially performs feature extraction, probability prediction, and threshold determination on the input image to be detected, and outputs the final anti-counterfeiting result.

[0132] In one possible implementation, the feature extraction module operates as follows:

[0133] The two-dimensional RGB image is encoded by the encoding unit in the publicly available pre-trained 1D image segmenter to generate a one-dimensional continuous feature vector sequence of length N. The one-dimensional continuous feature vector sequence is then vector quantized by the quantization unit in the segmenter and mapped to the segmentation representation result of the corresponding codebook, namely a one-dimensional discrete token index sequence. The length of the token index sequence is consistent with a preset fixed value, and each token index corresponds to a specific D-dimensional vector in the codebook.

[0134] In one possible implementation, the token embedding and positional encoding operations are as follows: The obtained index is mapped to an embedding vector of dimension D through a table lookup operation, and a learnable positional encoding representing sequence order information, consistent with the tokenizer architecture, is introduced. The embedding vector and the positional encoding are then fused element-wise to obtain a basic token feature matrix with positional semantic information.

[0135] In one possible implementation, the token semantic weighting operation is as follows: Utilizing the inherent correspondence between attributes and positions in the one-dimensional image segmenter, by pre-statistically analyzing the feature distribution differences between the real image and the generated image at each token position, specific index positions highly sensitive to generation traces are selected, constructing a sensitive position set S. For each feature vector in the basic token feature matrix, a non-uniform weight coefficient is assigned based on whether its position index belongs to set S; the basic token feature matrix is ​​weighted according to the assigned weight coefficients, and the semantically weighted token feature matrix is ​​obtained through weighted calculation.

[0136] In one possible implementation, the cross-Token association modeling operation is as follows: the semantically weighted Token feature matrix is ​​input into the cross-Token association modeling module consisting of n layers of Transformer encoding blocks, and the enhanced feature matrix that incorporates global context information is output.

[0137] In one possible implementation, the lightweight binary classification spoofing detector consists of a global feature aggregation layer and a decision output layer, and can be flexibly configured according to computing power requirements.

[0138] If, during classifier configuration, the output layer of the lightweight binary classification anti-spoofing classifier adopts a single-layer linear classification structure, then the weighted token feature matrix X' is directly used as the input to the global feature aggregation layer.

[0139] If, during classifier configuration, the output layer of the lightweight binary classification anti-spoofing classifier uses a multilayer perceptron (MLP) or a fully connected structure with multilayer nonlinear mapping capabilities, then the enhanced feature matrix output by the cross-token association modeling module will be used as the input to the global feature aggregation layer.

[0140] In one possible implementation, the training module is trained using a composite loss function that incorporates a dynamic easy-and-difficult sample mining mechanism. Specifically, based on cross-entropy loss, a Focal Loss weight adjustment term is introduced, the formula of which is expressed as:

[0141]

[0142] in, The probability value predicted by the classifier. This refers to the modulation factor. Adjustment parameters are set accordingly. ,

[0143] The weight of easily classified samples is automatically reduced during training.

[0144] Meanwhile, during the training process, a strategy of separating feature extraction from logical judgment is adopted. Specifically, all parameters of the encoding unit, quantization unit, and codebook in the one-dimensional image segmenter are frozen, making them fixed feature extractors; the training process only updates the learnable positional encoding parameters, the parameters of the cross-token association modeling module, and the parameters of the lightweight binary classification anti-counterfeiting classifier.

[0145] In one possible implementation, the counterfeit detection module operates as follows:

[0146] Feature extraction: The input image to be detected is processed sequentially by the image preprocessing module, the feature extraction module, and the feature enhancement module to obtain the corresponding enhanced feature matrix.

[0147] Probabilistic prediction: The enhanced feature matrix is ​​input into the trained lightweight binary classification anti-fake image classifier. Through the forward calculation of the classifier, the confidence probability value of the image belonging to the real image is output.

[0148] Threshold Determination: A forgery detection threshold is set, and probability values ​​are compared for determination. If the probability value is not less than the forgery detection threshold, it is determined to be a real image; otherwise, it is determined to be an AI-generated forgery image.

[0149] Output results: The final output includes the authentication conclusion and the corresponding confidence probability value.

[0150] In one possible implementation, to improve the generalization ability and anti-interference robustness of the counterfeit detection method, the device may optionally include the following enhancement modules. Each enhancement module can be accessed independently or used in combination, and none of them require modification to the core process of the pre-trained one-dimensional image segmenter and the counterfeit detection method; adaptation is only completed during the classifier training phase:

[0151] Cross-generative model adaptation module: For newly emerging AI generative models, an efficient parameter fine-tuning strategy is adopted: a small number of images generated by the new algorithm model are collected as fine-tuning sets, the parameters of the global feature aggregation layer in the fake detection classifier are frozen, and only the parameters of the judgment output layer are fine-tuned and trained in small batches.

[0152] Noise-resistant robust module: During the training phase of the lightweight binary classification anti-spoofing classifier, Gaussian noise is actively injected into the preprocessed image before tokenization and feature extraction.

[0153] Token Missing Fault Tolerance Module: After the feature enhancement processing is completed during the training phase, a token masking operation is randomly performed on the enhanced feature matrix, that is, the feature vector is zeroed or masked according to a preset ratio or number.

[0154] This application also provides an electronic device, including a processor and a memory.

[0155] The memory is used to store computer programs.

[0156] When the processor executes a program stored in the memory, it implements any of the methods described in this application.

[0157] In one possible implementation, the electronic device of this application embodiment further includes a communication interface and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus.

[0158] The communication bus mentioned in the above electronic devices can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This communication bus can be divided into address bus, data bus, control bus, etc.

[0159] The communication interface is used for communication between the aforementioned electronic devices and other devices.

[0160] The memory may include random access memory (RAM) or non-volatile memory (NVM), such as at least one disk storage device. Optionally, the memory may also be at least one storage device located remotely from the aforementioned processor.

[0161] 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.

[0162] In another embodiment provided in this application, a computer-readable storage medium is also provided, which stores a computer program that, when executed by a processor, implements any of the methods described in this application.

[0163] In another embodiment provided in this application, a computer program product containing instructions is also provided, which, when run on a computer, causes the computer to perform any of the methods described in this application.

[0164] In the above embodiments, implementation can be achieved entirely or partially through software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented entirely or partially in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center 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 can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid state disk (SSD)).

[0165] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0166] The various embodiments in this specification are described in a related manner. Each embodiment focuses on the differences from other embodiments, and the same or similar parts between the various embodiments can be referred to each other.

[0167] The above description is merely a preferred embodiment of this application and is not intended to limit the scope of protection of this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application are included within the scope of protection of this application.

Claims

1. A method for generating image identification, characterized in that, Includes the following steps: First, image preprocessing is performed: the input image to be processed is standardized, specifically including size unification, pixel normalization, and format conversion; Then, perform high-compression one-dimensional tokenization processing: use a pre-trained one-dimensional image segmenter to extract features and spatially map the pre-processed image to obtain a one-dimensional discrete token index sequence; Then, token feature enhancement processing is performed: based on the obtained one-dimensional discrete token index sequence, token embedding and position encoding are performed in sequence to preserve the semantic and positional information of the features. Then, through token semantic weighting and cross-token association modeling, an enhanced token feature matrix is ​​generated. Then, a lightweight binary classification anti-spoofing classifier is trained based on the generated token feature matrix to achieve efficient determination of image authenticity. Finally, during the deployment phase, feature extraction, probability prediction, and threshold determination are sequentially performed on the input image to be detected to output the final authentication result.

2. The image generation and identification method according to claim 1, characterized in that, The specific steps for high-compression one-dimensional tokenization are as follows: The two-dimensional RGB image is encoded by the encoding unit in the publicly available pre-trained 1D image segmenter to generate a one-dimensional continuous feature vector sequence of length N. The one-dimensional continuous feature vector sequence is then vector quantized by the quantization unit in the segmenter and mapped to the segmentation representation result of the corresponding codebook, namely a one-dimensional discrete token index sequence. The length of the token index sequence is consistent with a preset fixed value, and each token index corresponds to a specific D-dimensional vector in the codebook.

3. The image generation and identification method according to claim 1, characterized in that, The token embedding and position encoding operations are as follows: the obtained index is mapped to an embedding vector of dimension D through a table lookup operation, and a learnable position encoding that represents sequence order information is introduced, consistent with the token segmenter architecture; the embedding vector and the position encoding are fused element-wise to obtain a basic token feature matrix with position semantic information.

4. The image generation and identification method according to claim 3, characterized in that, The semantic weighting operation of the token is as follows: Utilizing the inherent correspondence between attributes and positions in the one-dimensional image segmenter, by pre-statistically analyzing the differences in feature distribution between the real image and the generated image at each token position, specific index positions that are highly sensitive to generation traces are selected, and a sensitive position set S is constructed; for each feature vector in the basic token feature matrix, a non-uniform weight coefficient is assigned according to whether its position index belongs to set S; the basic token feature matrix is ​​weighted according to the assigned weight coefficients, and the semantically weighted token feature matrix is ​​obtained through weighted calculation.

5. The image generation and identification method according to claim 4, characterized in that, The cross-Token association modeling operation is as follows: the semantically weighted Token feature matrix is ​​input into the cross-Token association modeling module consisting of n layers of Transformer encoding blocks, and the output is an enhanced feature matrix that incorporates global context information.

6. The image generation and identification method according to claim 5, characterized in that, The lightweight binary classification spoofing detector consists of a global feature aggregation layer and a decision output layer, and can be flexibly configured according to computing power requirements. If, during classifier configuration, the output layer of the lightweight binary classification anti-counterfeiting classifier adopts a single-layer linear classification structure, then the weighted token feature matrix X' is directly used as the input to the global feature aggregation layer. If, during classifier configuration, the output layer of the lightweight binary classification anti-spoofing classifier uses a multilayer perceptron or a fully connected structure with multilayer nonlinear mapping capabilities, then the enhanced feature matrix output by the cross-Token association modeling module will be used as the input to the global feature aggregation layer.

7. The image generation and identification method according to claim 6, characterized in that, During training, a composite loss function integrating dynamic easy and difficult sample mining mechanisms is used; specifically, based on cross-entropy loss, a Focal Loss weight adjustment term is introduced, the formula of which is expressed as: in, The probability value predicted by the classifier. The modulation factor; adjusted by setting parameters. , The weight of easily classified samples is automatically reduced during training. Meanwhile, during the training process, a strategy of separating feature extraction and logical judgment is adopted; specifically, all parameters of the encoding unit, quantization unit and codebook in the one-dimensional image segmenter are frozen, making them fixed feature extractors; the training process only updates the learnable position encoding parameters, the cross-token association modeling module parameters and the parameters of the lightweight binary classification anti-counterfeiting classifier.

8. The image generation and identification method according to claim 1, characterized in that, The specific steps of the authentication reasoning are as follows: Feature extraction: The input image to be detected is sequentially processed by image preprocessing, high-compression one-dimensional tokenization, and token feature enhancement to obtain the corresponding enhanced feature matrix; Probabilistic prediction: The enhanced feature matrix is ​​input into the trained lightweight binary classification anti-fake classifier. Through the forward calculation of the classifier, the confidence probability value of the image belonging to the real image is output. Threshold determination: Set a threshold for counterfeit detection and compare probability values ​​to make a determination; If the probability value is not less than the fakeness detection threshold, it is determined to be a real image; otherwise, it is determined to be an AI-generated fake image. Output results: The final output includes the authentication conclusion and the corresponding confidence probability value.

9. The image generation and identification method according to claim 1, characterized in that, The method may also optionally include the following enhancement operations; each enhancement operation can be used independently or in combination, and none of them require modification to the core process of the pre-trained one-dimensional image segmenter and the anti-spoofing method, with adaptation only completed during the classifier training stage: Cross-generative model adaptation operation: For newly emerging AI generative models, adopt an efficient parameter fine-tuning strategy: collect a small number of images generated by the new algorithm model as a fine-tuning set, freeze the parameters of the global feature aggregation layer in the fake detection classifier, and only perform small-batch fine-tuning training on the parameters of the judgment output layer. Robust operation against noise: During the training phase of the lightweight binary classification anti-spoofing classifier, Gaussian noise is actively injected into the preprocessed image before tokenization and feature extraction. Token missing fault tolerance operation: After the feature enhancement processing is completed in the training phase, the token masking operation is randomly performed on the enhanced feature matrix, that is, the feature vector is zeroed or masked according to a preset ratio or number.

10. An image recognition device, characterized in that, Includes the following modules: Image preprocessing module: performs standardization processing on the input image to be processed, specifically including size unification, pixel normalization, and format conversion; Feature extraction module: Uses a pre-trained one-dimensional image segmenter to extract features and spatially map the pre-processed image to obtain a one-dimensional discrete token index sequence; Feature enhancement module: Based on the obtained one-dimensional discrete token index sequence, token embedding and position encoding are performed sequentially to preserve the semantic and positional information of the features. Then, through token semantic weighting and cross-token association modeling, an enhanced token feature matrix is ​​generated. Training module: Based on the generated token feature matrix, a lightweight binary classification anti-spoofing classifier is trained to achieve efficient determination of image authenticity; The anti-counterfeiting module sequentially performs feature extraction, probability prediction, and threshold determination on the input image to be detected, and outputs the final anti-counterfeiting result.