kumaran-0188 commited on
Commit
d1cba32
Β·
verified Β·
1 Parent(s): 9b4d2d3

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +177 -1
README.md CHANGED
@@ -4,4 +4,180 @@ license: mit
4
 
5
  # πŸ–ΌοΈ Image Forgery Detection Model
6
 
7
- This repository contains a deep learning model that detects whether an image is REAL or FAKE..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
 
5
  # πŸ–ΌοΈ Image Forgery Detection Model
6
 
7
+ license: mit
8
+ pipeline_tag: image-classification
9
+ library_name: tensorflow
10
+ tags:
11
+ - image-forgery-detection
12
+ - ai-generated-images
13
+ - deepfake-detection
14
+ - fake-image-detection
15
+ - image-forensics
16
+ - computer-vision
17
+ - mobilenetv2
18
+ - tensorflow
19
+ - keras
20
+ ---
21
+
22
+ # πŸ•΅οΈ AI Image Forgery Detector (Real vs Fake)
23
+
24
+ This model detects whether an image is **REAL (camera-captured)** or **FAKE (AI-generated / manipulated)**.
25
+
26
+ It is a **fine-tuned MobileNetV2 model** trained using TensorFlow/Keras, designed for **AI image forgery detection**, including synthetic and deepfake-style images.
27
+
28
+ ---
29
+
30
+ ## πŸ” What This Model Can Do
31
+
32
+ βœ” Detect AI-generated images
33
+ βœ” Detect manipulated or synthetic content
34
+ βœ” Works on faces, objects, landscapes, and artworks
35
+ βœ” Outputs **prediction + confidence score**
36
+
37
+ ### Class Labels
38
+ - **0 β†’ Fake**
39
+ - **1 β†’ Real**
40
+
41
+ ---
42
+
43
+ ## 🧠 Model Architecture
44
+
45
+ - **Base model:** MobileNetV2 (ImageNet pretrained)
46
+ - **Framework:** TensorFlow / Keras
47
+ - **Input size:** 224 Γ— 224 RGB image
48
+ - **Output:** Sigmoid probability
49
+ - **Task:** Binary image classification
50
+
51
+ Additional layers:
52
+ - Global Average Pooling
53
+ - Dense (ReLU)
54
+ - Dropout (regularization)
55
+ - Sigmoid output layer
56
+
57
+ ---
58
+
59
+ ## πŸ“Š Evaluation Results
60
+
61
+ The model was evaluated using **accuracy, precision, recall, and F1-score**, with threshold optimization based on **macro F1-score** to handle class imbalance.
62
+
63
+ ### Best Validation Results
64
+ - **Accuracy:** ~87%
65
+ - **Fake class:** High precision
66
+ - **Real class:** High recall
67
+ - **Threshold:** Optimized (~0.65)
68
+
69
+ > Results may vary depending on image quality and source.
70
+
71
+ ---
72
+
73
+ ## πŸ–ΌοΈ Example Predictions
74
+
75
+ ### βœ… Real Image (Correct Classification)
76
+ ![Real Image Example](examples/real_example.jpg)
77
+
78
+ **Prediction:** REAL
79
+ **Confidence:** High
80
+
81
+ ---
82
+
83
+ ### ❌ AI-Generated Image (Correct Classification)
84
+ ![Fake Image Example](examples/fake_example.jpg)
85
+
86
+ **Prediction:** FAKE
87
+ **Confidence:** High
88
+
89
+ ---
90
+
91
+ ## πŸš€ How to Use This Model
92
+
93
+ ```python
94
+ import tensorflow as tf
95
+ import numpy as np
96
+ from PIL import Image
97
+
98
+ IMG_SIZE = 224
99
+
100
+ # Load model
101
+ model = tf.keras.models.load_model("forgery_model.keras")
102
+
103
+ # Load and preprocess image
104
+ img = Image.open("test.jpg").convert("RGB")
105
+ img = img.resize((IMG_SIZE, IMG_SIZE))
106
+ img = np.array(img) / 255.0
107
+ img = np.expand_dims(img, axis=0)
108
+
109
+ # Predict
110
+ probability = model.predict(img)[0][0]
111
+
112
+ label = "REAL" if probability > 0.65 else "FAKE"
113
+ print("Prediction:", label)
114
+ print("Confidence:", probability)
115
+ 🎯 Intended Use
116
+ This model is suitable for:
117
+
118
+ AI-generated image detection
119
+
120
+ Image forgery analysis
121
+
122
+ Academic projects
123
+
124
+ Research and experimentation
125
+
126
+ Educational demonstrations
127
+
128
+ ❌ Not recommended for legal, forensic, or high-risk decision-making systems.
129
+
130
+ ⚠️ Limitations
131
+ Extremely realistic AI images may still fool the model
132
+
133
+ Performance can drop on:
134
+
135
+ Heavy compression
136
+
137
+ Very low resolution
138
+
139
+ Extreme image edits
140
+
141
+ Model predictions are probabilistic, not absolute truth
142
+
143
+ Always validate outputs before real-world use.
144
+
145
+ πŸ§ͺ Training Details
146
+ Base: MobileNetV2 (ImageNet weights)
147
+
148
+ Optimizer: Adam (low learning rate)
149
+
150
+ Loss: Binary Crossentropy
151
+
152
+ Data augmentation applied
153
+
154
+ Class imbalance handled using class weights
155
+
156
+ Threshold tuning performed after training
157
+
158
+ 🧭 Ethical Considerations
159
+ Predictions can be incorrect
160
+
161
+ False positives / negatives are possible
162
+
163
+ Use responsibly and transparently
164
+
165
+ Do not rely solely on this model for critical decisions
166
+
167
+ πŸ“œ License
168
+ This model is released under the MIT License.
169
+
170
+ πŸ‘€ Author
171
+ Kumaran
172
+ Hugging Face: kumaran-0188
173
+
174
+ Built as part of an AI image forgery detection project using TensorFlow.
175
+
176
+ πŸ™Œ Acknowledgements
177
+ TensorFlow & Keras
178
+
179
+ MobileNetV2
180
+
181
+ AI-generated image datasets (CIFAKE-style)
182
+
183
+ Hugging Face ecosystem