mv_machine_learning: use carnel notation
[platform/core/api/mediavision.git] / mv_machine_learning / face_recognition / src / facenet_adapter.cpp
1 /**
2  * Copyright (c) 2022 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 #include "machine_learning_exception.h"
18 #include "facenet_adapter.h"
19
20 using namespace std;
21 using namespace MediaVision::Common;
22 using namespace mediavision::machine_learning;
23 using namespace mediavision::machine_learning::exception;
24
25 namespace mediavision
26 {
27 namespace machine_learning
28 {
29 template<typename T, typename V> FacenetAdapter<T, V>::FacenetAdapter() : _source()
30 {
31         _facenet = make_unique<Facenet>();
32 }
33
34 template<typename T, typename V> FacenetAdapter<T, V>::~FacenetAdapter()
35 {}
36
37 template<typename T, typename V> void FacenetAdapter<T, V>::create(int type)
38 {
39         throw InvalidOperation("Not support yet.");
40 }
41
42 template<typename T, typename V> void FacenetAdapter<T, V>::configure()
43 {
44         _facenet->parseMetaFile();
45         _facenet->configure();
46 }
47
48 template<typename T, typename V> void FacenetAdapter<T, V>::prepare()
49 {
50         _facenet->prepare();
51 }
52
53 template<typename T, typename V> void FacenetAdapter<T, V>::setInput(T &t)
54 {
55         _source = t;
56 }
57
58 template<typename T, typename V> void FacenetAdapter<T, V>::perform()
59 {
60         _facenet->preprocess(_source.inputs[0]);
61         _facenet->inference(_source.inputs[0]);
62 }
63
64 template<typename T, typename V> V &FacenetAdapter<T, V>::getOutput()
65 {
66         return _facenet->result();
67 }
68
69 template class FacenetAdapter<FacenetInput, FacenetOutput>;
70 }
71 }