| 202 | # max_cache_size = 20 |
| 203 | |
| 204 | def __init__(self, samples, labels): |
| 205 | # dlib.solve_structural_svm_problem() expects the class to have |
| 206 | # num_samples and num_dimensions fields. These fields should contain |
| 207 | # the number of training samples and the dimensionality of the PSI |
| 208 | # feature vector respectively. |
| 209 | self.num_samples = len(samples) |
| 210 | self.num_dimensions = len(samples[0])*3 |
| 211 | |
| 212 | self.samples = samples |
| 213 | self.labels = labels |
| 214 | |
| 215 | def make_psi(self, x, label): |
| 216 | """Compute PSI(x,label).""" |