Trying to simply run this project: https://github.com/mjk188/ASL-Translator
Anyone know how to set up SVM stuff inside cv2? I installed openCV 3.1.0 via these instructions: https://www.pyimagesearch.com/2015/06/15/install-opencv-3-0-and-python-2-7-on-osx/
Getting this error:
File "/ASL-Translator/svm_train.py", line 4, in <module>
svm_params = dict( kernel_type = cv2.SVM_RBF,
AttributeError: 'module' object has no attribute 'SVM_RBF'
Code giving error from svm_train.py:
import cv2
import numpy as np
from numpy.linalg import norm
svm_params = dict( kernel_type = cv2.SVM_RBF, svm_type = cv2.SVM_C_SVC, C=2.67, gamma=5.383 )
class StatModel(object):
def load(self, fn):
self.model.load(fn) #python rapper bug
def save(self, fn):
self.model.save(fn)
class SVM(StatModel):
def __init__(self, C = 1, gamma = 0.5):
self.model = cv2.SVM()
# self.model.setGamma(gamma)
# self.model.setC(C)
# self.model.setKernel(cv2.SVM_RBF)
# self.model.setType(cv2.SVM_C_SVC)
def train(self, samples, responses):
self.model.train(samples, responses,params=svm_params) # inbuilt training function
def predict(self, samples):
return self.model.predict_all(samples).ravel()