Skip to content

Commit

Permalink
Update due to library version changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
faturita committed Jun 27, 2024
1 parent f983bd8 commit a6622ab
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 17 deletions.
4 changes: 1 addition & 3 deletions filter_spatial.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,13 @@

# The first plot with all the signals, as it may be in reality.
plt.figure(1)
plt.title('Sinusoidal')
plt.subplot(3,1,1)
plt.plot(s1, color='red')
plt.title('Squared')
plt.subplot(3,1,2)
plt.plot(s2, color='steelblue')
plt.title('Sawtooth')
plt.subplot(3,1,3)
plt.plot(s3, color='orange')
plt.show()


# Put all the signals together in a multichannel arrangement
Expand Down
2 changes: 1 addition & 1 deletion onepassclassifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def unpickle_keypoints(array):
keypoints = []
descriptors = []
for point in array:
temp_feature = cv2.KeyPoint(x=point[0][0],y=point[0][1],_size=point[1], _angle=point[2], _response=point[3], _octave=point[4], _class_id=point[5])
temp_feature = cv2.KeyPoint(x=point[0][0],y=point[0][1],size=point[1], angle=point[2], response=point[3], octave=point[4], class_id=point[5])
temp_descriptor = point[6]
keypoints.append(temp_feature)
descriptors.append(temp_descriptor)
Expand Down
2 changes: 1 addition & 1 deletion onepassfeatureextraction.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def unpickle_keypoints(array):

print ("Connecting..")

for i in range(1,20):
for i in range(1,2000):
# Capture frame-by-frame
ret, frame = cap.read()

Expand Down
23 changes: 11 additions & 12 deletions signalfeatureclassification.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
Signal Feature Classification
==========================================
# Run with ann virtual environment
# EPOC Emotiv file format https://www.researchgate.net/publication/332514530_EPOC_Emotiv_EEG_Basics
# Run with a virtual environment with keras, sklearn, numpy and tensorflow installed.
# EPOC Emotiv file format https://arxiv.org/pdf/2206.09051
# OpemMP sometimes raises coredumps, try export KMP_DUPLICATE_LIB_OK=TRUE
Expand Down Expand Up @@ -38,6 +38,14 @@

from scipy.signal import butter, lfilter

from sklearn.linear_model import LogisticRegression

from keras.models import Sequential
from keras.layers import Dense

import matplotlib.pyplot as plt


def isartifact(window, threshold=80):
# Window is EEG Matrix

Expand All @@ -46,10 +54,6 @@ def isartifact(window, threshold=80):
signalaverage = ameans.tolist()
athresholds = np.asarray([threshold]*len(signalaverage))

#print awindow
#print ameans
#print athresholds

# FIXME
for t in range(0,len(window)):
asample = (ameans+athresholds)-awindow[t]
Expand All @@ -62,7 +66,7 @@ def isartifact(window, threshold=80):

return False

import matplotlib.pyplot as plt


def butter_bandpass(lowcut, highcut, fs, order=5):
nyq = 0.5 * fs
Expand Down Expand Up @@ -296,8 +300,6 @@ def classify(afeatures1, afeatures2, featuresize):
report = classification_report(testlabels, predlabels, target_names=target_names)
print(report)

from sklearn.linear_model import LogisticRegression

# all parameters not specified are set to their defaults
logisticRegr = LogisticRegression()
logisticRegr.fit(trainingdata,traininglabels)
Expand All @@ -315,9 +317,6 @@ def classify(afeatures1, afeatures2, featuresize):
report = classification_report(testlabels, predlabels, target_names=target_names)
print(report)

from keras.models import Sequential
from keras.layers import Dense

model = Sequential([
Dense(64, activation='tanh', input_shape=(trainingdata.shape[1],)),
Dense(32, activation='tanh'),
Expand Down

0 comments on commit a6622ab

Please sign in to comment.