                                   Few-Shot Learner Generalizes Across AI-Generated Image Detection

             100

                  90

                  80
   Accuracy (%)




                  70                       Midjourney
                                            GLIDE
                  60                         ADM
                                              SD                                      (a) FSD                    (b) Binary Classifier
                  50                        VQDM                           Figure 6. Visualization of network features for our FSD (a) and
                                            BigGAN                         a binary classifier (b) on the ADM class. In the feature space of
                       1   3 5 10        25 50 100 200                     FSD, images from the unseen class in purple are tightly clustered
                                                                           together. However, they are significantly more dispersed in the
                           Number of shots per class
                                                                           feature space of the binary classifier.
Figure 5. Influence of the number of shots. Each classifier is
trained on those subsets excluding the test one. The 10-shot setting       in purple also cluster together in the visualization picture.
is the most cost-effective setting across all categories.                  In contrast, the traditional binary classifier fails to distin-
                                                                           guish images from Midjourney and Stable Diffusion, as
between the support set and the query set. The results are                 shown in Figure 6(b). The unseen samples in purple are
shown in Figure 5. Each line represents the performance of                 quite dispersed, failing to form a compact cluster. Thus,
one classifier across varying sizes of support set.                        distinguishing them from the real ones can be extremely
                                                                           difficult. This fact indicates that our method possesses a
From Figure 5, we can see that using more support samples
                                                                           certain ability to extract intra-category commonality from
results in better performance. However, it also increases the
                                                                           unseen classes, thereby enabling an accurate differentiation
required computational resources. We find that detecting
                                                                           among various classes. Moreover, we find that it is difficult
with 10 shots achieves an optimal balance between per-
                                                                           for a classifier to distinguish samples from Stable Diffusion
formance and resource consumption for most of the test
                                                                           V1.4 and Stable Diffusion V1.5. One plausible explana-
classes. For example, our model brings the accuracy on
                                                                           tion could be the shared usage of an identical backbone
the ADM class from 62.6% to 79.2% when increasing the
                                                                           and VAE, which makes their products highly similar. This
number of shots from 1 to 10, with an improvement of
                                                                           implies that we should carefully select the representative
+16.6%. However, it achieves 81.7% accuracy when us-
                                                                           generative models to build the training set, which we leave
ing 200 shots, gaining only an increase of +2.5% over the
                                                                           for future work.
10-shots scenario. As it is easy to collect 10 samples from
online generative models and the computational cost is very
low, we ultimately decide to use the 10-shots results of FSD               5. Conclusion and Limitations
for comparison.
                                                                           The key point of detecting fake images in real-world sce-
Impact of the multi-class classification. Different from                   narios is to make full use of the limited number of images
previous studies that treat the fake images as a single class              from unseen generative models. In this paper, we propose
and train a binary classifier to detect them, we categorize                the Few-Shot Detector (FSD), a novel AI-generated image
the images from different generators as distinct classes. We               detector based on few-shot learning. Experiments show that
argue that distinguishing images from different generators                 FSD achieves state-of-the-art performance in synthetic im-
can also benefit the detection performance. Thus, we train                 age detection with only 10 samples from the test generators,
another binary classifier and compare it with our method on                demonstrating the strong generalization ability of our model.
the ADM class, which is difficult to distinguish according                 We visualize the feature space to highlight the advantage of
to our experiments. Both classifiers utilize the ResNet-                   categorizing synthetic images by their sources, an approach
50 as the backbone and both of them are trained on the                     that has not been widely adopted in previous studies.
dataset excluding the ADM class. We also apply the t-
                                                                           However, our method still suffers from a few limitations.
SNE visualization and randomly select 1024 samples for
                                                                           Since it is not feasible to obtain few-shot samples from
visualizing. Features of the binary classifier are extracted
                                                                           all generative models, our collection of synthetic images
from the output layer of the ResNet-50, with dimensions of
                                                                           is confined to part of these models, which may lead to a
2048. The visualization results are shown in Figure 6.
                                                                           decrease in detection performance. Another weakness is that
Figure 6(a) shows that our FSD successfully distinguishes                  our method does not perform satisfactorily when detecting
those images across different classes which have been used                 images from a vastly different generative model. We aim to
in training. Images from the unseen ADM class colored                      address these issues in our future work.

                                                                       8
