Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,148 @@
|
|
1 |
-
---
|
2 |
-
license: mit
|
3 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: mit
|
3 |
+
---
|
4 |
+
---
|
5 |
+
language: en
|
6 |
+
tags:
|
7 |
+
- image-classification
|
8 |
+
- computer-vision
|
9 |
+
- deep-learning
|
10 |
+
- face-detection
|
11 |
+
- resnet
|
12 |
+
datasets:
|
13 |
+
- custom
|
14 |
+
license: mit
|
15 |
+
---
|
16 |
+
|
17 |
+
# ResNet-based Face Classification Model π
|
18 |
+
|
19 |
+
This model is trained to distinguish between real human faces and AI-generated faces using a ResNet-based architecture.
|
20 |
+
|
21 |
+
## Model Description π
|
22 |
+
|
23 |
+
### Model Architecture
|
24 |
+
- Deep CNN with residual connections based on ResNet architecture
|
25 |
+
- Input shape: (224, 224, 3)
|
26 |
+
- Multiple residual blocks with increasing filter sizes [64, 128, 256, 512]
|
27 |
+
- Global average pooling
|
28 |
+
- Dense layers with dropout for classification
|
29 |
+
- Binary output with sigmoid activation
|
30 |
+
|
31 |
+
### Task
|
32 |
+
Binary classification to determine if a face image is real (human) or AI-generated.
|
33 |
+
|
34 |
+
### Framework and Training
|
35 |
+
- Framework: TensorFlow
|
36 |
+
- Training Device: GPU
|
37 |
+
- Training Dataset: Custom dataset of real and AI-generated faces
|
38 |
+
- Validation Metrics:
|
39 |
+
- Accuracy: 52.45%
|
40 |
+
- Loss: 0.7246
|
41 |
+
|
42 |
+
## Intended Use π―
|
43 |
+
|
44 |
+
### Primary Intended Uses
|
45 |
+
- Research in deepfake detection
|
46 |
+
- Educational purposes in deep learning
|
47 |
+
- Face authentication systems
|
48 |
+
|
49 |
+
### Out-of-Scope Uses
|
50 |
+
- Production-level face verification
|
51 |
+
- Legal or forensic applications
|
52 |
+
- Stand-alone security systems
|
53 |
+
|
54 |
+
## Training Procedure π
|
55 |
+
|
56 |
+
### Training Details
|
57 |
+
```python
|
58 |
+
optimizer = Adam(learning_rate=0.0001)
|
59 |
+
loss = 'binary_crossentropy'
|
60 |
+
metrics = ['accuracy']
|
61 |
+
```
|
62 |
+
|
63 |
+
### Training Hyperparameters
|
64 |
+
- Learning rate: 0.0001
|
65 |
+
- Batch size: 32
|
66 |
+
- Dropout rate: 0.5
|
67 |
+
- Architecture:
|
68 |
+
- Initial conv: 64 filters, 7x7
|
69 |
+
- Residual blocks: [64, 128, 256, 512] filters
|
70 |
+
- Dense layer: 256 units
|
71 |
+
|
72 |
+
## Evaluation Results π
|
73 |
+
|
74 |
+
### Performance Metrics
|
75 |
+
- Validation Accuracy: 52.45%
|
76 |
+
- Validation Loss: 0.7246
|
77 |
+
|
78 |
+
### Limitations
|
79 |
+
- Performance is only slightly better than random chance
|
80 |
+
- May struggle with high-quality AI-generated images
|
81 |
+
- Limited testing on diverse face datasets
|
82 |
+
|
83 |
+
## Usage π»
|
84 |
+
|
85 |
+
```python
|
86 |
+
from tensorflow.keras.models import load_model
|
87 |
+
import cv2
|
88 |
+
import numpy as np
|
89 |
+
|
90 |
+
# Load the model
|
91 |
+
model = load_model('face_classification_model1')
|
92 |
+
|
93 |
+
# Preprocess image
|
94 |
+
def preprocess_image(image_path):
|
95 |
+
img = cv2.imread(image_path)
|
96 |
+
img = cv2.resize(img, (224, 224))
|
97 |
+
img = img / 255.0
|
98 |
+
return np.expand_dims(img, axis=0)
|
99 |
+
|
100 |
+
# Make prediction
|
101 |
+
image = preprocess_image('face_image.jpg')
|
102 |
+
prediction = model.predict(image)
|
103 |
+
is_real = prediction[0][0] > 0.5
|
104 |
+
```
|
105 |
+
|
106 |
+
|
107 |
+
## Ethical Considerations π€
|
108 |
+
|
109 |
+
This model is designed for research and educational purposes only. Users should:
|
110 |
+
- Obtain proper consent when processing personal face images
|
111 |
+
- Be aware of potential biases in face detection systems
|
112 |
+
- Consider privacy implications when using face analysis tools
|
113 |
+
- Not use this model for surveillance or harmful applications
|
114 |
+
|
115 |
+
## Technical Limitations β οΈ
|
116 |
+
|
117 |
+
1. Current performance limitations:
|
118 |
+
- Accuracy only slightly above random chance
|
119 |
+
- May require ensemble methods for better results
|
120 |
+
- Limited testing on diverse datasets
|
121 |
+
|
122 |
+
2. Recommended improvements:
|
123 |
+
- Extended training with larger datasets
|
124 |
+
- Implementation of data augmentation
|
125 |
+
- Hyperparameter optimization
|
126 |
+
- Transfer learning from pre-trained models
|
127 |
+
|
128 |
+
## Citation π
|
129 |
+
|
130 |
+
```bibtex
|
131 |
+
@software{face_classification_model1,
|
132 |
+
author = {Your Name},
|
133 |
+
title = {Face Classification Model using ResNet Architecture},
|
134 |
+
year = {2024},
|
135 |
+
publisher = {HuggingFace},
|
136 |
+
url = {https://huggingface.co/arsath-sm/face_classification_model1}
|
137 |
+
}
|
138 |
+
```
|
139 |
+
|
140 |
+
## Contributors π₯
|
141 |
+
- Arsath S.M
|
142 |
+
- Faahith K.R.M
|
143 |
+
- Arafath M.S.M
|
144 |
+
|
145 |
+
University of Jaffna
|
146 |
+
|
147 |
+
## License π
|
148 |
+
This model is licensed under the MIT License.
|