nir23100/nir-markovich-bsc-final
Nir Markovich — B.Sc. Final Project
Sami Shamoon College of Engineering Electrical & Electronics Engineering — Advisor: Amit Twik — May 2026
Project title
Leakage-Protected Image Forgery Detection Using Deep Features: From CASIA Manipulations to FRIDA-Inspired AI-Generated Image Analysis.
This Hugging Face Space is the live-demo deliverable of an undergraduate research project on leakage-protected image forensics. It deploys two classifiers, both detecting whether a supplied image is a real photograph or generated by Stable Diffusion v1.5.
What's deployed here
Both models were trained on 7,000 images, validated on 1,500, and evaluated exactly once on a held-out test set of 1,500 images, under a leakage-protected protocol identical to the one established on CASIA 2.0 in Track A of the project.
Methodology in one paragraph
10,000 images (5,000 COCO real + 5,000 DRAGON SD-v1.5 fake) were normalized to 224×224 LANCZOS plus JPEG Q=95 to neutralize the file-format shortcut between classes. The dataset was split 70 / 15 / 15 with StratifiedGroupKFold on source_filename to prevent any image-level leakage between splits. For each backbone, 5-fold cross-validation on the training portion selected the best classifier across six candidates (LogReg, LinearSVC, RandomForest, HistGradBoost, plus two Dummy baselines, and for the SD backbone additionally k-NN k=101 with correlation distance — the FRIDA paper's specific recipe). The winning classifier's threshold was calibrated on the validation portion, then the classifier was re-fit on train + val and the held-out test set was evaluated exactly once.
Robustness probe
The deployed ResNet50 + LinearSVC classifier was additionally evaluated on the 1,500 test images re-encoded at four formats. Maximum F1 degradation = 0.0397. Lossless PNG matches JPEG Q=95 exactly, which is evidence that the classifier does not rely on JPEG-compression-specific artifacts to discriminate.
Limitations to keep in mind
- The fake-image class was sourced exclusively from Stable Diffusion v1.5 (via the DRAGON dataset). Images generated by Midjourney, ADM, BigGAN, or other diffusion variants are outside the training distribution and may be classified less accurately.
- Both models were trained at 224×224. Very high-resolution images undergo aggressive downscaling at preprocessing and may behave differently.
- The classifier weights are frozen; no fine-tuning was performed.
Reference
Full methodology and results are documented in the project's thesis (in progress, May 2026) and the Progress Record dated 16 May 2026. The classifier joblib bundles and their metadata can be downloaded from this Space's repository under models/.
