File size: 3,516 Bytes
856e43e 70445fe ffd937f 856e43e 06de433 856e43e 8ef7576 1a44747 5e118d2 856e43e 7d41b2d 502662f 8ef7576 7d41b2d 502662f 8ef7576 7d41b2d 502662f 8ef7576 7d41b2d 502662f 8ef7576 7d41b2d 502662f 8ef7576 856e43e 7d41b2d 502662f 8ef7576 7d41b2d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
---
license: apache-2.0
datasets:
- DataScienceProject/Art_Images_Ai_And_Real_
pipeline_tag: image-classification
---
**Real art vs AI-Generated art image classification**
This project provides a Convolutional Neural Network (CNN) model for classifying images as either 'real art' or 'fake art'.
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.
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.
***Installation instructions***
The following libraries or packages are required: numpy, pandas, tensorflow, keras, matplotlib, sklearn, cv2.
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).
Our CNN model is based on 2,800 images that have been resized and normalized, the files formats is PNG, JPG.
The images are divided into a training set that contains 90% from data and a testing set that contains the remaining 10%.
***CNN model architecture***
Convolutional Layers: for feature extraction from images, applying 32 or 64 filters with a size of 3x3, the activation function used id ReLU .
MaxPooling Layers: for reducing the spatial dimensions to a size of 2x2.
Flatten: converts the multi-dimensional output of previous layers into a one-dimensional vector for input into fully connected layers.
Dropout Layer: to prevent overfitting with a thinning rate of 0.5 after the first Dense layer.
Dense Layer: last layer of dense for classification with a sigmoid activation function.

***Training Details***
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.
The model employs 4-fold cross-validation to ensure robust performance.
The following callbacks are used during training:
EarlyStopping: Stops training if the validation accuracy ceases to improve for a specified patience period.
ModelCheckpoint: Saves the best weights during training based on validation accuracy.
The best-performing model from each fold is saved, and the model with the best weights overall is selected for final testing.
***Performance Evaluation***
After training, the model is evaluated on the test set. The following metrics are used to measure performance:
Accuracy: The percentage of correct classifications.
Precision, Recall, F1-Score: For evaluating the model’s classification ability on both real and AI-generated images.
Confusion Matrix: Displays true positives, false positives, true negatives, and false negatives.
Instructions
***To run the project***
Place the images in the respective training and testing folders.
Preprocess the images by resizing and normalizing them.
Train the model using the provided code.
Evaluate the model on the test set.
***Visualization results***
Confusion Matrix: To visualize the classification performance.
Training and Validation Metrics: Plots for accuracy and loss over the epochs.
***Results***
Test accuracy = 0.77
Test loss = 0.49
Precision = 0.77
Recall = 0.77
F1 = 0.77
*Confusion Matrix:*

|