Image Classification
Keras
English
art
File size: 3,339 Bytes
059de53
 
541050d
 
 
 
5c49540
 
4ce5681
b9e8bff
 
 
059de53
 
541050d
 
5514440
4de28c6
5514440
4de28c6
541050d
cd3a9af
541050d
 
 
4de28c6
541050d
4de28c6
 
541050d
4de28c6
541050d
4de28c6
541050d
4de28c6
541050d
 
 
 
4de28c6
 
 
541050d
 
 
4de28c6
 
541050d
 
 
4de28c6
541050d
 
 
cd3a9af
541050d
4de28c6
541050d
 
0b25104
4ce5681
 
 
541050d
 
 
0b25104
541050d
 
 
 
 
e56d773
e9ae464
e56d773
e9ae464
e56d773
e9ae464
e56d773
e9ae464
e56d773
e9ae464
e56d773
0b25104
541050d
c1d4753
 
 
 
 
541050d
 
5779a70
b9e8bff
541050d
0b25104
541050d
 
157d171
 
 
 
 
541050d
 
157d171
 
 
 
 
 
 
 
b9e8bff
541050d
2e2103b
 
541050d
b9e8bff
541050d
157d171
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
---
license: unknown
metrics:
- accuracy
tags:
- art
datasets:
- DataScienceProject/Art_Images_Ai_And_Real_
library_name: keras
language:
- en
pipeline_tag: image-classification
---

# Model Card for Model ID

This model is designed for classifying images as either 'real' or 'fake-AI generated' using a Convolutional Neural Network (CNN) combined with Error Level Analysis (ELA).

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.




### Model Description

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.

Error Level Analysis (ELA) detects changes in digital images by comparing the differences between the original and a compressed version of the image.
It highlights areas where alterations may have occurred, making it useful for identifying image tampering.

After running  ELA we feed the CNN with the result of comparing original and a compressed version of the same image and then we get the output.

### Direct Use

This model can be used to classify images as 'real' or 'fake- Ai generated' based on the presence of anomalies and features characteristic of each category.


### Out-of-Scope Use

The model may not perform well on images outside the scope of art or where the visual characteristics are drastically different from those in the training dataset.

may not detect ai-images from newer diffusion models that has another method of creating ai images.

## Bias, Risks, and Limitations

ELA can be very good in detecting tamparing such as photoshop,
there is many diffusion engines that not tamper the image making the ELA weak against those ai-images.

### Recommendations

Test this model with different hyperparameters / more CNN layers

## How to Get Started with the Model

Prepare Data: Organize your images into appropriate folders and run the code


## Training Details


-Dataset: DataScienceProject/Art_Images_Ai_And_Real_

-Preprocessing: Images are resized, image quallity changed , ELA version of this image created.

### Training Procedure

Train the CNN with the Preprocessed images , use valitadion set.


#### Training Hyperparameters


-optimizer = RMSprop(lr=0.0005, rho=0.9, epsilon=1e-08, decay=0.0)

-epochs = 22

-batch_size = 100

-loss = "categorical_crossentropy"

-metrics=["accuracy"]

-early_stopping = EarlyStopping(monitor='val_acc',min_delta=0,patience=2,verbose=0, mode='auto')



## CNN architecture
![image/png](https://cdn-uploads.huggingface.co/production/uploads/66d6f1b3b50e35e1709bfdf7/kMzJsIObIv2BJQeXlN8RI.png)


## Evaluation

The model takes 7-10 minutes to run , based on our dataset , equipped with the following pc hardware: cpu :i9 13900 ,ram: 32gb  , gpu: rtx 3080 
your mileage may vary.


### Testing Data, Factors & Metrics

-precision 
-recall
-f1 
-confusion_matrix
-accuracy

### Results
-test accuracy = 0.853

-precision = 0.866

-recall = 0.8357

-f1 = 0.8509




![image/png](https://cdn-uploads.huggingface.co/production/uploads/66d6f1b3b50e35e1709bfdf7/fbB7aEJgS94WrIB8L3-_9.png)

#### Summary

The model preforms well and meet our initial goal ,thus this model can handle the task of image classification real image vs Ai generated image.