Browse Source

Dateien hochladen nach „“

master
Nicole Weber 2 years ago
parent
commit
8d132a63d2
4 changed files with 22 additions and 13 deletions
  1. 12
    5
      UIModellVisuell.py
  2. 9
    8
      dll.cpp
  3. BIN
      dll.so
  4. 1
    0
      start.sh

+ 12
- 5
UIModellVisuell.py View File

from subprocess import * from subprocess import *
from threading import Thread from threading import Thread
import time import time
import re


from UIModell import Modell from UIModell import Modell


process = Popen(command, stdout=PIPE, universal_newlines=True) process = Popen(command, stdout=PIPE, universal_newlines=True)


self.openVibeAktiv = True self.openVibeAktiv = True
counter = 0
counter = 0
acc = 0
while True: while True:
output = process.stdout.readline() output = process.stdout.readline()
print(output.strip()) print(output.strip())
x = output.find("aka Classifier trainer") x = output.find("aka Classifier trainer")
accuracy = output.find("Training set accuracy is")
accuracy = output.find("Cross-validation test accuracy is ")
y = output.find("Error") y = output.find("Error")
if(x != -1): if(x != -1):
counter = counter +1 counter = counter +1
#counter = 18 #counter = 18
if(counter >= 17): if(counter >= 17):
print("Training finished") print("Training finished")
self.controller.addInfoText('Beenden des Training\n')
self.controller.addInfoText('Beenden des Training (' + acc + ')\n')
process.terminate() process.terminate()
self.controller.stop("save") self.controller.stop("save")
break break
self.controller.addInfoText("Fehler beim Classifier Training aufgetaucht\n") self.controller.addInfoText("Fehler beim Classifier Training aufgetaucht\n")
process.terminate() process.terminate()
break break
elif(accuracy != -1):
print("ACCURACY" + output)
if(accuracy != -1):
ansi_escape = re.compile(r'\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])')
test = output.encode("windows-1252").decode("utf-8")
i = len("Cross-validation test")
acc_s = test[accuracy+i:accuracy+i+41].strip()
acc = ansi_escape.sub('', acc_s)
print(acc)
if not self.aktiv: if not self.aktiv:
print("stop") print("stop")
break break

+ 9
- 8
dll.cpp View File

string pathSpatialCFG_visuell = "Projekte/OpenVibe_THN-p300-bci-main/p300-visual/cfg/p300-spatial-filter.cfg"; string pathSpatialCFG_visuell = "Projekte/OpenVibe_THN-p300-bci-main/p300-visual/cfg/p300-spatial-filter.cfg";
string PATH_DEFAULT_visuell = "Projekte/OpenVibe_THN-p300-bci-main/p300-visual/datasets"; string PATH_DEFAULT_visuell = "Projekte/OpenVibe_THN-p300-bci-main/p300-visual/datasets";


string fileCopySpellingVisuell = "p300-visual-1-acquisition.xml";
string filefreeSpellingVisuell = "p300-visual-4-online.xml";
string fileXDawnTrainingVisuell = "p300-visual-2-train-xDAWN.xml";
string fileClassifierTrainingVisuell = "p300-visual-3-train-classifier.xml";
string fileCopySpellingVisuell = "p300-xdawn-1-acquisition.xml";
string filefreeSpellingVisuell = "p300-xdawn-4-online.xml";
string fileXDawnTrainingVisuell = "p300-xdawn-2-train-xDAWN.xml";
string fileClassifierTrainingVisuell = "p300-xdawn-3-train-classifier.xml";


//taktil //taktil
//------------------------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------------------------
char* getCommandFreespellingVisuell() char* getCommandFreespellingVisuell()
{ {
string s = ""; string s = "";
s = s.append(command).append(" ").append(PATH_OV).append(" ").append(config).append(" ").append(PATH_FILES_ConfigFile).append(" ").append( play).append(" ").append(PATH_FILES_Visual).append(filefreeSpellingVisuell).append(" ").append(nogui);
s = s.append(command).append(" ").append(PATH_OV).append(" ").append( play).append(" ").append(PATH_FILES_Visual).append(filefreeSpellingVisuell).append(" ").append(nogui);
char char_array[s.length()+1]; char char_array[s.length()+1];
strcpy(char_array, s.c_str()); strcpy(char_array, s.c_str());
char* s_convert = char_array; char* s_convert = char_array;
char* getCommandCopyspellingVisuell() char* getCommandCopyspellingVisuell()
{ {
string s = ""; string s = "";
s = s.append(command).append(" ").append(PATH_OV).append(" ").append(config).append(" ").append(PATH_FILES_ConfigFile).append(" ").append( play).append(" ").append(PATH_FILES_Visual).append(fileCopySpellingVisuell).append(" ").append(nogui);
s = s.append(command).append(" ").append(PATH_OV).append(" ").append( play).append(" ").append(PATH_FILES_Visual).append(fileCopySpellingVisuell).append(" ").append(nogui);
char char_array[s.length()+1]; char char_array[s.length()+1];
strcpy(char_array, s.c_str()); strcpy(char_array, s.c_str());
char* s_convert = char_array; char* s_convert = char_array;
char* getCommandXDawn_visuell() char* getCommandXDawn_visuell()
{ {
string s = ""; string s = "";
s = s.append(command).append(" ").append(PATH_OV).append(" ").append(config).append(" ").append(PATH_FILES_ConfigFile).append(" ").append( playFast).append(" ").append(PATH_FILES_Visual).append(fileXDawnTrainingVisuell).append(" ").append(nogui);
s = s.append(command).append(" ").append(PATH_OV).append(" ").append( playFast).append(" ").append(PATH_FILES_Visual).append(fileXDawnTrainingVisuell).append(" ").append(nogui);
char char_array[s.length()+1]; char char_array[s.length()+1];
strcpy(char_array, s.c_str()); strcpy(char_array, s.c_str());
char* s_convert = char_array; char* s_convert = char_array;
char* getCommandClassifier_visuell() char* getCommandClassifier_visuell()
{ {
string s = ""; string s = "";
s = s.append(command).append(" ").append(PATH_OV).append(" ").append(config).append(" ").append(PATH_FILES_ConfigFile).append(" ").append( playFast).append(" ").append(PATH_FILES_Visual).append(fileClassifierTrainingVisuell).append(" ").append(nogui);
s = s.append(command).append(" ").append(PATH_OV).append(" ").append( playFast).append(" ").append(PATH_FILES_Visual).append(fileClassifierTrainingVisuell).append(" ").append(nogui);
char char_array[s.length()+1]; char char_array[s.length()+1];
strcpy(char_array, s.c_str()); strcpy(char_array, s.c_str());
char* s_convert = char_array; char* s_convert = char_array;
char* s_convert = char_array; char* s_convert = char_array;
return s_convert; return s_convert;
} }


char* getCommandStartAquisitionServer() char* getCommandStartAquisitionServer()
{ {

BIN
dll.so View File


+ 1
- 0
start.sh View File

chmod +rw log.txt chmod +rw log.txt
./gui >> log.txt ./gui >> log.txt




Loading…
Cancel
Save