AI Image Detector: a CLI, API and benchmark harness for probabilistic synthetic-image checks
Open-source CLI, API, web UI, and reproducible benchmarks for probabilistic AI-generated image detection.
At a glance
- What is it?
- lynote-ai/ai-image-detector wraps CLIP-based fake-image classification in a command line tool, a Python API, a FastAPI endpoint and a Gradio UI. The default UnivFD backend is simple, but the project's own three-image smoke test shows how weak that default can be.
- Who is it for?
- Adopt it if you want a small, readable Python entry point to CLIP-based fake-image classification and you are willing to compare at least two backends before trusting a decision. Do not adopt it as an automated gate for moderation, hiring or publishing decisions; the README itself calls detection probabilistic and the project's own three-image smoke test is not a benchmark.
- Can I use it commercially?
- Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
- Is it still maintained?
- Yes. The repository last received commits 111 days ago.
- What is it written in?
- Mainly Python, according to GitHub's language statistics.
Answers come from the project's GitHub data, last synced on November 24, 2026, and from our analysis. They are not legal advice.
Star history
- lynote-ai/ai-image-detector344 ★ · +19
| Repository | 2026-09-17 | 2026-11-24 |
|---|---|---|
| lynote-ai/ai-image-detector | 325 | 344 |
19 Stars in the last 68 days, measured from the daily GitHub snapshot. Compare with other projects
Editorial analysis
What AI Image Detector actually solves, and for whom
Most people asking whether an image is AI-generated want a yes or no. This project does not offer one. It offers a probability, a thresholded label, and a report you can reproduce later. The README states the position plainly: detection is probabilistic and the output should be treated as one signal, not as proof.
The audience is therefore narrower than the search traffic suggests. It fits a Python developer who already has a pipeline of images and wants a local, scriptable check without sending files to a hosted service. It fits a researcher who wants to run the same detector across a folder and dump CSV or JSON lines for later analysis. It also fits someone comparing detectors, because the repository ships several backends behind one interface: univfd, hybrid, nonescape-mini, sentry-convnext-small, hybrid-plus and ultra, plus a generic hf path for standard Transformers image-classification checkpoints.
It does not fit anyone who needs a verdict they can defend in public. The README's own instruction is to compare at least two backends when a decision matters, which is an admission that a single number from a single model is not enough.
The UnivFD default and the ensemble backends behind one flag
The default backend is UnivFD, short for UniversalFakeDetect. The mechanism is described as CLIP ViT-L/14 image features feeding a tiny linear fake/real head. That design is why the project can call it a practical default: the task-specific weight is small, the code path is short enough to read, and the README cites the CVPR 2023 paper as showing better cross-generator generalization than older GAN-trained detectors.
The other backends are variations on the same idea rather than separate research. hybrid blends UnivFD with a lightweight Hugging Face classifier. nonescape-mini and sentry-convnext-small adapt external open-source detectors. hybrid-plus ensembles the internal hybrid with Nonescape. ultra adds Sentry on top of that. The README calls ultra the strongest current ensemble in the repository and the first choice when you want the highest practical accuracy, while noting that this route avoids training a new model from scratch.
Two details in the README are worth flagging. First, the benchmark commands support post-hoc threshold calibration objectives such as balanced_accuracy and f1, and the README calls this one of the most effective low-risk levers for held-out performance. That is a claim about calibration, not about the model. Second, the project points at AIDE, which combines CLIP semantics with low-level frequency and noise features, as a research target for a future backend. So the current default is a deliberate simplification, not the state of the art.
Installing AI Image Detector and running a first detection
The README targets Python 3.10 or newer and installs from a virtual environment. The build backend is hatchling, and the console script is aidetect.
python -m venv .venv
source .venv/bin/activate
pip install -e .After that, the quickest real use is a single image with the default backend. The command prints a probability and a label.
aidetect detect image.jpgFor a folder, the recursive form writes a CSV you can open in a spreadsheet. The README shows both the CSV and JSON-lines variants.
aidetect detect ./images --csv report.csv
aidetect detect ./images --jsonIf you want the ensemble the README recommends as the strongest option, swap the backend flag. The same flag also selects sentry-convnext-small for a simpler single model, or hf for a standard Transformers checkpoint.
aidetect detect image.jpg --backend ultra
aidetect detect image.jpg --backend sentry-convnext-small
aidetect detect image.jpg --backend hf --hf-model capcheck/ai-image-detectionFrom Python, the API is a factory plus a predict call. The result object exposes as_dict().
from aidetector import create_detector
detector = create_detector("univfd", device="auto")
result = detector.predict_path("image.jpg")
print(result.as_dict())The optional extras cover the other surfaces: eval for Hugging Face dataset benchmarks, hf for the generic Transformers backend, api for the FastAPI server, web for the Gradio UI, and dev for tests and linting. The server runs on 127.0.0.1:8000 by default and accepts a multipart upload.
pip install -e '.[api]'
aidetect api --host 127.0.0.1 --port 8000
curl -F "[email protected]" http://127.0.0.1:8000/detectWhat you should see is a probability_ai value and a label. By default probability_ai at or above 0.5 becomes ai. The README says to treat scores between 0.45 and 0.55 as weak evidence.
Reading probability_ai without over-reading it
The output contract is small. probability_ai is the model's estimated likelihood that the image is AI-generated. label is the thresholded decision. That is the whole vocabulary, and the README spends more space warning about it than explaining it.
The warning is specific: borderline scores in the 0.45 to 0.55 band are weak evidence. That band is not a bug, it is what a probabilistic classifier looks like near its decision boundary. The practical consequence is that a pipeline which thresholds at 0.5 and then acts automatically will make its most confident-looking mistakes exactly where the model is least sure.
The README's suggested mitigation is to compare at least two backends when a decision matters, and it names sentry-convnext-small and ultra as the pair to compare. That is a reasonable hedge because the backends fail differently. The project's own smoke test, described below, shows UnivFD missing both AI-tagged images while Nonescape Mini caught both but false-positived on the human sample. Agreement between two differently-built detectors carries more information than a single high score.
The three-image smoke test the README publishes
The repository includes test_images/ with three files: ai-generated.png, ai_retouched.png and human.jpeg. The README uses the filenames as labels and reports accuracy per backend. It is explicit that this is not a publishable benchmark and only a sanity check on a three-image sample.
The numbers are worth reading as a warning about the default. UnivFD scores 0.333, missing both AI-tagged images; on ai-generated.png it returns probability_ai 0.3098 and predicts human. The Hugging Face capcheck/ai-image-detection checkpoint scores 0.667, correct on ai_retouched.png but false-positive on human.jpeg. Nonescape Mini scores 0.667, correct on both AI-tagged images and false-positive on human.jpeg. Sentry ConvNeXt Small scores 0.667, correct on ai-generated.png and human.jpeg. Ultra scores 0.667 with the same decisions as Sentry on this set.
The honest reading is that no backend is clean on three images, and the one the README recommends as the simplest default is the worst of the group here. Three images cannot establish ranking, and the README says so. But the pattern is still informative: the failure modes differ by backend, which is the argument for the compare-two-backends advice rather than a reason to pick one winner. If you take anything from this table, take the direction of travel, not the accuracy column.
Where AI Image Detector is the wrong tool
The first limitation is the one already stated: it produces a probability, and probabilities near the boundary are not decisions. If your workflow needs a defensible verdict, this tool cannot supply one, and the README does not pretend otherwise.
The second is the calibration gap. The benchmark commands support objectives like balanced_accuracy and f1, and the README calls threshold calibration one of the most effective low-risk levers for held-out performance. That phrasing implies the shipped threshold is not tuned to your data. Whatever 0.5 means on your image distribution is something you have to establish yourself, and the repository does not ship a calibrated default for arbitrary inputs.
The third is the generic hf path. The README notes that the hf backend expects a standard Transformers image-classification checkpoint, and that some open-source detectors publish custom repositories which need a dedicated adapter instead. So pointing --hf-model at an arbitrary detector repository on the Hub is not guaranteed to work.
Finally, the model coverage question. UnivFD is a CLIP-based detector, and the README positions AIDE, which adds frequency and noise features, as a research target rather than a shipped backend. Recent generators are exactly the case where a CLIP-only feature space is most likely to be thin. There is no claim in the README that the current backends were evaluated against the newest generation of models.
Alternatives and how their approach differs
The closest comparison inside the same family is the original UniversalFakeDetect code from the Wisconsin AI Vision group, which the README links. That repository is the research implementation: it is where the CLIP-feature-plus-linear-head idea comes from, and it is aimed at reproducing paper results. AI Image Detector is the packaging layer around that idea, adding a CLI, a Python factory, a FastAPI endpoint, a Gradio UI, several adapted external detectors and a benchmark runner. If you want to reproduce the paper, go to the source. If you want a command you can run on a folder tonight, this project is the shorter path.
A second comparison is the generic Hugging Face route. Instead of installing this project, you could load a Transformers image-classification checkpoint directly with the transformers library and call it on your images. That gives you no backend abstraction, no ensemble, no CSV or JSON-lines output and no benchmark harness, but it also gives you no extra dependency surface beyond transformers and torch. The project's own hf backend is essentially that route wrapped in the same interface as the others, which is a fair description of what the wrapper buys you.
A third comparison is hosted detection services. Those are outside the scope of the repository documentation, and the README makes no comparison to them. What can be said from the repository alone is that this project runs locally, which means the image never leaves your machine, and that the trade is that you own the model download, the GPU or CPU cost, and the threshold calibration.
Maintenance, licence and the upgrade surface
The repository is not archived and the last push was on 2026-08-05, which is the same date as the v0.3.0 release. The version in pyproject.toml is 0.3.0, so the packaged version tracks the release tag.
The licence is MIT, declared in both pyproject.toml and the LICENSE file at the repository root. That is permissive and imposes no copyleft obligation on your own code. One caveat that is not legal advice: the MIT licence covers this repository, not the model weights it downloads. UnivFD derives from the UniversalFakeDetect work, and the other backends adapt external detectors, so the terms attached to those weights and upstream projects are a separate question you should check before redistribution.
Upgrade cost is dominated by the dependency set rather than by this project's own code. The core dependencies include torch, torchvision, open_clip_torch, timm, huggingface_hub and safetensors. A major torch or open_clip_torch release is the realistic breaking event, because the default backend is CLIP ViT-L/14 features plus a linear head. The optional extras are versioned separately and only matter if you use the api, web, hf or eval surfaces. The repository has CI configured through GitHub Actions, which the README badge points at, so there is at least a test signal on the main branch.
Editorial conclusion
Adopt it if you want a small, readable Python entry point to CLIP-based fake-image classification and you are willing to compare at least two backends before trusting a decision. Do not adopt it as an automated gate for moderation, hiring or publishing decisions; the README itself calls detection probabilistic and the project's own three-image smoke test is not a benchmark. Verify first which backend you intend to ship, whether the generic hf path loads the checkpoint you have in mind, and what threshold calibration does to your own held-out set.
Frequently asked questions
Are AI image detectors like AI Image Detector trustworthy?
The README states directly that AI image detection is probabilistic and that the output should be treated as one signal, not as proof. It also advises comparing at least two backends when a decision matters. On the project's own three-image smoke test no backend was fully correct.
How can I tell if an image is AI-generated with AI Image Detector?
Run aidetect detect on the file and read probability_ai, which is the model's estimated likelihood that the image is AI-generated. By default a value at or above 0.5 becomes the label ai, and the README says to treat scores between 0.45 and 0.55 as weak evidence.
What are AI image detectors actually looking for?
In this project the default backend is UnivFD, which uses CLIP ViT-L/14 image features plus a small linear fake/real head. The README notes that the more recent AIDE approach adds low-level frequency and noise features on top of CLIP semantics, and lists AIDE as a research target rather than a shipped backend.
What is an AI image detector?
Here it is a Python package that classifies an image as likely AI-generated or likely human-made and returns a probability plus a thresholded label. The repository ships a CLI, a Python API, a FastAPI server and a Gradio UI around that core.
Official sources
Add this badge to your README
If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.
[](https://hysenlabs.com/projects/lynote-ai-ai-image-detector)Star history chart for your README
[](https://hysenlabs.com/projects/lynote-ai-ai-image-detector)Was this useful?