Ejemplo n.º 1
0
def predict_emotion_paef():
    model = svmutil.svm_load_model(
        "C:/Users/Admin/PycharmProjects/Emotion_Detection/trained_models/paef_models/artphoto_train.txt.model"
    )
    mapping = {
        0: "happy",
        2: "fear",
        3: "excitement",
        4: "disgust",
        6: "anger",
        7: "sad"
    }

    with open('image_data.txt', 'r') as feature:
        for line in feature:
            line = line.strip()
            feature_vector = line.split()[1:]
            feature_vector = [
                float(item.split(":")[-1]) for item in feature_vector
            ]

        p_labs, p_acc, p_vals = svmutil.svm_predict([0], [feature_vector],
                                                    model)
        print("p_labs")
        print(p_labs)
        lab = p_labs[0]
        return mapping[int(lab)]
Ejemplo n.º 2
0
 def read_trained(self, input_file, filename):
     model_filename = self.get_model_filename(filename)
     num_lines = int(input_file.readline().split()[0])
     f = open(model_filename, 'w')
     for i in range(num_lines):
         f.write(input_file.readline())
     f.close()
     self._model = svm_load_model(model_filename)
     os.remove(model_filename)
Ejemplo n.º 3
0
 def read_trained ( self, input_file, filename ):
     model_filename = self.get_model_filename(filename)
     num_lines = int(input_file.readline().split()[0])
     f = open(model_filename,'w')
     for i in range(num_lines):
         f.write(input_file.readline())
     f.close()
     self._model = svm_load_model(model_filename)
     os.remove(model_filename)
Ejemplo n.º 4
0
def calcFtrs(seq):
    ftrs = []

    stc, mfe, efe, cstc, cmfe, cdst, frq, div, bpp = FOLDER.fold(seq)

    kmer = kContent(seq, 1)
    atcg = (kmer['a'] + kmer['t']) / (kmer['a'] + kmer['t'] + kmer['c'] + kmer['g'])
    if kmer['a'] + kmer['t'] == 0:
        at = 0
    else:
        at = kmer['a'] / (kmer['a'] + kmer['t'])
    if kmer['c'] + kmer['g'] == 0:
        cg = 0
    else:
        cg = kmer['c'] / (kmer['c'] + kmer['g'])

    svmftrs = numpy.array((atcg, at, cg))

    mfeavg_mdl = svmutil.svm_load_model(mfeavg200)
    mfestd_mdl = svmutil.svm_load_model(mfestd200)
    efeavg_mdl = svmutil.svm_load_model(efeavg200)
    # efestd_mdl = svmutil.svm_load_model(efestd200)

    mfeavg_avg, mfeavg_std = loadRange(mfeavg200 + '.rng')
    mfestd_avg, mfestd_std = loadRange(mfestd200 + '.rng')
    efeavg_avg, efeavg_std = loadRange(efeavg200 + '.rng')
    # efestd_avg, efestd_std = loadRange(efestd200 + '.rng')

    mfe_avg = svmutil.svm_predict([0],
                                  [((svmftrs - mfeavg_avg) / mfeavg_std).tolist()], mfeavg_mdl, options='-b 1')[0][0]
    mfe_std = svmutil.svm_predict([0],
                                  [((svmftrs - mfestd_avg) / mfestd_std).tolist()], mfestd_mdl, options='-b 1')[0][0]
    efe_avg = svmutil.svm_predict([0],
                                  [((svmftrs - efeavg_avg) / efeavg_std).tolist()], efeavg_mdl, options='-b 1')[0][0]
    # efe_std = svmutil.svm_predict([0],
    # [((svmftrs - efestd_avg) / efestd_std).tolist()], efestd_mdl, options='-b 1')[0][0]

    ftrs.append(mfe - mfe_avg)
    ftrs.append((mfe - mfe_avg) / mfe_std)
    ftrs.append(efe - efe_avg)
    # ftrs.append((efe - efe_avg) / efe_std)

    return numpy.array(ftrs)
Ejemplo n.º 5
0
def libSVM_converter(args):
    # not using target_opset for libsvm convert since the converter is only generating operators in ai.onnx.ml domain
    # but just passing in target_opset for consistency
    from libsvm.svmutil import svm_load_model
    source_model = svm_load_model(args.source)
    from onnxmltools.convert import convert_libsvm
    from onnxmltools.convert.common.data_types import FloatTensorType
    onnx_model = convert_libsvm(source_model,
                                initial_types=[('input',
                                                FloatTensorType([1, 'None']))],
                                target_opset=get_opset(args.ONNXVersion))
    return onnx_model
