In [12]:
from sklearn.externals import joblib
import numpy as np
import sqlite3
from enum import Enum
from skimage import data
clf = joblib.load('classifier.pkl')
conn = sqlite3.connect('sessions.db')
c = conn.cursor()
class Participant(Enum):
none = 0
adult = 1
child = 2
pet = 3
rows = [r for r in c.execute("SELECT * FROM readings WHERE subject_type='none'")]
image_paths = ['image_data/{}'.format(r[5]) for r in rows]
X = [np.array(data.imread(p)).flatten() for p in image_paths]
y = [Participant[r[2]].value for r in rows]
clf.predict(X[0].reshape(1, -1))
Out[12]:
In [ ]: