Exemple #1
0
def match(svmdata, modeldata):
    y,x = svmutil.svm_read_problem(svmdata)
    m = svmutil.svm_load_model(modeldata)
    labels, accuracy, values = svmutil.svm_predict(y,x,m)
    # We'll see if the labels work, and what they return, and we'll classify from there
    import pdb;pdb.set_trace()
    return 0
Exemple #2
0
def runmatch(modeldata):
    m = svmutil.svm_load_model.model(data)
    window = deque()
    consume = False
    while 1:
        output = ser.readline()
        data = output.split(',')
        y = arange(len(data),1,1)
        labels, accuracy, values = svmutil.svm_predict(y,x,m)
        window.appendleft(accuracy)
        if len(window) > 5:
            window.pop()
        if sum(window) > 3 and consume == False:
            print label
            consume = True
        if sum(window) < 2 and consume == True:
            consume = False