<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: lixy</title>
    <description>The latest articles on DEV Community by lixy (@ming_yang_367fbe0bb).</description>
    <link>https://dev.to/ming_yang_367fbe0bb</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4266805%2F36f59ce3-2baf-41e7-b65e-c851441cf804.png</url>
      <title>DEV Community: lixy</title>
      <link>https://dev.to/ming_yang_367fbe0bb</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ming_yang_367fbe0bb"/>
    <language>en</language>
    <item>
      <title>I built an AI image detector alone — the model was the easy part</title>
      <dc:creator>lixy</dc:creator>
      <pubDate>Thu, 26 Nov 2026 11:49:22 +0000</pubDate>
      <link>https://dev.to/ming_yang_367fbe0bb/i-built-an-ai-image-detector-alone-the-model-was-the-easy-part-1pnb</link>
      <guid>https://dev.to/ming_yang_367fbe0bb/i-built-an-ai-image-detector-alone-the-model-was-the-easy-part-1pnb</guid>
      <description>&lt;p&gt;Every week someone posts a photo in a Discord I'm in and asks "is this AI?"&lt;br&gt;
The honest answer is usually "probably, but I can't prove it" — and that gap&lt;br&gt;
between &lt;em&gt;probably&lt;/em&gt; and &lt;em&gt;provably&lt;/em&gt; is the whole design problem of an AI image&lt;br&gt;
detector.&lt;/p&gt;

&lt;p&gt;I built one as a one-person project: &lt;a href="https://ai-detect.iming.work" rel="noopener noreferrer"&gt;ai-detect.iming.work&lt;/a&gt;.&lt;br&gt;
It's free, no signup, and it deliberately refuses to give you a single number.&lt;br&gt;
This post is about why, and about the parts that broke.&lt;/p&gt;

&lt;h2&gt;
  
  
  Two signals, not one score
&lt;/h2&gt;

&lt;p&gt;The first version returned one confidence value. That was a mistake, and users&lt;br&gt;
told me so in the least helpful way possible: they'd upload a real photo, get&lt;br&gt;
"82% AI", and assume the tool was broken — when actually the pixel model was&lt;br&gt;
genuinely unsure and the metadata was clean.&lt;/p&gt;

&lt;p&gt;Splitting the output fixed the UX and the engineering at the same time. The&lt;br&gt;
tool now reports two independent results:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Metadata clues&lt;/strong&gt; — what the file itself claims about its origin.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pixel analysis&lt;/strong&gt; — a model score computed from the image alone.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;They fail in opposite directions, which is exactly why they're worth keeping&lt;br&gt;
separate.&lt;/p&gt;

&lt;h2&gt;
  
  
  Metadata is precise and has terrible recall
&lt;/h2&gt;

&lt;p&gt;When metadata hits, it's near-conclusive. AI tools write their names into&lt;br&gt;
files: &lt;code&gt;Midjourney&lt;/code&gt;, &lt;code&gt;Stable Diffusion&lt;/code&gt;, &lt;code&gt;ComfyUI&lt;/code&gt;, &lt;code&gt;NovelAI&lt;/code&gt;, &lt;code&gt;DALL·E&lt;/code&gt;,&lt;br&gt;
&lt;code&gt;Flux&lt;/code&gt;. Stable Diffusion WebUI in particular dumps the entire generation&lt;br&gt;
parameter string (sampler, steps, CFG, sometimes the prompt) into a PNG &lt;code&gt;tEXt&lt;/code&gt;&lt;br&gt;
chunk. There's also the AIGC labelling standard some Chinese tools now write.&lt;/p&gt;

&lt;p&gt;The negative signal is just as useful: a full EXIF block with a camera body, a&lt;br&gt;
lens, aperture, shutter and ISO is strong evidence of a real photograph. AI&lt;br&gt;
output almost never carries a plausible camera chain — at best an empty shell&lt;br&gt;
of EXIF with the manufacturer field filled in.&lt;/p&gt;

&lt;p&gt;Then reality arrives. Every major social platform strips EXIF on upload. A&lt;br&gt;
screenshot strips everything. A round trip through WeChat, Weibo or an&lt;br&gt;
Instagram re-upload deletes the evidence. So metadata behaves like a&lt;br&gt;
high-precision, low-recall test: &lt;strong&gt;a hit proves AI; a miss proves nothing.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;That asymmetry is the single most useful thing to explain to users, because&lt;br&gt;
"no metadata" reads as "clean" to almost everyone.&lt;/p&gt;