Ejemplo n.º 6
0
def calculate_image_quality_score(brisque_features):
    model = svmutil.svm_load_model('utils/brisque/brisque_svm.txt')
    scaled_brisque_features = scale_features(brisque_features)

    x, idx = svmutil.gen_svm_nodearray(
        scaled_brisque_features,
        isKernel=(model.param.kernel_type == svmutil.PRECOMPUTED))

    nr_classifier = 1
    prob_estimates = (svmutil.c_double * nr_classifier)()

    return svmutil.libsvm.svm_predict_probability(model, x, prob_estimates)
Ejemplo n.º 7
0
 def load_model(self, model_file, check_size=True):
     """
     Taken from: https://github.com/Duke-GCB/Predict-TF-Binding
     Loads a svm model from a file and computes its size
     :param model_file: The file name of the model to load
     :return: A dictionary with keys model, file, and size
     """
     model = svmutil.svm_load_model(model_file)
     model_dict = {'model': model}
     if check_size:
         # with >= libsvm-3.24, use this
         model_dict['size'] = len(model.get_SV()[0])
         # with < libsvm-3.24, use this
         # model_dict['size'] = len(model.get_SV()[0]) - 1 # sv includes a -1 term that is not present in the model file, so subtract 1
     return model_dict
Ejemplo n.º 8
0
def calculate_image_quality_score(brisque_features):
    '''
    Using a pre-trained SVR model we calculate the quality assessment scores.
    '''
    model = svmutil.svm_load_model(os.path.join("deeppixel", "iqa",  "brisque_svm.txt"))
    scaled_brisque_features = scaled(brisque_features)
    
    x, idx = svmutil.gen_svm_nodearray(
        scaled_brisque_features,
        isKernel=(model.param.kernel_type == svmutil.PRECOMPUTED))
    
    nr_classifier = 1
    prob_estimates = (svmutil.c_double * nr_classifier)()
    
    return svmutil.libsvm.svm_predict_probability(model, x, prob_estimates)
Ejemplo n.º 9
0
 def __init__(self):
     self._model = svmutil.svm_load_model(root_path('brisque', 'allmodel'))
     self._scaler = np.array([
         [-1, 1], [0.338, 10], [0.017204, 0.806612], [0.236, 1.642],
         [-0.123884, 0.20293],[0.000155, 0.712298], [0.001122, 0.470257],
         [0.244, 1.641], [-0.123586, 0.179083], [0.000152, 0.710456],
         [0.000975, 0.470984], [0.249, 1.555], [-0.135687, 0.100858],
         [0.000174, 0.684173], [0.000913, 0.534174], [0.258, 1.561],
         [-0.143408, 0.100486], [0.000179, 0.685696], [0.000888, 0.536508],
         [0.471, 3.264], [0.012809, 0.703171], [0.218, 1.046],
         [-0.094876, 0.187459], [1.5e-005, 0.442057], [0.001272, 0.40803],
         [0.222, 1.042], [-0.115772, 0.162604], [1.6e-005, 0.444362],
         [0.001374, 0.40243], [0.227, 0.996],
         [-0.117188, 0.09832299999999999], [3e-005, 0.531903],
         [0.001122,  0.369589], [0.228, 0.99], [-0.12243, 0.098658],
         [2.8e-005, 0.530092], [0.001118, 0.370399]])
Ejemplo n.º 10
0
    def load_model(self):
        if not os.path.isfile(self._modelname+"/"+self._pref+".model"):
            return False

        if self._classtype == "classifier":
            self._model = svmutil.svm_load_model(self._modelname+\
                                                 "/"+self._pref+".model")
        elif self._classtype == "structured":
            self._model = svmlight.read_model(self._modelname+\
                                              "/"+self._pref+".model")
        elif self._classtype == "percrank":
            m = KernelLBRankPerceptron(kernel=polynomial_kernel)
            mfile = open(self._modelname+"/"+self._pref+".model", 'rb')
            m.sv_a,m.sv_1,m.sv_2,m.bias = cPickle.load(mfile)
            mfile.close()
            self._model = m
        
        return True
