Added bai-3.1 Emotion
Browse files
.gitattributes
CHANGED
|
@@ -37,3 +37,4 @@ Main[[:space:]]Models/bai-2.0/bai-2.0.keras filter=lfs diff=lfs merge=lfs -text
|
|
| 37 |
Main[[:space:]]Models/bai-2.1/bai-2.1.keras filter=lfs diff=lfs merge=lfs -text
|
| 38 |
Main[[:space:]]Models/bai-2.2/bai-2.2.keras filter=lfs diff=lfs merge=lfs -text
|
| 39 |
Main[[:space:]]Models/bai-3.0[[:space:]]Emotion/bai-3.0[[:space:]]Emotion.keras filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 37 |
Main[[:space:]]Models/bai-2.1/bai-2.1.keras filter=lfs diff=lfs merge=lfs -text
|
| 38 |
Main[[:space:]]Models/bai-2.2/bai-2.2.keras filter=lfs diff=lfs merge=lfs -text
|
| 39 |
Main[[:space:]]Models/bai-3.0[[:space:]]Emotion/bai-3.0[[:space:]]Emotion.keras filter=lfs diff=lfs merge=lfs -text
|
| 40 |
+
Main[[:space:]]Models/bai-3.1[[:space:]]Emotion/bai-3.1[[:space:]]Emotion.keras filter=lfs diff=lfs merge=lfs -text
|
Main Models/bai-3.1 Emotion/README.md
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# bai-3.1 Emotion (3549313 parametre)
|
| 2 |
+
|
| 3 |
+
## "bai-3.1 Emotion" modeli, bir önceki sürümüne göre daha optimize ve kararlı hale getirilmiş versiyonudur. Tüm işlevleri aynıdır.
|
| 4 |
+
|
| 5 |
+
#### NOT: Gerçek zamanlı EEG veri takibi uygulamasına modeli entegre ederseniz, gerçek zamanlı olarak duygu tahmini yapabilmektedir. Uygulamaya erişebilmek için: https://github.com/neurazum/Realtime-EEG-Monitoring
|
| 6 |
+
|
| 7 |
+
## -----------------------------------------------------------------------------------
|
| 8 |
+
|
| 9 |
+
# bai-3.1 Emotion (3549313 parameters)
|
| 10 |
+
|
| 11 |
+
## The "bai-3.1 Emotion" model is a more optimized and stable version compared to the previous version. All functions are the same.
|
| 12 |
+
|
| 13 |
+
## NOTE: If you integrate the model into a real-time EEG data tracking application, it can predict emotions in real time. To access the application: https://github.com/neurazum/Realtime-EEG-Monitoring
|
| 14 |
+
**Doğruluk/Accuracy: %95,1219512195122**
|
| 15 |
+
|
| 16 |
+
[](https://www.youtube.com/watch?v=qUkId3S9W94)
|
| 17 |
+
|
| 18 |
+
# Kullanım / Usage
|
| 19 |
+
|
| 20 |
+
```python
|
| 21 |
+
import numpy as np
|
| 22 |
+
import pandas as pd
|
| 23 |
+
from sklearn.preprocessing import StandardScaler
|
| 24 |
+
from tensorflow.keras.models import load_model
|
| 25 |
+
import matplotlib.pyplot as plt
|
| 26 |
+
|
| 27 |
+
model_path = 'model-path'
|
| 28 |
+
|
| 29 |
+
model = load_model(model_path)
|
| 30 |
+
|
| 31 |
+
model_name = model_path.split('/')[-1].split('.')[0]
|
| 32 |
+
|
| 33 |
+
plt.figure(figsize=(10, 6))
|
| 34 |
+
plt.title(f'Duygu Tahmini ({model_name}.1)')
|
| 35 |
+
plt.xlabel('Zaman')
|
| 36 |
+
plt.ylabel('Sınıf')
|
| 37 |
+
plt.legend(loc='upper right')
|
| 38 |
+
plt.grid(True)
|
| 39 |
+
plt.show()
|
| 40 |
+
model.summary()
|
| 41 |
+
```
|
| 42 |
+
|
| 43 |
+
# Tahmin / Prediction
|
| 44 |
+
|
| 45 |
+
```python
|
| 46 |
+
import numpy as np
|
| 47 |
+
import pandas as pd
|
| 48 |
+
from sklearn.preprocessing import StandardScaler
|
| 49 |
+
from tensorflow.keras.models import load_model
|
| 50 |
+
|
| 51 |
+
model_path = 'model-path'
|
| 52 |
+
|
| 53 |
+
model = load_model(model_path)
|
| 54 |
+
|
| 55 |
+
scaler = StandardScaler()
|
| 56 |
+
|
| 57 |
+
predictions = model.predict(X_new_reshaped)
|
| 58 |
+
predicted_labels = np.argmax(predictions, axis=1)
|
| 59 |
+
|
| 60 |
+
label_mapping = {'NEGATIVE': 0, 'NEUTRAL': 1, 'POSITIVE': 2}
|
| 61 |
+
label_mapping_reverse = {v: k for k, v in label_mapping.items()}
|
| 62 |
+
|
| 63 |
+
#new_input = np.array([[23, 465, 12, 9653] * 637])
|
| 64 |
+
new_input = np.random.rand(1, 2548) # 1 örnek ve 2548 özellik
|
| 65 |
+
new_input_scaled = scaler.fit_transform(new_input)
|
| 66 |
+
new_input_reshaped = new_input_scaled.reshape((new_input_scaled.shape[0], 1, new_input_scaled.shape[1]))
|
| 67 |
+
|
| 68 |
+
new_prediction = model.predict(new_input_reshaped)
|
| 69 |
+
predicted_label = np.argmax(new_prediction, axis=1)[0]
|
| 70 |
+
predicted_emotion = label_mapping_reverse[predicted_label]
|
| 71 |
+
|
| 72 |
+
if predicted_emotion == 'NEGATIVE':
|
| 73 |
+
predicted_emotion = 'Negatif'
|
| 74 |
+
elif predicted_emotion == 'NEUTRAL':
|
| 75 |
+
predicted_emotion = 'Nötr'
|
| 76 |
+
elif predicted_emotion == 'POSITIVE':
|
| 77 |
+
predicted_emotion = 'Pozitif'
|
| 78 |
+
|
| 79 |
+
print(f'Giriş Verileri: {new_input}')
|
| 80 |
+
print(f'Tahmin Edilen Duygu: {predicted_emotion}')
|
| 81 |
+
```
|
| 82 |
+
|
| 83 |
+
# Python Sürümü / Python Version
|
| 84 |
+
|
| 85 |
+
### 3.9 <=> 3.13
|
| 86 |
+
|
| 87 |
+
# Modüller / Modules
|
| 88 |
+
|
| 89 |
+
```bash
|
| 90 |
+
matplotlib==3.8.0
|
| 91 |
+
matplotlib-inline==0.1.6
|
| 92 |
+
numpy==1.26.4
|
| 93 |
+
pandas==2.2.2
|
| 94 |
+
scikit-learn==1.3.1
|
| 95 |
+
tensorflow==2.15.0
|
| 96 |
+
```
|
Main Models/bai-3.1 Emotion/bai-3.1 Emotion.keras
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:db15893f52bd3061b8f53eb37230b8e9032a3bae5b65fa0c5782c1ad82ab7a64
|
| 3 |
+
size 42946079
|