Commit 682783db authored by Pavel KORSHUNOV's avatar Pavel KORSHUNOV

small optimization of svm

parent 1ca402d9
......@@ -654,8 +654,8 @@ class VideoSvmPadAlgorithm(Algorithm):
del machine
del trainer
selected_params = trainer_grid_search_params_list[
np.argmax(precisions_cv)] # best SVM parameters according to CV set
# best SVM parameters according to CV set
selected_params = trainer_grid_search_params_list[np.argmax(precisions_cv)]
trainer = bob.learn.libsvm.Trainer(machine_type=machine_type,
kernel_type=kernel_type,
......@@ -685,6 +685,8 @@ class VideoSvmPadAlgorithm(Algorithm):
# training_features[1] - training features for the ATTACK class.
attack = self.convert_and_prepare_features(training_features[1]) # output is array
features_mean = 0.0
features_std = 1.0
if mean_std_norm_flag:
# Normalize the data:
if not (one_class_flag): # two-class SVM case
......@@ -714,6 +716,10 @@ class VideoSvmPadAlgorithm(Algorithm):
data = [np.copy(real)] # only real class used for training
# free the memory of unnecessary data
del real
del attack
machine = trainer.train(data) # train the machine
if mean_std_norm_flag:
......
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