Ejemplo n.º 11
0
def predict(data, path):
   if not os.path.exists(path):
      print 'Model path does not exist, do nothing.'
      return
   print "Loading features."
   integerizer = tools.integerization.CIntegerization.read(os.path.join(path, 'int'))
   model = svmutil.svm_load_model(os.path.join(path, "scr"))  
   print "Decoding."
   for sent in posreader.readpossent(data):
      print sent
      for start in range(len(sent)):
         for end in range(start, len(sent)):
            label, feature = extractfeat.extractOneFeat(sent, (start, end, None), integerizer)
            assert label == -1
            nodes, x = svmutil.gen_svm_nodearray(feature)
            label = svm.libsvm.svm_predict(model, nodes)
            probabilities = (ctypes.c_double*2)()
            label = svm.libsvm.svm_predict_probability(model, nodes, probabilities)
            print start, end, probabilities[0], probabilities[1]
Ejemplo n.º 12
0
    def __init__(self,
                 training_datafile,
                 classifier_dumpfile,
                 training_required=0):

        self.feature_list = open('app/data/feature_list.txt').readlines()
        self.training_datafile = training_datafile
        self.classifier_dumpfile = classifier_dumpfile

        # call training model
        if (training_required):
            self.classifier = self.get_SVM_trained_classifer(
                training_datafile, classifier_dumpfile)
        else:
            fp = open(classifier_dumpfile, 'r')
            if (fp):
                self.classifier = svm_load_model(classifier_dumpfile)
            else:
                self.classifier = self.get_SVM_trained_classifer(
                    training_datafile, classifier_dumpfile)
Ejemplo n.º 13
0
def predict(data, path):
   if not os.path.exists(path):
      print 'Model path does not exist, do nothing.'
      return
   print "Loading features."
   integerizer = tools.integerization.CIntegerization.read(os.path.join(path, 'int'))
   model = svmutil.svm_load_model(os.path.join(path, "scr"))  
   print "Working."
   for sent in io.getsent(data):
      labels = []
      for index in range(len(sent)):
         f = feature.extractFeatures(sent, index, integerizer)
         nodes, x = svmutil.gen_svm_nodearray(f)
         probabilities = (ctypes.c_double*2)()
         label = svm.libsvm.svm_predict_probability(model, nodes, probabilities)
         x = 1
         if probabilities[0] > cutoff:
            x = 0
         labels.append(str(x))
      print ' '.join(labels)
Ejemplo n.º 14
0
def predict(data, path):
    if not os.path.exists(path):
        print 'Model path does not exist, do nothing.'
        return
    print "Loading features."
    integerizer = tools.integerization.CIntegerization.read(
        os.path.join(path, 'int'))
    model = svmutil.svm_load_model(os.path.join(path, "scr"))
    print "Working."
    for sent in io.getsent(data):
        labels = []
        for index in range(len(sent)):
            f = feature.extractFeatures(sent, index, integerizer)
            nodes, x = svmutil.gen_svm_nodearray(f)
            probabilities = (ctypes.c_double * 2)()
            label = svm.libsvm.svm_predict_probability(model, nodes,
                                                       probabilities)
            x = 1
            if probabilities[0] > cutoff:
                x = 0
            labels.append(str(x))
        print ' '.join(labels)
Ejemplo n.º 15
0
def predict_emotion_paef():
    model = svmutil.svm_load_model("C:/Users/Admin/PycharmProjects/Emotion_Detection/trained_models/paef_models/artphoto_train.txt.model")
    mapping = {
        0 : "happy",
        2 : "fear",
        3 : "excitement",
        4 : "disgust",
        6 : "anger",
        7 : "sad"
    }

    with open('image_data.txt', 'r') as feature:
        for line in feature:
            line = line.strip()
            feature_vector = line.split()[1:]
            feature_vector = [float(item.split(":")[-1]) for item in feature_vector]

        p_labs, p_acc, p_vals = svmutil.svm_predict([0], [feature_vector], model)
        print("p_labs")
        print(p_labs)
        lab = p_labs[0]
        return mapping[int(lab)]
