rustface/classifier/
mod.rs

1// This file is part of the open-source port of SeetaFace engine, which originally includes three modules:
2//      SeetaFace Detection, SeetaFace Alignment, and SeetaFace Identification.
3//
4// This file is part of the SeetaFace Detection module, containing codes implementing the face detection method described in the following paper:
5//
6//      Funnel-structured cascade for multi-view face detection with alignment awareness,
7//      Shuzhe Wu, Meina Kan, Zhenliang He, Shiguang Shan, Xilin Chen.
8//      In Neurocomputing (under review)
9//
10// Copyright (C) 2016, Visual Information Processing and Learning (VIPL) group,
11// Institute of Computing Technology, Chinese Academy of Sciences, Beijing, China.
12//
13// As an open-source face recognition engine: you can redistribute SeetaFace source codes
14// and/or modify it under the terms of the BSD 2-Clause License.
15//
16// You should have received a copy of the BSD 2-Clause License along with the software.
17// If not, see < https://opensource.org/licenses/BSD-2-Clause>.
18
19mod lab_boosted_classifier;
20mod surf_mlp_classifier;
21
22pub use self::lab_boosted_classifier::LabBoostedClassifier;
23pub use self::surf_mlp_classifier::SurfMlpClassifier;
24pub use self::surf_mlp_classifier::SurfMlpBuffers;
25
26#[derive(Debug, Hash, PartialEq, Eq, Clone)]
27pub enum ClassifierKind {
28    LabBoosted,
29    SurfMlp,
30}
31
32impl ClassifierKind {
33    #[inline]
34    pub fn from(id: i32) -> Option<Self> {
35        match id {
36            0 => Some(ClassifierKind::LabBoosted),
37            1 => Some(ClassifierKind::SurfMlp),
38            _ => None,
39        }
40    }
41}
42
43pub struct Score {
44    positive: bool,
45    score: f32,
46}
47
48impl Score {
49    #[inline]
50    pub fn is_positive(&self) -> bool {
51        self.positive
52    }
53
54    #[inline]
55    pub fn score(&self) -> f32 {
56        self.score
57    }
58}
59
60#[derive(Clone)]
61pub enum Classifier {
62    SurfMlp(SurfMlpClassifier),
63    LabBoosted(LabBoostedClassifier),
64}