Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,74 @@
|
|
| 1 |
-
---
|
| 2 |
-
license: apache-2.0
|
| 3 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
---
|
| 4 |
+
Of course. Here is a description for your Hugging Face README file, written in English and formatted with Markdown.
|
| 5 |
+
|
| 6 |
+
Real vs. AI-Generated Image Detection Model
|
| 7 |
+
This repository contains a deep learning model trained to classify images as either real or AI-generated (fake). The model was developed as part of a project on Big Data and leverages transfer learning with the powerful ResNet50 architecture. It achieves a test accuracy of 93.34% on the CIFAKE dataset. 🏆
|
| 8 |
+
|
| 9 |
+
A live, interactive demo of this model is available on Hugging Face Spaces. [(Link to your Hugging Face Space here)]
|
| 10 |
+
|
| 11 |
+
Model Architecture
|
| 12 |
+
The model uses a transfer learning approach, which involves two main components:
|
| 13 |
+
|
| 14 |
+
Base Model: A pre-trained ResNet50 model, with its weights trained on the ImageNet dataset, is used as a feature extractor. Its layers were frozen during training to retain the learned features.
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
Custom Classifier Head: A custom head was added on top of the base model to perform the final binary classification. It consists of:
|
| 18 |
+
|
| 19 |
+
A
|
| 20 |
+
|
| 21 |
+
Flatten layer.
|
| 22 |
+
|
| 23 |
+
A
|
| 24 |
+
|
| 25 |
+
Dense layer with 512 units and a ReLU activation function.
|
| 26 |
+
|
| 27 |
+
A
|
| 28 |
+
|
| 29 |
+
Dropout layer with a rate of 0.5 to prevent overfitting.
|
| 30 |
+
|
| 31 |
+
A final
|
| 32 |
+
|
| 33 |
+
Dense output layer with a Sigmoid activation function for binary classification.
|
| 34 |
+
|
| 35 |
+
Dataset
|
| 36 |
+
The model was trained on the
|
| 37 |
+
|
| 38 |
+
CIFAKE dataset, which is available on Kaggle. This dataset contains a large collection of images, split into two classes:
|
| 39 |
+
|
| 40 |
+
REAL: Authentic, real-world photographs.
|
| 41 |
+
|
| 42 |
+
FAKE: Images synthetically generated by AI models.
|
| 43 |
+
|
| 44 |
+
To improve the model's ability to generalize and to prevent overfitting,
|
| 45 |
+
|
| 46 |
+
data augmentation techniques were applied to the training set, including random flips, rotations, and zooms.
|
| 47 |
+
|
| 48 |
+
Training & Performance
|
| 49 |
+
|
| 50 |
+
Training Environment: The model was trained on Google Colab using an NVIDIA T4 GPU.
|
| 51 |
+
|
| 52 |
+
|
| 53 |
+
Training Process: The model was trained for 20 epochs using the Adam optimizer and binary_crossentropy loss function.
|
| 54 |
+
|
| 55 |
+
|
| 56 |
+
ModelCheckpoint was used to save the best weights after each epoch.
|
| 57 |
+
|
| 58 |
+
|
| 59 |
+
Final Performance: The final model was evaluated on an unseen test set and achieved the following results:
|
| 60 |
+
|
| 61 |
+
|
| 62 |
+
Test Accuracy: 93.34%
|
| 63 |
+
|
| 64 |
+
|
| 65 |
+
Precision (for REAL class): 95%
|
| 66 |
+
|
| 67 |
+
|
| 68 |
+
Recall (for FAKE class): 95%
|
| 69 |
+
|
| 70 |
+
The model's performance slightly exceeds the 93% accuracy reported in the dataset's base paper, demonstrating its effectiveness.
|
| 71 |
+
|
| 72 |
+
|
| 73 |
+
Confusion Matrix
|
| 74 |
+
The confusion matrix below shows a detailed breakdown of the model's performance on the 20,000 images in the test set.
|