Commit 1848170e authored by Taddeus Kroes's avatar Taddeus Kroes

Code cleanup.

parent 85c8eaae
......@@ -5,8 +5,6 @@ from svmutil import svm_train, svm_problem, svm_parameter, svm_predict, \
class Classifier:
def __init__(self, c=None, gamma=None, filename=None, neighbours=3, \
verbose=0):
self.neighbours = neighbours
if filename:
# If a filename is given, load a model from the given filename
self.model = svm_load_model(filename)
......@@ -19,6 +17,7 @@ class Classifier:
self.param.gamma = gamma # Parameter for radial kernel
self.model = None
self.neighbours = neighbours
self.verbose = verbose
def save(self, filename):
......
......@@ -12,8 +12,8 @@ def load_classifier(neighbours, blur_scale, c=None, gamma=None, verbose=0):
if verbose:
print 'Loading classifier...'
classifier = Classifier(filename=classifier_file, verbose=verbose)
classifier.neighbours = neighbours
classifier = Classifier(filename=classifier_file, \
neighbours=neighbours, verbose=verbose)
elif c != None and gamma != None:
if verbose:
print 'Training new classifier...'
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment