Inspiration Generative AI has gotten so good that it is almost impossible to trust our eyes. While there are AI detectors out there, most of them are trained in perfect "lab conditions". The moment an AI image is uploaded to a social media platforms. It usually undergoes real-life transformations as it gets compressed, cropped, and filtered. We wanted to protect users of social media platforms like TikTok from deepfakes, misinformation, and spam so we engineered this model.
What it does It automatically detects and quantifies image degradation and adjusts detector weights based on the image's degradation profile. We are able to support transformation chains like resize to JPEG and crop to JPEG. We are even able to support multi-step transformation like resize to crop to JPEG. The system can also choose to abstain from giving a definite AI or real answer. For example if the confidence of the image being AI is low, the detector gives {"label": "UNKNOWN", "score": 0.57, "confidence": "LOW", "abstained": true} as output. On the contrary, if the detector has high confidence that the image is AI generated, it gives { "label": "AI", "score": 0.91, "confidence": "HIGH", "abstained": false} as output.
How we built it We engineered a modular Python backend using PyTorch, scikit-learn, and pandas running on Kaggle GPUs for training. We have a 4-Tier Evidence Cascade, we are combining C2PA provenance (Tier 0), an EfficientNet-B0 CNN (Tier 1), a hand-built frequency feature classifier (Tier 2) and a CLIP ViT-B/32 semantic embedding + logical regression(Tier 3). We built a custom library to simulate real-world edits like JPEG compression, noise, motion blur and crops. Our profiler analyzes an image to see how it's been altered before trying to classify it. Next, we also implemented a lightweight router that weighs evidence from different detectors. If an image is heavily compressed, the router changes how it evaluates the forensic data. One key innovative part of our project is the Confidence Model calculates the risk and abstains if the confidence of the image being an AI image is too low.
Challenges we ran into The biggest challenge was hitting a 0% accuracy wall where every single AI image we fed the system came back as "real." Debugging that pipeline and figuring out how our feature weights were misaligning was incredibly frustrating, but it proved exactly why standard detectors fail so easily. We retrained our models with more different datasets like Hugging Face Transformers and managed to get all five of our core features integrated end-to-end.
Accomplishments that we're proud of Our biggest accomplishment was validating our pipeline against the CIFAKE dataset. Because CIFAKE's canonical release downscales images to 32x32 pixels, we were able to aggressively test our memory limits. We batched our 40 local smoke tests and monitored the transitions between the Transformation Profiler and the Adaptive Evidence Router, confirming zero memory leaks during the handoffs. We are also proud of tuning our PyTorch model's risk threshold to only abstain when confidence drops below 65%. This guarantees we aren't wasting compute cycles blindly guessing on heavily compressed files, saving processing power for salvageable images.
\What we learned We learnt that single-model detectors break under real social media compression. Thus, we combined frequency-domain forensics with semantic embeddings. We also understood that raw classification probabilities become unreliable under heavy domain shift. Hence, we calibrated confidence via isotonic regression and evaluating risk-coverage curves.
What's next for TikTokSofa
We hope to be able to scale up training runs on Kaggle or Colab GPUs across complex datasets like COCO + DALL-E. We also hope to be able to extend transformation profiling to handle temporal artifacts and video compression directly targeting short-form video stream.
Built With
- huggingface
- python
- pytorch
- scikit-learn
Log in or sign up for Devpost to join the conversation.