video_svm_pad_algorithm.py 1.62 KB
Newer Older
1
2
#!/usr/bin/env python

3
from bob.pad.base.algorithm import SVM
4
5
6
7
8
9
10

#=======================================================================================
# Define instances here:

machine_type = 'C_SVC'
kernel_type = 'RBF'
n_samples = 10000
11
# trainer_grid_search_params = {'cost': [2**p for p in range(-5, 16, 2)], 'gamma': [2**p for p in range(-15, 4, 2)]}
12
13
14
15
trainer_grid_search_params = {
    'cost': [2**p for p in range(-3, 14, 2)],
    'gamma': [2**p for p in range(-15, 0, 2)]
}
16
mean_std_norm_flag = True
17
18
frame_level_scores_flag = False  # one score per video(!) in this case

19
video_svm_pad_algorithm_10k_grid_mean_std = SVM(
20
21
22
23
24
25
26
27
28
    machine_type=machine_type,
    kernel_type=kernel_type,
    n_samples=n_samples,
    trainer_grid_search_params=trainer_grid_search_params,
    mean_std_norm_flag=mean_std_norm_flag,
    frame_level_scores_flag=frame_level_scores_flag)

frame_level_scores_flag = True  # one score per frame(!) in this case

29
video_svm_pad_algorithm_10k_grid_mean_std_frame_level = SVM(
30
31
32
33
34
35
36
37
38
39
40
41
    machine_type=machine_type,
    kernel_type=kernel_type,
    n_samples=n_samples,
    trainer_grid_search_params=trainer_grid_search_params,
    mean_std_norm_flag=mean_std_norm_flag,
    frame_level_scores_flag=frame_level_scores_flag)

trainer_grid_search_params = {
    'cost': [1],
    'gamma': [0]
}  # set the default LibSVM parameters

42
video_svm_pad_algorithm_default_svm_param_mean_std_frame_level = SVM(
43
44
45
46
47
48
    machine_type=machine_type,
    kernel_type=kernel_type,
    n_samples=n_samples,
    trainer_grid_search_params=trainer_grid_search_params,
    mean_std_norm_flag=mean_std_norm_flag,
    frame_level_scores_flag=frame_level_scores_flag)