NeuroScreen, gerรงek zamanlฤฑ EEG sinyal analizi ile modern web teknolojilerini birleลtiren kapsamlฤฑ bir Beyin-Bilgisayar Arayรผz (BCI) sistemidir. Sistem, beyin sinyali izleme iรงin etkileลimli bir web arayรผzรผ saฤlar ve saฤlฤฑk sektรถrรผ odaklฤฑ 4 kategorili odaklanma terapisi sunar.
- Gerรงek zamanlฤฑ EEG frekans spektrumu analizi
- Canlฤฑ FFT gรถrselleลtirme ile รถzelleลtirilebilir frekans bantlarฤฑ
- รoklu frekans bantฤฑ izleme (Alpha, Beta, SMR, High Beta)
- Gรผrรผltรผ filtreleme ile uyarlanabilir sinyal iลleme
- Klinik seviyede beyin dalgasฤฑ simรผlasyonu
- 4 รถzelleลtirilebilir saฤlฤฑk kategorisi (Su, Klima, Tuvalet, SOS)
- Gerรงek zamanlฤฑ EEG spektrumu akฤฑลฤฑ
- Odaklanma oturumlarฤฑ iรงin ilerleme takibi
- Modern glassmorphism tasarฤฑm ile duyarlฤฑ arayรผz
- Otomatik veri normalizasyonu (5 saniye hareketsizlik)
- Tรผrkรงe dil desteฤi
neuroscreen/
โโโ main.py # Flask web uygulama sunucusu
โโโ eeg_plot.py # EEG sinyal iลleme ve gรถrselleลtirme
โโโ data.txt # Gerรงek zamanlฤฑ veri depolama
โโโ wsgi.py # รretim WSGI giriล noktasฤฑ
โโโ config.py # Yapฤฑlandฤฑrma ayarlarฤฑ
โโโ requirements.txt # Python baฤฤฑmlฤฑlฤฑklarฤฑ
โโโ Dockerfile # Docker container yapฤฑlandฤฑrmasฤฑ
โโโ docker-compose.yml # Docker Compose orchestration
โโโ nginx.conf # Nginx reverse proxy yapฤฑlandฤฑrmasฤฑ
โโโ deploy.sh # Linux/Mac deployment script
โโโ deploy.bat # Windows deployment script
โโโ .env.example # รevre deฤiลkeni รถrneฤi
โโโ .gitignore # Git ignore kurallarฤฑ
โโโ templates/ # HTML ลablonlarฤฑ
โ โโโ index.html # Ana dashboard
โ โโโ focus.html # Odaklanma terapisi arayรผzรผ
โโโ static/ # Statik web varlฤฑklarฤฑ
โโโ css/
โ โโโ style.css # Stil dosyasฤฑ
โโโ js/
โ โโโ app.js # Frontend JavaScript
โโโ images/
โโโ logo.png # Uygulama logosu
- Python 3.8+
- Modern web tarayฤฑcฤฑsฤฑ
- Git (isteฤe baฤlฤฑ)
# Projeyi klonlayฤฑn
git clone <repository-url>
cd neuroscreen
# Deployment script'ini รงalฤฑลtฤฑrฤฑn
deploy.bat# Projeyi klonlayฤฑn
git clone <repository-url>
cd neuroscreen
# Deployment script'ini รงalฤฑลtฤฑrฤฑn
chmod +x deploy.sh
./deploy.sh# Sanal ortam oluลturun
python -m venv venv
# Sanal ortamฤฑ etkinleลtirin
# Windows: venv\Scripts\activate
# Linux/Mac: source venv/bin/activate
# Baฤฤฑmlฤฑlฤฑklarฤฑ yรผkleyin
pip install -r requirements.txt
# Uygulamayฤฑ baลlatฤฑn
python main.pyWindows:
start_production.batLinux/Mac:
./start_production.sh# Docker container oluลturun
docker build -t neuroscreen .
# Container'ฤฑ รงalฤฑลtฤฑrฤฑn
docker run -d -p 5000:5000 neuroscreen# Tรผm servisleri baลlatฤฑn (Nginx + NeuroScreen)
docker-compose up -d
# Loglarฤฑ gรถrรผntรผleyin
docker-compose logs -fNginx yapฤฑlandฤฑrmasฤฑ dahil edilmiลtir:
- Statik dosya รถnbellekleme
- Gzip sฤฑkฤฑลtฤฑrma
- Rate limiting
- SSL/TLS desteฤi (yapฤฑlandฤฑrma gerekli)
- รrnekleme Hฤฑzฤฑ: 256 Hz
- Frekans Bantlarฤฑ:
- Alpha dalgalarฤฑ: 8-13 Hz (rahatlatฤฑcฤฑ odaklanma)
- SMR: 12-15 Hz (sensorimotor ritim)
- Beta dalgalarฤฑ: 14-30 Hz (aktif odaklanma)
- High Beta: 30+ Hz (yรผksek uyarฤฑlma)
- Sinyal รretimi: Klinik seviyede gerรงekรงi EEG simรผlasyonu
- Gรถrselleลtirme: Gerรงek zamanlฤฑ dual-plot (zaman + frekans)
- Backend: Flask REST API
- Frontend: Vanilla JavaScript + CSS3 Glassmorphism
- Gerรงek Zamanlฤฑ ฤฐletiลim: Server-Sent Events
- Veri Depolama: Dosya tabanlฤฑ JSON depolama
- Su: Hidrasyon hatฤฑrlatฤฑcฤฑsฤฑ (mavi tema)
- Klima: Hava koลullarฤฑ kontrolรผ (aรงฤฑk mavi tema)
- Tuvalet: Mola hatฤฑrlatฤฑcฤฑsฤฑ (sarฤฑ tema)
- SOS: Acil durum sinyali (kฤฑrmฤฑzฤฑ tema)
frequency_mapping = {
"first": {"freq": 10, "name": "Alpha (Relaxed Focus)"}, # Su
"second": {"freq": 18, "name": "SMR (Sensory Motor)"}, # Klima
"third": {"freq": 24, "name": "Beta (Active Focus)"}, # Tuvalet
"fifth": {"freq": 30, "name": "High Beta (Alert)"} # SOS
}- 5 saniye hareketsizlik sonrasฤฑ otomatik sฤฑfฤฑrlama
- Fare hareketi, klavye aktivitesi ve dokunma algฤฑlama
- Sessiz arka plan normalizasyonu
- Modern backdrop-filter efektleri
- Animasyonlu gradyan arka planlar
- Responsive 2x2 grid layout
- Geliลmiล hover efektleri
| Uรง Nokta | Metod | Aรงฤฑklama |
|---|---|---|
/ |
GET | Ana dashboard |
/focus |
GET | Odaklanma terapisi arayรผzรผ |
/eeg_stream |
GET | Gerรงek zamanlฤฑ EEG akฤฑลฤฑ |
/get_data |
GET | Mevcut veriyi al |
/push_data |
POST | Veri deฤerlerini gรผncelle |
/reset_data |
GET | Veriyi varsayฤฑlana sฤฑfฤฑrla |
{
"first": 0, // Su kategorisi aktivasyonu (0/1)
"second": 0, // Klima kategorisi aktivasyonu (0/1)
"third": 0, // Tuvalet kategorisi aktivasyonu (0/1)
"fifth": 0 // SOS kategorisi aktivasyonu (0/1)
}- Fare Hover: 5 saniye hover ile kategori aktivasyonu
- ฤฐlerleme Gรถrselleลtirme: Gerรงek zamanlฤฑ ilerleme รงubuklarฤฑ
- Gรถrsel Geri Bildirim: Baลarฤฑ/hata bildirimleri
- Hareketsizlik Algฤฑlama: 5 saniye sonra otomatik normalizasyon
- Oturum Takibi: Gerรงek zamanlฤฑ oturum sรผresi
- Sistem Durumu: Canlฤฑ sistem durumu gรถstergesi
# .env dosyasฤฑ oluลturun (.env.example'dan kopyalayฤฑn)
cp .env.example .env
# รretim iรงin รถnemli ayarlar
SECRET_KEY=your-super-secret-key
FLASK_ENV=production
HOST=0.0.0.0
PORT=5000fs = 256 # รrnekleme frekansฤฑ (Hz)
window_size = 4 # Sinyal penceresi (saniye)
noise_level = 3 # Arka plan gรผrรผltรผsรผ
transition_duration = 3.0 # Geรงiล sรผresi (saniye)- CSRF korumasฤฑ
- XSS korumasฤฑ
- Content Security Policy
- Rate limiting (Nginx ile)
- HTTPS yรถnlendirmesi
-
EEG akฤฑลฤฑ yรผklenmiyor:
- Flask sunucusunun รงalฤฑลtฤฑฤฤฑnฤฑ doฤrulayฤฑn
- Tarayฤฑcฤฑ konsolunda hatalarฤฑ kontrol edin
- data.txt dosyasฤฑnฤฑn var olduฤunu ve okunabilir olduฤunu kontrol edin
-
Baฤฤฑmlฤฑlฤฑk hatalarฤฑ:
- Python versiyonunu kontrol edin (3.8+)
- Sanal ortamฤฑn etkin olduฤunu doฤrulayฤฑn
- requirements.txt'yi yeniden yรผkleyin
-
Port kullanฤฑmda hatasฤฑ:
- Farklฤฑ port kullanฤฑn:
python main.py --port 8000 - Mevcut Python iลlemlerini durdurun
- Farklฤฑ port kullanฤฑn:
-
Static dosyalar yรผklenmiyor:
- Static klasรถr yapฤฑsฤฑnฤฑ kontrol edin
- Nginx yapฤฑlandฤฑrmasฤฑnฤฑ doฤrulayฤฑn
- Dosya izinlerini kontrol edin
# Uygulama loglarฤฑ
tail -f logs/neuroscreen.log
# Nginx loglarฤฑ (Docker ile)
docker-compose logs nginx
# Container loglarฤฑ
docker logs <container-name>- Gunicorn Workers: 4 worker (varsayฤฑlan)
- Timeout: 120 saniye
- Static File Caching: 1 saat
- Gzip Compression: Etkin
- Rate Limiting: API iรงin 10 req/s
- Health check endpoints
- Application metrics
- Resource usage monitoring
- Error tracking
- Gerรงek EEG donanฤฑm entegrasyonu (OpenBCI, NeuroSky)
- Makine รถฤrenmesi tabanlฤฑ sinyal sฤฑnฤฑflandฤฑrmasฤฑ
- รoklu kullanฤฑcฤฑ oturum yรถnetimi
- Geliลmiล gรถrselleลtirme seรงenekleri
- Mobil uygulama desteฤi
- Bulut veri senkronizasyonu
- Ses komut entegrasyonu
- Biometrik kimlik doฤrulama
- Repository'yi fork edin
- Feature branch oluลturun
- Deฤiลikliklerinizi commit edin
- Branch'inizi push edin
- Pull Request oluลturun
Bu proje aรงฤฑk kaynaklฤฑdฤฑr ve MIT Lisansฤฑ altฤฑnda mevcuttur.
Destek ve sorular iรงin:
- Repository'de issue oluลturun
- Sorun giderme bรถlรผmรผnรผ kontrol edin
- Teknik dokรผmantasyonu inceleyin
- Flask ekibi web framework iรงin
- NumPy ve Matplotlib bilimsel hesaplama iรงin
- Modern web teknolojileri topluluฤu
- Aรงฤฑk kaynak katkฤฑcฤฑlarฤฑ
Not: Bu sistem araลtฤฑrma ve eฤitim amaรงlarฤฑna yรถneliktir. Tฤฑbbi uygulamalar iรงin saฤlฤฑk uzmanlarฤฑ ile gรถrรผลรผn ve ilgili dรผzenlemelere uygunluฤu saฤlayฤฑn.
- Sampling Rate: 256 Hz
- Frequency Bands:
- Alpha waves: 14 Hz
- Beta waves: 21-33 Hz range
- Signal Generation: Synthetic EEG with configurable amplitude and noise
- Visualization: Real-time FFT spectrum (0-40 Hz range)
- Face Detection: MediaPipe Face Mesh with 468 landmarks
- Iris Tracking: Precise iris center calculation
- Calibration: Multi-point polynomial regression (order 2)
- Filtering: Kalman filter for smooth tracking
- Accuracy: Sub-pixel precision with noise reduction
- Backend: Flask REST API
- Frontend: Vanilla JavaScript with CSS3
- Real-time Communication: Server-Sent Events for EEG streaming
- Data Storage: File-based JSON storage
-
Launch the Flask server:
python main.py
The server will start on
http://localhost:5000 -
Access the dashboard:
- Navigate to
http://localhost:5000for EEG monitoring - Navigate to
http://localhost:5000/focusfor focus training
- Navigate to
-
Run the eye tracker:
cd "eye tracker" python main.py
-
Calibration Process:
- Press
cto start calibration - Follow the calibration points (look at each point for 0.8 seconds)
- System will automatically complete calibration
- Press
-
Controls:
c: Start calibrationv: Toggle camera viewr: Reset systemq: Quit application
frequency_mapping = {
"first": 21, # Focus Zone 1
"second": 24, # Focus Zone 2
"third": 27, # Focus Zone 3
"fourth": 30, # Focus Zone 4
"fifth": 33, # Focus Zone 5
"sixth": 14 # Relaxation Zone
}- Landmark Extraction: 468 facial landmarks
- Iris Points: 4-point iris detection per eye
- Normalization: Eye-relative coordinate system
- Bilateral Processing: Combined left and right eye data
# Polynomial feature expansion for improved accuracy
def poly_features(fx, fy, order=2):
if order == 2:
return [1, fx, fy, fx*fx, fy*fy, fx*fy]
return [1, fx, fy]| Endpoint | Method | Description |
|---|---|---|
/ |
GET | Main dashboard |
/focus |
GET | Focus training interface |
/eeg_stream |
GET | Real-time EEG stream |
/get_data |
GET | Retrieve current data |
/push_data |
POST | Update data values |
/reset_data |
GET | Reset data to defaults |
{
"first": 0, // Zone 1 activation (0/1)
"second": 0, // Zone 2 activation (0/1)
"third": 0, // Zone 3 activation (0/1)
"fourth": 0, // Zone 4 activation (0/1)
"fifth": 0, // Zone 5 activation (0/1)
"sixth": 0 // Zone 6 activation (0/1)
}The system divides the screen into 6 interactive zones:
- Water (Yellow) - Hydration reminder
- Food (Red) - Nutrition reminder
- Medicine (Yellow) - Medication reminder
- Images (Blue) - Visual content
- Toilet (Pink) - Break reminder
- Other (Green) - Miscellaneous actions
- Mouse Hover: 5-second hover triggers zone activation
- Eye Gaze: 5-second sustained gaze triggers activation
- Progress Visualization: Real-time progress bars
# Automatic detection
SCREEN_W = root.winfo_screenwidth()
SCREEN_H = root.winfo_screenheight()
# Manual configuration (if needed)
SCREEN_W, SCREEN_H = 1920, 1080fs = 256 # Sampling frequency (Hz)
window_size = 10 # Signal window (seconds)
noise_level = 5 # Background noise amplitudemin_detection_confidence = 0.5
min_tracking_confidence = 0.5
kalman_process_noise = 0.03-
Camera not detected:
- Check camera permissions
- Try different camera indices (0, 1, 2...)
- Ensure no other application is using the camera
-
EEG stream not loading:
- Verify Flask server is running
- Check browser console for errors
- Ensure data.txt file exists and is readable
-
Calibration failure:
- Ensure good lighting conditions
- Keep face centered and stable
- Maintain consistent distance from camera
-
Poor tracking accuracy:
- Recalibrate the system
- Check camera focus and resolution
- Ensure minimal head movement
- Real EEG hardware integration (OpenBCI, NeuroSky)
- Machine learning-based signal classification
- Multi-user session management
- Advanced visualization options
- Mobile application support
- Cloud data synchronization
- Voice command integration
- Biometric authentication
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
This project is open source and available under the MIT License.
For support and questions:
- Create an issue in the repository
- Check the troubleshooting section
- Review the technical documentation
- MediaPipe team for facial landmark detection
- OpenCV community for computer vision tools
- Flask team for the web framework
- NumPy and Matplotlib for scientific computing
Note: This system is designed for research and educational purposes. For medical applications, please consult with healthcare professionals and ensure compliance with relevant regulations.