Ejemplo n.º 16
0
def main(args):
    ref_path = args.ref_path

    height = args.height
    width = args.width

    ref_fps = args.ref_fps
    bit_depth = args.bit_depth
    if bit_depth == 8:
        pix_format = 'yuv420p'
    else:
        pix_format = 'yuv420p10le'

    fps = args.dist_fps  #frame rate of distorted sequence

    #Obtain pseudo reference video by frame dropping using ffmpeg
    cmd = 'ffmpeg -r '+ str(ref_fps) +' -pix_fmt ' + pix_format + ' -s ' + str(width) +\
    'x' + str(height) + ' -i '+ ref_path + ' -filter:v fps=fps=' +\
    str(fps) + ' pseudo_reference.yuv'
    os.system(cmd)

    GREED_feat = greed_feat(args)

    #load svm model
    model = svm_load_model('model_params/' + args.temp_filt + '.model')

    #load parameter of trained features
    feat_param = scipy.io.loadmat('model_params/' + args.temp_filt +
                                  '_params.mat')
    low = feat_param['low'][0, :]
    high = feat_param['high'][0, :]
    GREED_feat = (GREED_feat - low) / (high - low)

    #Predict score
    score, _, _ = svm_predict([0.0], GREED_feat[None, :], model, '-q')
    print(score)
Ejemplo n.º 17
0
def main():
    m=svmutil.svm_load_model('trained_models/svm.model')
    relation_tag={0:'None',1:'has_value',2:'has_temp',3:'modified_by'}

    match=re.search('^(.*)\.txt',sys.argv[2])
    filename=sys.argv[2]
    if match:
        filename=match.group(1)

    input_dir=sys.argv[1]+'/'+filename+'_NER.xml'
    output_dir=sys.argv[1]+'/'+filename+'_Parsed.xml'
    print "Reading NER results from ", input_dir

    tree = ET.ElementTree(file=input_dir)

    root = tree.getroot()
    relations={}
    index=[]
    for child in root:

        syn_features=codecs.open('Tempfile/relation_scale','w')
        temp_pairs=relation_features.generate_pairs(child,syn_features)
        if temp_pairs:
            try:
                y,x=svmutil.svm_read_problem('Tempfile/relation_scale')
                p_label,p_acc,p_val=svmutil.svm_predict(y,x,m)
            except ValueError:
                for child2 in child.findall('text'):
                    print child2.text
                continue

        #print len(p_label),len(temp_pairs)
        else:
            p_label=[]
            temp_pairs=[]
        for j in range(0,len(p_label)):
            #print j
            relations[temp_pairs[j]]=p_label[j]

            indexes=temp_pairs[j].split("_")
            index.append(indexes[0])
            index.append(indexes[1])

        for child2 in child.findall('entity'):
            node_index=child2.attrib['index']
            child2.attrib['relation']='None'

            if node_index in index:

                right_pattern='^(\w+)_'+node_index
                left_pattern=node_index+'_(\w+)$'
                for relation in relations:
                    match1=re.search(left_pattern,relation)
                    match2=re.search(right_pattern,relation)
                    other_index= None
                    if match1:
                        other_index=match1.group(1)
                    else:
                        if match2:
                            other_index=match2.group(1)
                        else:
                            continue
                    relation_type=relation_tag[relations[relation]]
                    if relation_type == 'None':
                        continue

                    if child2.attrib['relation'] is 'None':
                        child2.attrib['relation']=other_index+":"+relation_type
                    else:
                        child2.attrib['relation']=child2.attrib['relation']+"|"+other_index+":"+relation_type
            #print child2.text,child2.attrib['index'],child2.attrib['relation']

    relation_excuted=os.path.exists("in.parse")
    if relation_excuted:
        os.system('rm in.parse')
    os.system('rm Tempfile/relation_scale')
    print "Writing Relation xml to ", output_dir
    new_tree=codecs.open(output_dir,'w')
    tree.write(new_tree)
    print "Finished!"
Ejemplo n.º 18
0
#!/usr/bin/env python3
import libsvm.svmutil as svm
import sys

if __name__ == "__main__":
    model_path = "test.model"
    if len(sys.argv) == 2:
        model_path = sys.argv[1]

    model = svm.svm_load_model(model_path)
    for line in sys.stdin:
        line = line.strip()
        x = line.split(' ')
        try:
            vx = [{i + 1: float(x[i]) for i in range(len(x))}]
        except:
            continue
        print('vx = ', vx)
        p_label, p_acc, p_val = svm.svm_predict([], vx, model, '-q')
        print('p_val = ', p_val)