&lt;h2&gt;
  
  
  The pixel model is the mirror image
&lt;/h2&gt;

&lt;p&gt;Pixel analysis doesn't care about metadata, so it survives re-encoding. But it&lt;br&gt;
inherits every weakness of a classifier:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It's trained on generators that existed at training time. New models drift
out from under it.&lt;/li&gt;
&lt;li&gt;It reads texture and noise statistics, which real photographs also vary
wildly in.&lt;/li&gt;
&lt;li&gt;It has no notion of &lt;em&gt;why&lt;/em&gt; — so when it's wrong, it's confidently wrong.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I don't publish an accuracy number, because any single number I could quote&lt;br&gt;
would be measured on my own sample and would be wrong for yours. What I do&lt;br&gt;
instead is show which signal produced the verdict, so a user can weigh it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Four processing steps that break pixel models
&lt;/h2&gt;

&lt;p&gt;These account for most of the false positives I've seen, and none of them are&lt;br&gt;
"the model is bad":&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Screenshots.&lt;/strong&gt; A screenshot is a re-render at a different resolution through&lt;br&gt;
a different sampling filter. High-frequency detail that the model expects from&lt;br&gt;
a camera sensor is replaced by screen subpixel structure.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Re-compression.&lt;/strong&gt; Upload a JPEG, let a platform re-encode it at quality 75,&lt;br&gt;
and the compression artifacts the model associates with synthetic images and&lt;br&gt;
with photos start to overlap.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;AI upscaling and denoise.&lt;/strong&gt; Ironically, the tools people use to &lt;em&gt;fix&lt;/em&gt; a photo&lt;br&gt;
make it look more generated. A denoiser removes exactly the sensor noise the&lt;br&gt;
model uses as evidence of a real capture.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Aggressive phone processing.&lt;/strong&gt; Modern phone pipelines stack HDR, multi-frame&lt;br&gt;
merge and heavy sharpening. The result has the smoothed, slightly-too-clean&lt;br&gt;
texture that generation models also produce.&lt;/p&gt;

&lt;p&gt;If you're building anything in this space, handle these four cases explicitly&lt;br&gt;
rather than letting the model absorb them.&lt;/p&gt;

&lt;h2&gt;
  
  
  The boring parts that actually mattered
&lt;/h2&gt;

&lt;p&gt;A few engineering decisions that mattered more than the model:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Detection is asynchronous.&lt;/strong&gt; A 12 MP image takes a few seconds. The POST&lt;br&gt;
returns a task id immediately and the client polls with backoff (500 ms, then&lt;br&gt;
3 s). Before that, the desktop UI waited on a single request and occasionally&lt;br&gt;
timed out into an empty result panel — a bug that looked like "detection&lt;br&gt;
sometimes doesn't work".&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Images are transient by construction.&lt;/strong&gt; Uploads are relayed through a&lt;br&gt;
temporary host that expires the object after five minutes, and the originals&lt;br&gt;
never touch my server. Results live in the user's browser. This is a privacy&lt;br&gt;
decision, but it's also a scaling decision: no image storage means no storage&lt;br&gt;
to leak.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Content pages are static HTML.&lt;/strong&gt; The guides are generated at build time&lt;br&gt;
rather than rendered client-side, because a SPA gives non-JS crawlers an empty&lt;br&gt;
page. The homepage additionally ships a static copy of its body text that React&lt;br&gt;
removes on mount, so the DOM never contains the text twice.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I'd do differently
&lt;/h2&gt;

&lt;p&gt;I'd have built the metadata parser first and the model second. The parser is&lt;br&gt;
deterministic, testable, fast, and it answers a real question ("what does this&lt;br&gt;
file say about itself?"). The model is a probabilistic guess that needs the&lt;br&gt;
parser's output to be interpretable.&lt;/p&gt;

&lt;p&gt;And I'd have shipped the two-signal UI on day one. Explaining a probability is&lt;br&gt;
much harder than showing two pieces of evidence and letting the user&lt;br&gt;
cross-check them.&lt;/p&gt;

&lt;p&gt;If you want to poke at it: &lt;a href="https://ai-detect.iming.work/en/" rel="noopener noreferrer"&gt;ai-detect.iming.work&lt;/a&gt;&lt;br&gt;
— PNG, JPEG, WEBP, BMP and TIFF up to 30 MB. Happy to answer questions about&lt;br&gt;
the metadata side in the comments; that part I know cold.&lt;/p&gt;

</description>
      <category>showdev</category>
      <category>ai</category>
      <category>python</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
