DeepFaceRecognition.h
Go to the documentation of this file.
1/*
2 * This file is part of ArmarX.
3 *
4 * ArmarX is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
8 * ArmarX is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * @package VisionX::ArmarXObjects::DeepFaceRecognition
17 * @author Mirko Waechter (waechter at kit dot edu)
18 * @date 2017
19 * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20 * GNU General Public License
21 */
22
23#pragma once
24
25#include <RobotAPI/interface/speech/SpeechInterface.h>
26
28#include <VisionX/interface/components/FaceRecognitionInterface.h>
29#include <VisionX/interface/components/PointCloudAndImageAndCalibrationProviderInterface.h>
31
32#include <MemoryX/interface/components/LongtermMemoryInterface.h>
33
34//#include <Python.h>
35
36
37namespace visionx
38{
39 /**
40 * @class DeepFaceRecognitionPropertyDefinitions
41 * @brief
42 */
44 {
45 public:
48 {
50 "AgentName", "Armar3", "Name of the robot that does the localization");
52 "CameraFrameName",
53 "EyeLeftCamera",
54 "Name of the camera frame of the robot that does the localization");
56 "GreetAgainDelay",
57 60 * 60 * 12,
58 "Time in seconds between that a person is not greeted again");
59 // defineOptionalProperty<int>("FaceMatchCounter", 3, "How many times a face must be seen until a greeting is send to the TTS");
61 "GreetThreshold",
62 3.0,
63 "The sum of all gaussians of the recognized faces over time.",
65 defineOptionalProperty<std::string>("ImageProviderName",
66 "OpenNIPointCloudProvider",
67 "Name of the Imageprovider to be used");
68 }
69 };
70
71 /**
72 * @defgroup Component-DeepFaceRecognition DeepFaceRecognition
73 * @ingroup VisionX-Components
74 * A description of the component DeepFaceRecognition.
75 *
76 * @class DeepFaceRecognition
77 * @ingroup Component-DeepFaceRecognition
78 * @brief Brief description of class DeepFaceRecognition.
79 *
80 * Detailed description of class DeepFaceRecognition.
81 */
83 public armarx::Component,
84 virtual public memoryx::ObjectLocalizerInterface
85 {
86 public:
87 /**
88 * @see armarx::ManagedIceObject::getDefaultName()
89 */
90 std::string
91 getDefaultName() const override
92 {
93 return "DeepFaceRecognition";
94 }
95
96 protected:
97 memoryx::ObjectLocalizationResultList
98 localizeAndIdentifyFaces(CByteImage** cameraImages,
99 armarx::MetaInfoSizeBasePtr imageMetaInfo,
100 CByteImage** resultImages);
101 // /**
102 // * @see ObjectLocalizerProcessor::onInitObjectLocalizerProcessor()
103 // */
104 // void onInitObjectLocalizerProcessor();
105
106 // /**
107 // * @see ObjectLocalizerProcessor::onConnectObjectLocalizerProcessor()
108 // */
109 // void onConnectObjectLocalizerProcessor();
110
111 // /**
112 // * @see ObjectLocalizerProcessor::onExitObjectLocalizerProcessor()
113 // */
114 // void onExitObjectLocalizerProcessor();
115
116 // /**
117 // * Add a memory entity representing the hand marker in order to set its properties
118 // *
119 // * @param objectClassEntity entity containing all information available for the object class
120 // * @param fileManager GridFileManager required to read files associated to prior knowledge from the database.
121 // *
122 // * @return success of adding this entity
123 // */
124 // memoryx::ObjectLocalizationResultList localizeObjectClasses(const std::vector<std::string>& objectClassNames, CByteImage** cameraImages, armarx::MetaInfoSizeBasePtr imageMetaInfo, CByteImage** resultImages) override;
125
126 // /**
127 // * Initializes segmentable recognition
128 // *
129 // * @return success
130 // */
131 // bool initRecognizer();
132
133 // /**
134 // * Add a memory entity representing the hand marker in order to set its properties
135 // *
136 // * @param objectClassEntity entity containing all information available for the object class
137 // * @param fileManager GridFileManager required to read files associated to prior knowledge from the database.
138 // *
139 // * @return success of adding this entity
140 // */
141 // bool addObjectClass(const memoryx::EntityPtr& objectClassEntity, const memoryx::GridFileManagerPtr& fileManager);
142
143 /**
144 * @see PropertyUser::createPropertyDefinitions()
145 */
148 std::map<std::string, std::list<std::pair<IceUtil::Time, double>>>;
149
150 private:
151 visionx::FaceRecognitionInterfacePrx faceReg;
152 memoryx::LongtermMemoryInterfacePrx ltm;
153 ::memoryx::EntityMemorySegmentInterfacePrx faceSegmentPrx;
154 armarx::TextListenerInterfacePrx tts;
155 visionx::CapturingPointCloudAndImageAndCalibrationProviderInterfacePrx imageProvider;
156 const std::string faceSegmentName = "faceMemory";
157 std::shared_ptr<CCalibration> calibration;
158 FaceConfidenceHistory faceConfidenceHistory;
159 // PyObject* pModule, *py_main;
160
161 float updateAndCheckFaceExistenceProbability(const visionx::FaceLocation& faceLocation);
162 // ObjectLocalizerInterface interface
163 public:
164 memoryx::ObjectLocalizationResultList
165 localizeObjectClasses(const memoryx::ObjectClassNameList& classes,
166 const Ice::Current&) override;
167
168 // ManagedIceObject interface
169 protected:
170 void onInitComponent() override;
171 void onConnectComponent() override;
172 };
173} // namespace visionx
Default component property definition container.
Definition Component.h:70
ComponentPropertyDefinitions(std::string prefix, bool hasObjectNameParameter=true)
Definition Component.cpp:46
Baseclass for all ArmarX ManagedIceObjects requiring properties.
Definition Component.h:94
std::string prefix
Prefix of the properties such as namespace, domain, component name, etc.
PropertyDefinition< PropertyType > & defineOptionalProperty(const std::string &name, PropertyType defaultValue, const std::string &description="", PropertyDefinitionBase::PropertyConstness constness=PropertyDefinitionBase::eConstant)
Brief description of class DeepFaceRecognition.
void onInitComponent() override
Pure virtual hook for the subclass.
std::map< std::string, std::list< std::pair< IceUtil::Time, double > > > FaceConfidenceHistory
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
Add a memory entity representing the hand marker in order to set its properties.
memoryx::ObjectLocalizationResultList localizeObjectClasses(const memoryx::ObjectClassNameList &classes, const Ice::Current &) override
void onConnectComponent() override
Pure virtual hook for the subclass.
memoryx::ObjectLocalizationResultList localizeAndIdentifyFaces(CByteImage **cameraImages, armarx::MetaInfoSizeBasePtr imageMetaInfo, CByteImage **resultImages)
std::string getDefaultName() const override
This file offers overloads of toIce() and fromIce() functions for STL container types.
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.
ArmarX headers.