Ejemplo n.º 19
0
            innersurround = max(patch[18, 20], patch[20, 18], patch[22, 20],
                                patch[20, 22], patch[18, 18], patch[18, 22],
                                patch[22, 18], patch[22, 22])
            centre = np.sum([
                patch[20, 20], patch[20, 21], patch[20, 19], patch[19, 20],
                patch[21, 20]
            ])
            res = np.array([[
                searchmax, centremax, mean, outersurround, innersurround,
                centre
            ]])
            _, _, pred = svm_predict([], res, model, '-q')
        else:
            pred = None
        contact.append({
            'x': x + imgcorrection,
            'y': y + imgcorrection,
            'patch': patch,
            'searchpatch': searchpatch,
            'mean': mean,
            'searchmax': searchmax,
            'centremax': centremax,
            'confident': confident,
            'prediction': pred[0][0]
        })
    return contact, found, searchimg


pathtoretrodetect = os.path.dirname(__file__)
model = svm_load_model(pathtoretrodetect + '/beetrack.model')
Ejemplo n.º 20
0
 def load_model(self):
     self.model = svm_load_model(self.svm_model_file)  
Ejemplo n.º 21
0
def load_trained_models():
    global models
    for i in range(len(config.MODEL_LABEL)):
        models.append(svmutil.svm_load_model("model" + str(i)))
    return models
