Update README.md
Browse files
README.md
CHANGED
|
@@ -2,20 +2,46 @@
|
|
| 2 |
license: apache-2.0
|
| 3 |
---
|
| 4 |
|
| 5 |
-
Real vs AI-Generated
|
| 6 |
|
| 7 |
-
This project provides a Convolutional Neural Network (CNN) model for classifying images as either 'real' or 'fake'.
|
| 8 |
CNN is a type of deep learning model specifically designed to process and analyze visual data by applying convolutional layers that automatically detect patterns and features in images.
|
| 9 |
-
Our CNN model is based on 2,800 real images and AI-generated images, which are divided equally.
|
| 10 |
-
|
| 11 |
Our goal is to accurately classify the source of the image with at least 85% accuracy and achieve at least 80% in the Recall test.
|
| 12 |
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
license: apache-2.0
|
| 3 |
---
|
| 4 |
|
| 5 |
+
Real art vs AI-Generated art image classification
|
| 6 |
|
| 7 |
+
This project provides a Convolutional Neural Network (CNN) model for classifying images as either 'real art' or 'fake art'.
|
| 8 |
CNN is a type of deep learning model specifically designed to process and analyze visual data by applying convolutional layers that automatically detect patterns and features in images.
|
|
|
|
|
|
|
| 9 |
Our goal is to accurately classify the source of the image with at least 85% accuracy and achieve at least 80% in the Recall test.
|
| 10 |
|
| 11 |
+
Installation instructions
|
| 12 |
+
The following libraries or packages are required: numpy, pandas, tensorflow, keras, matplotlib, sklearn, cv2.
|
| 13 |
+
We prepare the data for the model by sorted the images into 2 types of folders which are divided equally(real art- labeled as 0, fake art- labeled as 1).
|
| 14 |
+
Our CNN model is based on 2,800 images that have been resized and normalized, the files formats is PNG, JPG.
|
| 15 |
+
The images are divided into a training set that contains 90% from data and a testing set that contains the remaining 10%.
|
| 16 |
+
|
| 17 |
+
CNN model architecture
|
| 18 |
+
Convolutional Layers: for feature extraction from images, applying 32 or 64 filters with a size of 3x3, the activation function used id ReLU .
|
| 19 |
+
MaxPooling Layers: for reducing the spatial dimensions to a size of 2x2.
|
| 20 |
+
Flatten: converts the multi-dimensional output of previous layers into a one-dimensional vector for input into fully connected layers.
|
| 21 |
+
Dropout Layer: to prevent overfitting with a thinning rate of 0.5 after the first Dense layer.
|
| 22 |
+
Dense Layer: last layer of dense for classification with a sigmoid activation function.
|
| 23 |
+
|
| 24 |
+
Training Details
|
| 25 |
+
The model is trained using binary cross-entropy loss and the Adam optimizer. It is validated with 20% of the training data reserved for validation.
|
| 26 |
+
The model employs 4-fold cross-validation to ensure robust performance.
|
| 27 |
+
The following callbacks are used during training:
|
| 28 |
+
EarlyStopping: Stops training if the validation accuracy ceases to improve for a specified patience period.
|
| 29 |
+
ModelCheckpoint: Saves the best weights during training based on validation accuracy.
|
| 30 |
+
The best-performing model from each fold is saved, and the model with the best weights overall is selected for final testing.
|
| 31 |
+
|
| 32 |
+
Performance Evaluation
|
| 33 |
+
After training, the model is evaluated on the test set. The following metrics are used to measure performance:
|
| 34 |
+
Accuracy: The percentage of correct classifications.
|
| 35 |
+
Precision, Recall, F1-Score: For evaluating the model’s classification ability on both real and AI-generated images.
|
| 36 |
+
Confusion Matrix: Displays true positives, false positives, true negatives, and false negatives.
|
| 37 |
+
Instructions
|
| 38 |
+
|
| 39 |
+
To run the project
|
| 40 |
+
Place the images in the respective training and testing folders.
|
| 41 |
+
Preprocess the images by resizing and normalizing them.
|
| 42 |
+
Train the model using the provided code.
|
| 43 |
+
Evaluate the model on the test set.
|
| 44 |
|
| 45 |
+
Visualization results
|
| 46 |
+
Confusion Matrix: To visualize the classification performance.
|
| 47 |
+
Training and Validation Metrics: Plots for accuracy and loss over the epochs.
|