the problem
generative ai can produce realistic product images in seconds, which lowers the cost of building scam websites and running social engineering attacks. the goal was to build a model that classifies e-commerce product images as real or ai-generated, so it could plug into a broader scam-detection pipeline alongside signals like domain registration and ip activity.
building the dataset
i built a balanced 6,000-image dataset from scratch. 3,000 real product images were sampled from the amazon berkeley objects dataset, then run through google gemini pro to generate a one-line caption of each object.
those captions were fed to dall-e 2 to generate 3,000 'like-for-like' fake images - the same products, but synthetic. this gave clean, balanced classes and a variety of product types against varying backgrounds, so the model would generalise across the range of images a genai model can produce.

what the fakes look like
the synthetic images are convincing enough to pass as real product photos on a storefront, which is the core of the detection problem.

approach
i used transfer learning on three families of pretrained models - vgg-19, resnet50, and efficientnet (b0, b3, b7) - freezing the backbones and training only the output layer. everything was trained on an a100 gpu on google colab over 20 epochs.
results
efficientnetb7 reached 99.44% accuracy, with resnet50 and the efficientnet variants close behind. vgg-19 lagged, with a noticeably higher false-negative rate.
| model | accuracy | false negative rate | training time |
|---|---|---|---|
| vgg-19 | 95.11% | 6.62% | 245s |
| resnet50 | 99.00% | 0.45% | 270s |
| efficientnetb0 | 99.22% | 0.45% | 293s |
| efficientnetb3 | 99.00% | 0.89% | 515s |
| efficientnetb7 | 99.44% | 0.88% | 1431s |
generalising to newer models
to mimic real-world conditions, i tested the models on unseen dall-e 3 images. accuracy dropped sharply: vgg-19 fell to 24%, resnet50 to 48%, and efficientnetb0 was best at just 50%. efficientnet's squeeze-and-excitation blocks helped it adapt, but the drop is a clear sign of how hard it is to keep detectors current as genai improves.
finally, i embedded the models into a chrome extension so you could check whether images online are real or fake in the browser.