Ejemplo n.º 22
0
@author: Nikolay
"""

import csv
import os

from libsvm import svmutil
from prepare_libsvm import load_sda
from chord_utils import list_spectrum_data, through_sda_layers


model_file = 'model/svm.dat'

sda = load_sda()
model = svmutil.svm_load_model(model_file)
chord_list = ['A#-C#-F', 'A#-C#-F#', 'A#-D#-F#', 'A#-D#-G',
              'A#-D-F', 'A#-D-G', 'A-C#-E', 'A-C#-F#', 'A-C-E',
              'A-C-F', 'A-D-F', 'A-D-F#', 'B-D#-F#', 'B-D#-G#',
              'B-D-F#', 'B-D-G', 'B-E-G', 'B-E-G#', 'C#-E-G#',
              'C#-F-G#', 'C-D#-G', 'C-D#-G#', 'C-E-G', 'C-F-G#', 'N']

def process_file(source, target):
    with open(source, 'rb') as i:
        reader = csv.reader(i)
        (before, chords) = list_spectrum_data(reader, components=60, allow_no_chord=True)
    sda_features = through_sda_layers(sda, before)
    # append chord labels as integer numbers
    sda_features = [x.tolist() for x in sda_features]
    (labels, acc, vals) = svmutil.svm_predict([0] * len(sda_features), sda_features, model)
    result = [chord_list[int(x)] for x in labels]
Ejemplo n.º 23
0
 def __setstate__(self, data):
     f = tempfile.NamedTemporaryFile(delete=False)
     with open(f.name, "wb") as h:
         h.write(data['by'])
     self.model = svmutil.svm_load_model(f.name)
     os.remove(f)
Ejemplo n.º 24
0
import PIL.Image
import numpy
import scipy.signal
import skimage.color
import skimage.transform
from libsvm import svmutil

from imquality.models import MODELS_PATH
from imquality.statistics import AsymmetricGeneralizedGaussian, gaussian_kernel2d
from imquality.utils import pil2ndarray

with open(os.path.join(MODELS_PATH, "normalize.pickle"), "rb") as file:
    scale_parameters = pickle.load(file)

model = svmutil.svm_load_model(os.path.join(MODELS_PATH, "brisque_svm.txt"))


class MscnType(Enum):
    mscn = 1
    horizontal = 2
    vertical = 3
    main_diagonal = 4
    secondary_diagonal = 5


class Brisque:
    _local_mean = None
    _local_deviation = None
    _mscn = None
    _features = None
Ejemplo n.º 25
0
def get_dataset(fname,k):
	labels = []
	features = []
	for prot_id,seq in seq2feature.parse_fasta(fname):
		labels.append(prot_id)
		features.append(k_spec(seq,k))
	return labels,features

if __name__ == "__main__":
	parser = argparse.ArgumentParser(description='Predict X binding proteins.')
	
	parser.add_argument('-model',action="store",dest="model")
	parser.add_argument('-thr',action="store",dest="thr",type = float)
	parser.add_argument('-fname',action="store",dest="fname")
	model = parser.parse_args().model
	fname = parser.parse_args().fname
	thr = parser.parse_args().thr
	
	labels,features = get_dataset(fname,2)
	model = svmutil.svm_load_model(model)

	plbl, pacc, pvals = svmutil.svm_predict([0]*len(features),features,model,"")

	for cnt,(prot_id,seq) in enumerate(seq2feature.parse_fasta(fname)):
		pval = pvals[cnt][0]
		if pval >= thr:
			print "> %s:%f" % (prot_id,pval)
			print seq
	
Ejemplo n.º 26
0
def main():
    m = svmutil.svm_load_model('trained_models/svm.model')
    relation_tag = {0: 'None', 1: 'has_value', 2: 'has_temp', 3: 'modified_by'}

    match = re.search('^(.*)\.txt', sys.argv[2])
    filename = sys.argv[2]
    if match:
        filename = match.group(1)

    input_dir = sys.argv[1] + '/' + filename + '_NER.xml'
    output_dir = sys.argv[1] + '/' + filename + '_Parsed.xml'
    print "Reading NER results from ", input_dir

    tree = ET.ElementTree(file=input_dir)

    root = tree.getroot()
    relations = {}
    index = []
    for child in root:

        syn_features = codecs.open('Tempfile/relation_scale', 'w')
        temp_pairs = relation_features.generate_pairs(child, syn_features)
        if temp_pairs:
            try:
                y, x = svmutil.svm_read_problem('Tempfile/relation_scale')
                p_label, p_acc, p_val = svmutil.svm_predict(y, x, m)
            except ValueError:
                for child2 in child.findall('text'):
                    print child2.text
                continue

        #print len(p_label),len(temp_pairs)
        else:
            p_label = []
            temp_pairs = []
        for j in range(0, len(p_label)):
            #print j
            relations[temp_pairs[j]] = p_label[j]

            indexes = temp_pairs[j].split("_")
            index.append(indexes[0])
            index.append(indexes[1])

        for child2 in child.findall('entity'):
            node_index = child2.attrib['index']
            child2.attrib['relation'] = 'None'

            if node_index in index:

                right_pattern = '^(\w+)_' + node_index
                left_pattern = node_index + '_(\w+)$'
                for relation in relations:
                    match1 = re.search(left_pattern, relation)
                    match2 = re.search(right_pattern, relation)
                    other_index = None
                    if match1:
                        other_index = match1.group(1)
                    else:
                        if match2:
                            other_index = match2.group(1)
                        else:
                            continue
                    relation_type = relation_tag[relations[relation]]
                    if relation_type == 'None':
                        continue

                    if child2.attrib['relation'] is 'None':
                        child2.attrib[
                            'relation'] = other_index + ":" + relation_type
                    else:
                        child2.attrib['relation'] = child2.attrib[
                            'relation'] + "|" + other_index + ":" + relation_type
            #print child2.text,child2.attrib['index'],child2.attrib['relation']

    relation_excuted = os.path.exists("in.parse")
    if relation_excuted:
        os.system('rm in.parse')
    os.system('rm Tempfile/relation_scale')
    print "Writing Relation xml to ", output_dir
    new_tree = codecs.open(output_dir, 'w')
    tree.write(new_tree)
    print "Finished!"
Ejemplo n.º 27
0
def get_indexes(kind):
	train_str = cfg.get('indexes', kind)
	indexes = eval(train_str)
	result = [j for i in indexes for j in range(i[0], i[2], i[1])]
	return sorted(result)

cfg = ConfigParser()
cfg.read('config.ini')

f = open(cfg.get('kmeans', 'path'), 'rb')
kmeans = pickle.loads(f.read())
f.close()

train_indexes = get_indexes('train')
bootstrap_indexes = get_indexes('bootstrap')
test_indexes = get_indexes('test')

slide = cfg.getint('params', 'slide')
folder = cfg.get('params', 'folder')
neg_weight = cfg.getint('params', 'neg_weight')
marginX = cfg.getint('params', 'marginX')
marginY = cfg.getint('params', 'marginY')
non_max_thresh = cfg.getfloat('params', 'non_max_threshold')

get_c_iteration = cfg.getboolean('svm', 'c_iteration')
def_c_value = cfg.getfloat('svm', 'def_c_value')
s_windows = eval(cfg.get('svm', 's_windows'))
svm = svm_load_model(cfg.get('svm', 'path'))

mode = cfg.get('configs', 'mode')