Import SVM in cv2 [python]
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...
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()
"I installed openCV 3.1.0" -- that's from Dec 21, 2015
the github repo you're trying with NEVER had a solved issue or a merged pr.
consider this DEAD. (waste of time)
i did not completely parse it, but what about the letter M and J ?
(did you do even any reasearch about ASL ?)
Yes I'm aware that not all ASL letters are represented in this project, this is experimental. I'm asking about this error, if you have any idea:
api changed a lot in the meantime. forget about 3.1.0 (outdated, noone sane will help you with that)
try to gasp the idea there, and recode it, using latest 3.4.2. then we can help you. (cv2.ml.something)
please understand, that noone is interested in fixing bugs from the past (or poorly maintained 3rd party repos)