How zahinsyukran/ai_image_detector works
The product is a browser-based AI-image detector. A user selects an image from Chrome, the extension uploads it to the local API, and the API analyzes face/detail quality, routes inference to ResNet or ViT, and returns a label with confidence and router details. The README documents a training pipeline, but the notebook was not sampled, so its internal behavior and connection to the shipped weights are not shown. Model routing and extension/API communication are supported by the sampled sources.
Main entry points: main.py Adaptive router · background.js Chrome image menu · resnet18_deepfake.pth ResNet weights · model.ipynb Training pipeline
Components 17
Browser Extension
- Chrome image menu
extension/background.js - Image upload
extension/background.js - Result alert
extension/background.js
API Analysis
- Prediction endpoint
api/main.py - Image validation
api/main.py - Face detection and crop
api/main.py - Sharpness scoring
api/main.py - Adaptive router
api/main.py - Label and confidence
api/main.py - Prediction response
api/main.py
Inference Engines
- ResNet-18 classifier
api/main.py - ResNet weights
api/resnet18_deepfake.pth - Vision Transformer
api/main.py
Model Training
- Training pipeline
model.ipynb
Other components
- Image user
- Image host
- Hugging Face model
Connections 20
- Image user → Chrome image menu: selects image
- Chrome image menu → Image host: fetches image
- Chrome image menu → Image upload: dispatches scan
- Image host → Image upload: returns image
- Image upload → Prediction endpoint: uploads image
- Prediction endpoint → Image validation: passes upload
- Image validation → Face detection and crop: decodes image
- Face detection and crop → Sharpness scoring: provides image crop
- Sharpness scoring → Adaptive router: provides score
- Adaptive router → ResNet-18 classifier: routes low detail
- Adaptive router → Vision Transformer: routes high detail
- ResNet weights → ResNet-18 classifier: loads weights
- Vision Transformer → Hugging Face model: loads pretrained model
- ResNet-18 classifier → Label and confidence: returns probabilities
- Vision Transformer → Label and confidence: returns probabilities
- Adaptive router → Label and confidence: provides routing details
- Label and confidence → Prediction response: formats result
- Prediction response → Result alert: returns JSON
- Result alert → Image user: displays result
- Training pipeline → ResNet weights: trains weights